Skip to content

Commit

Permalink
Register the vm provisioning deadline under a separate label
Browse files Browse the repository at this point in the history
We have a known issue #718. If the label that we register deadline
fails, we can't persist the deadline information to the strand's stack.
When there is no space left, an exception is raised, preventing the vm
strand from saving the deadline. We don't receive pages due to slow
provisioning if the delay is caused by capacity issues.

I moved the deadline registration to a different label until we find an
elegant solution for issue #718.
  • Loading branch information
enescakir committed Oct 17, 2023
1 parent de751db commit fe0d966
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions prog/vm/nexus.rb
Expand Up @@ -195,7 +195,10 @@ def before_run

label def start
register_deadline(:wait, 10 * 60)
hop_allocate_vm
end

label def allocate_vm
vm_host_id = allocate
vm_host = VmHost[vm_host_id]
ip4, address = vm_host.ip4_random_vm_network if vm.ip4_enabled
Expand Down
13 changes: 10 additions & 3 deletions spec/prog/vm/nexus_spec.rb
Expand Up @@ -225,6 +225,13 @@
end

describe "#start" do
it "registers a deadline and hops" do
expect(nx).to receive(:register_deadline)
expect { nx.start }.to hop("allocate_vm")
end
end

describe "#allocate_vm" do
it "allocates the vm to a host" do
vmh_id = "46ca6ded-b056-4723-bd91-612959f52f6f"
vmh = VmHost.new(
Expand All @@ -239,7 +246,7 @@
expect(args[:vm_host_id]).to match vmh_id
end

expect { nx.start }.to hop("create_unix_user")
expect { nx.allocate_vm }.to hop("create_unix_user")
end

it "allocates the vm to a host with IPv4 address" do
Expand All @@ -258,7 +265,7 @@
expect(AssignedVmAddress).to receive(:create_with_id).and_return(assigned_address)
expect(vm).to receive(:update)

expect { nx.start }.to hop("create_unix_user")
expect { nx.allocate_vm }.to hop("create_unix_user")
end

it "fails if there is no ip address available but the vm is ip4 enabled" do
Expand All @@ -273,7 +280,7 @@
expect(vmh).to receive(:ip4_random_vm_network).and_return([nil, nil])
expect(vm).to receive(:ip4_enabled).and_return(true).at_least(:once)

expect { nx.start }.to raise_error(RuntimeError, /no ip4 addresses left/)
expect { nx.allocate_vm }.to raise_error(RuntimeError, /no ip4 addresses left/)
end
end

Expand Down

0 comments on commit fe0d966

Please sign in to comment.