Reputation: 351
i'm trying to create a VM using libcloud with auto delete feature. The thing is that it only works for boot disks.
Example:
new_node = driver.create_node("my_node_str", size, get_root_snapshot(driver), location,ex_service_accounts=sa_scopes, ex_disk_auto_delete=True, ...
Then I attach a disk:
driver.attach_volume(my_node,...,ex_boot=False, ex_auto_delete=True)
So i go to GCE and this volume auto delete is turned OFF
So, i try to change it "manually" using libcloud:
conn.ex_set_volume_auto_delete(vol, node)
And I get the error :
libcloud.common.google.GoogleBaseError: u"Invalid value for field 'disk': 'myvolume1-worker-disk'
But the disk is created, attached and it is working on my VM.
Debugging libloud everything seems to be ok acording to documentation (https://cloud.google.com/compute/docs/reference/latest/instances/setDiskAutoDelete):
It calls:
u'/zones/us-central1-b/instances/myinstancename/setDiskAutoDelete'
With parameters:
'deviceName': volume.name, 'autoDelete': auto_delete,
any clues?
Upvotes: 0
Views: 86
Reputation: 76
It looks like there may be a bug with attach_volume
. I'll do a bit of testing and get that fixed up if so.
Regarding using ex_set_volume_auto_delete
, you need to pass in a StorageVolume
object. It looks like you are just passing in a string (the name of the disk).
You could try,
disk_obj = driver.ex_get_volume('string-name-of-disk')
driver.ex_set_volume_auto_delete(node_obj, disk_obj, ex_auto_delete=True)
I'll follow up about the first issue when I look into it more.
Upvotes: 1