def get_volume(self, uuid):
return self.cinder.volumes.get(uuid)
+ def get_volume_attachments(self, volume_uuid):
+ volume = self.cinder.volumes.get(volume_uuid)
+ return volume.attachments
+
def get_keypairs(self):
keypairs = self.nova.keypairs.list()
resp = []
existing_volumes.append(uuid)
for uuid in existing_volumes:
if self.check_volume_attached(uuid):
- logger.info("Detaching volume {}".format(uuid))
- self.cinder.volumes.detach(uuid)
+ for attachment in self.get_volume_attachments(uuid):
+ logger.info("Detaching volume {}".format(uuid))
+ self.cinder.volumes.detach(uuid, attachment['attachment_id'])
try:
helpers.wait_false(self.check_any_volume_attached,
interval=3,