# Introduce SR try: sr_ref = self.introduce_sr(uuid, label, sr_params) LOG.debug(_('Introduced %(label)s as %(sr_ref)s.') % locals()) except self.XenAPI.Failure, exc: LOG.exception(exc) raise StorageError(_('Unable to introduce Storage Repository')) if 'vdi_uuid' in data: vdi_uuid = data['vdi_uuid'] else: vdi_uuid = None # Introduce VDI and attach VBD to VM try: vdi_ref = VolumeHelper.introduce_vdi(self._session, sr_ref, vdi_uuid) except StorageError, exc: LOG.exception(exc) self.forget_sr(uuid) raise Exception(_('Unable to create VDI on SR %(sr_ref)s for' ' instance %(instance_name)s') % locals()) dev_number = VolumeHelper.mountpoint_to_number(mountpoint) try: vbd_ref = VolumeHelper.create_vbd(self._session, vm_ref, vdi_ref, dev_number, False) except self.XenAPI.Failure, exc: LOG.exception(exc)
# Introduce SR try: sr_ref = self.introduce_sr(uuid, label, sr_params) LOG.debug(_('Introduced %(label)s as %(sr_ref)s.') % locals()) except self.XenAPI.Failure, exc: LOG.exception(exc) raise StorageError(_('Unable to introduce Storage Repository')) if 'vdi_uuid' in data: vdi_uuid = data['vdi_uuid'] else: vdi_uuid = None # Introduce VDI and attach VBD to VM try: vdi_ref = VolumeHelper.introduce_vdi(self._session, sr_ref, vdi_uuid) except StorageError, exc: LOG.exception(exc) self.forget_sr(uuid) raise Exception( _('Unable to create VDI on SR %(sr_ref)s for' ' instance %(instance_name)s') % locals()) dev_number = VolumeHelper.mountpoint_to_number(mountpoint) try: vbd_ref = VolumeHelper.create_vbd(self._session, vm_ref, vdi_ref, dev_number, False) except self.XenAPI.Failure, exc: LOG.exception(exc) self.forget_sr(uuid) raise Exception(