Пример #1
0
 def _detach_volumes_task(self):
     '''
     Detach volumes from the instance
     '''
     detach_tasks = (volume.VolumeDetachTask(self.stack, self.resource_id,
                                             volume_id)
                     for volume_id, device in self.volumes())
     return scheduler.PollingTaskGroup(detach_tasks)
Пример #2
0
    def handle_delete(self):
        '''
        Delete an instance, blocking until it is disposed by OpenStack
        '''
        if self.resource_id is None:
            return

        detach_tasks = (volume.VolumeDetachTask(self.stack, self.resource_id,
                                                volume_id)
                        for volume_id, device in self.volumes())
        scheduler.TaskRunner(scheduler.PollingTaskGroup(detach_tasks))()

        try:
            server = self.nova().servers.get(self.resource_id)
        except clients.novaclient.exceptions.NotFound:
            pass
        else:
            delete = scheduler.TaskRunner(self._delete_server, server)
            delete(wait_time=0.2)

        self.resource_id = None