def _detach(cls, disk_id):
        """ Detach a disk from a vm. """
        disk = cls._info(disk_id)
        opers = []
        if disk.get('vms_id'):
            for vm_id in disk['vms_id']:
                cls.echo('The disk is still attached to the vm %s.' % vm_id)
                cls.echo('Will detach it.')
                opers.append(cls.call('hosting.vm.disk_detach',
                                      vm_id, disk_id))
        return opers
def _detach ( cls , disk_id ) : disk = cls . _info ( disk_id ) opers = [ ] if disk . get ( 'vms_id' ) : for vm_id in disk [ 'vms_id' ] : cls . echo ( 'The disk is still attached to the vm %s.' % vm_id ) cls . echo ( 'Will detach it.' ) opers . append ( cls . call ( 'hosting.vm.disk_detach' , vm_id , disk_id ) ) return opers
Detach a disk from a vm.