Gandi / gandi.cli

⚠ ARCHIVED - Command line interface to Gandi.net products using the public API
http://cli.gandi.net/
GNU General Public License v3.0
347 stars 62 forks source link

'Error on object : OBJECT_DISK (CAUSE_ATTACHED) [disk#17132652 associated with snapshot#17212524 is attached]' #213

Closed fenix011 closed 7 years ago

fenix011 commented 7 years ago
(gandi.cli)jordi@i-ching:/DATA/gandi.cli$ gandi disk list
...
----------
name      : sys_panoramix_20170326213724
state     : created
size      : 8192
----------
name      : Ax-sysdisk_20170326223722
state     : created
size      : 8192
----------
name      : apache-prefork
state     : created
size      : 8192
----------
name      : apache-worker
state     : created
size      : 8192
(gandi.cli)jordi@i-ching:/DATA/gandi.cli$ gandi disk rollback sys_panoramix_20170326213724
Usage: gandi disk rollback [OPTIONS] RESOURCE

Error: Gandi API has returned an error: <Fault 530439: 'Error on object : OBJECT_DISK (CAUSE_ATTACHED) [disk#17132652 associated with snapshot#17212524 is attached]'>

What am i missing ?

thanks beforehand

sayoun commented 7 years ago

Hello,

GANDI API don't allow to rollback a disk which is still attached to a vm, so you must first detach your disk disk#17132652 before be allowed to rollback, so in your case this command should solve this

gandi disk detach sys_panoramix_20170326213724

fenix011 commented 7 years ago
Umh... i'm puzzled. Let me try to
  explain me why i am so. In my our scenario : being

  sys_panoramix_20170326213724 

  as the one 'snapshoted disk' from  which we want to
  rollback, and 

  sys_panoramix

  the disk currently in use. 

  shouldn't be 

    $ gandi disk detach sys_panoramix

  $ gandi disk rollback sys_panoramix_20170326213724

  the right steps/ commands ?
sayoun commented 7 years ago

You're right, I don't have IDs of your disks to know which one was disk with id #17132652 so I assumed you only had the ones listed in the issue so I took the first one.

fenix011 commented 7 years ago

Uops ! S.O.S.

(gandi.cli)jordi@i-ching:/DATA/gandi.cli$ gandi disk detach sys_panoramix
Are you sure you want to detach sys_panoramix? [y/N]: y
The disk is still attached to the vm 275068.
Will detach it.
Detaching your disk(s).
Progress: [#####################################################---------------------------] 66.67%  00:00:01  
An error has occured during operation processing: can't detach boot disk while vm is running
(gandi.cli)jordi@i-ching:/DATA/gandi.cli$ gandi vm stop panoramix
Stopping your Virtual Machine(s) 'panoramix'.
Progress: [################################################################################] 100.00%  00:00:21  
(gandi.cli)jordi@i-ching:/DATA/gandi.cli$ gandi disk detach sys_panoramix
Are you sure you want to detach sys_panoramix? [y/N]: y
The disk is still attached to the vm 275068.
Will detach it.
Detaching your disk(s).
Progress: [################################################################################] 100.00%  00:00:08  
(gandi.cli)jordi@i-ching:/DATA/gandi.cli$ gandi disk rollback sys_panoramix_20170331213724
Disk rollback in progress.
Progress: [################################################################################] 100.00%  00:00:21  
(gandi.cli)jordi@i-ching:/DATA/gandi.cli$ gandi vm start panoramix
Usage: gandi vm start [OPTIONS] RESOURCE...

Error: Gandi API has returned an error: <Fault 530246: 'Error on object : OBJECT_VM (CAUSE_NO_DISK) [trying to start a VM with no disk attached]'>
(gandi.cli)jordi@i-ching:/DATA/gandi.cli$ gandi disk attach sys_panoramix
Usage: gandi disk attach [OPTIONS] DISK VM

Error: Missing argument "vm".
(gandi.cli)jordi@i-ching:/DATA/gandi.cli$ gandi disk attach sys_panoramix panoramix
Are you sure you want to attach disk 'sys_panoramix' to vm 'panoramix'? [y/N]: y
Attaching your disk(s).
Progress: [################################################################################] 100.00%  00:00:16  
(gandi.cli)jordi@i-ching:/DATA/gandi.cli$ gandi vm start panoramix
Starting your Virtual Machine(s) 'panoramix'.
Progress: [#####################################################---------------------------] 66.67%  00:00:09  
An error has occured during operation processing: Operation failed to complete

what are we missing here ?

fenix011 commented 7 years ago

ah... as per @aze suggestion, i failed to set up newly attached disk as 'boot disk'. Accordingly, instead of

$ gandi disk attach sys_panoramix panoramix

command to issue may have been.. :

$ gandi disk attach sys_panoramix panoramix -p 0

...instead. Note the appended -p 0 parameters .