Skip to content

Commit

Permalink
allow delection when task errored and no longer set instance boot order
Browse files Browse the repository at this point in the history
  • Loading branch information
rmb938 committed Jan 27, 2018
1 parent 7bb903b commit df4a891
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion deli/counter/http/mounts/root/routes/v1/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def delete(self, **_):
cherrypy.response.status = 204

instance: Instance = cherrypy.request.resource_object
if instance.task is not None:
if instance.task is not None and instance.state != ResourceState.Error:
raise cherrypy.HTTPError(400, "Please wait for the current task to finish.")
if instance.state == ResourceState.ToDelete or instance.state == ResourceState.Deleting:
raise cherrypy.HTTPError(400, "Instance is already being deleting")
Expand Down
2 changes: 1 addition & 1 deletion deli/counter/http/mounts/root/routes/v1/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def delete(self, **_):
cherrypy.response.status = 204

volume: Volume = cherrypy.request.resource_object
if volume.task is not None:
if volume.task is not None and volume.state != ResourceState.Error:
raise cherrypy.HTTPError(400, "Please wait for the current task to finish.")
if volume.state == ResourceState.ToDelete or volume.state == ResourceState.Deleting:
raise cherrypy.HTTPError(400, "Volume is already being deleting")
Expand Down
8 changes: 1 addition & 7 deletions deli/manager/vmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,10 @@ def create_vm_from_image(self, vm_name, image, cluster, datastore, folder, port_
nic.device.connectable.allowGuestControl = True

vmconf = vim.vm.ConfigSpec()
vmconf.numCPUs = vcpus # TODO: allow customization of these
vmconf.numCPUs = vcpus
vmconf.memoryMB = ram
vmconf.deviceChange = [nic]

vmconf.bootOptions = vim.vm.BootOptions()
# Set the boot device to the first disk just in-case it was set to something else
boot_disk_device = vim.vm.BootOptions.BootableDiskDevice()
boot_disk_device.deviceKey = 2000
vmconf.bootOptions.bootOrder = [boot_disk_device]

enable_uuid_opt = vim.option.OptionValue()
enable_uuid_opt.key = 'disk.enableUUID' # Allow the guest to easily mount extra disks
enable_uuid_opt.value = '1'
Expand Down

0 comments on commit df4a891

Please sign in to comment.