diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-02-22 03:52:41 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-02-22 03:52:41 +0000 |
| commit | b084bca867ef8d3f47810fe26f859537322688c9 (patch) | |
| tree | ebedd9bd4c95501aed046edbcbaf98f502e20795 | |
| parent | efc00f89f704110ce4393ea1a70fc934d08f4e09 (diff) | |
| parent | 5a728f90d1ccf9a5264ef14648c7ec1fd35ee229 (diff) | |
Merge "xenapi: nova-volume support for multiple luns"
| -rw-r--r-- | nova/virt/xenapi/volume_utils.py | 11 | ||||
| -rw-r--r-- | nova/virt/xenapi/volumeops.py | 7 |
2 files changed, 16 insertions, 2 deletions
diff --git a/nova/virt/xenapi/volume_utils.py b/nova/virt/xenapi/volume_utils.py index eda77f183..e8124f7ef 100644 --- a/nova/virt/xenapi/volume_utils.py +++ b/nova/virt/xenapi/volume_utils.py @@ -235,13 +235,22 @@ class VolumeHelper(HelperBase): ' PBD %(pbd)s') % locals()) @classmethod - def introduce_vdi(cls, session, sr_ref, vdi_uuid=None): + def introduce_vdi(cls, session, sr_ref, vdi_uuid=None, target_lun=None): """Introduce VDI in the host""" try: session.call_xenapi("SR.scan", sr_ref) if vdi_uuid: LOG.debug("vdi_uuid: %s" % vdi_uuid) vdi_ref = session.call_xenapi("VDI.get_by_uuid", vdi_uuid) + elif target_lun: + vdi_refs = session.call_xenapi("SR.get_VDIs", sr_ref) + for curr_ref in vdi_refs: + curr_rec = session.call_xenapi("VDI.get_record", curr_ref) + if ('sm_config' in curr_rec and + 'LUNid' in curr_rec['sm_config'] and + curr_rec['sm_config']['LUNid'] == str(target_lun)): + vdi_ref = curr_ref + break else: vdi_ref = (session.call_xenapi("SR.get_VDIs", sr_ref))[0] except cls.XenAPI.Failure, exc: diff --git a/nova/virt/xenapi/volumeops.py b/nova/virt/xenapi/volumeops.py index 46606e2be..075ae705b 100644 --- a/nova/virt/xenapi/volumeops.py +++ b/nova/virt/xenapi/volumeops.py @@ -159,15 +159,20 @@ class VolumeOps(object): LOG.exception(exc) raise StorageError(_('Unable to introduce Storage Repository')) + vdi_uuid = None + target_lun = None if 'vdi_uuid' in data: vdi_uuid = data['vdi_uuid'] + elif 'target_lun' in data: + target_lun = data['target_lun'] else: vdi_uuid = None # Introduce VDI and attach VBD to VM try: vdi_ref = VolumeHelper.introduce_vdi(self._session, sr_ref, - vdi_uuid) + vdi_uuid, + target_lun) except StorageError, exc: LOG.exception(exc) self.forget_sr(uuid) |
