本文整理匯總了Python中nova.virt.xenapi.volumeops.VolumeOps.delete_volume_for_sm方法的典型用法代碼示例。如果您正苦於以下問題:Python VolumeOps.delete_volume_for_sm方法的具體用法?Python VolumeOps.delete_volume_for_sm怎麽用?Python VolumeOps.delete_volume_for_sm使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類nova.virt.xenapi.volumeops.VolumeOps
的用法示例。
在下文中一共展示了VolumeOps.delete_volume_for_sm方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: XenSMDriver
# 需要導入模塊: from nova.virt.xenapi.volumeops import VolumeOps [as 別名]
# 或者: from nova.virt.xenapi.volumeops.VolumeOps import delete_volume_for_sm [as 別名]
#.........這裏部分代碼省略.........
# volume are both running on this host, then, as a
# part of detach_volume, compute could potentially forget SR
self._create_storage_repo(self.ctxt, backend)
sm_vol_rec = self._volumeops.\
create_volume_for_sm(volume,
backend['sr_uuid'])
if sm_vol_rec:
LOG.debug(_('Volume will be created in backend - %d') \
% backend['id'])
break
if sm_vol_rec:
# Update db
sm_vol_rec['id'] = volume['id']
sm_vol_rec['backend_id'] = backend['id']
try:
self.db.sm_volume_create(self.ctxt, sm_vol_rec)
except Exception as ex:
LOG.exception(ex)
raise exception.Error(_("Failed to update volume in db"))
else:
raise exception.Error(_('Unable to create volume'))
def delete_volume(self, volume):
vol_rec = self.db.sm_volume_get(self.ctxt, volume['id'])
try:
# If compute runs on this node, detach could have disconnected SR
backend_ref = self.db.sm_backend_conf_get(self.ctxt,
vol_rec['backend_id'])
self._create_storage_repo(self.ctxt, backend_ref)
self._volumeops.delete_volume_for_sm(vol_rec['vdi_uuid'])
except Exception as ex:
LOG.exception(ex)
raise exception.Error(_("Failed to delete vdi"))
try:
self.db.sm_volume_delete(self.ctxt, volume['id'])
except Exception as ex:
LOG.exception(ex)
raise exception.Error(_("Failed to delete volume in db"))
def local_path(self, volume):
return str(volume['id'])
def undiscover_volume(self, volume):
"""Undiscover volume on a remote host."""
pass
def discover_volume(self, context, volume):
return str(volume['id'])
def check_for_setup_error(self):
pass
def create_export(self, context, volume):
"""Exports the volume."""
# !!! TODO
pass
def remove_export(self, context, volume):
"""Removes an export for a logical volume."""
pass