diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-05-02 23:00:29 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-05-02 23:00:29 +0000 |
| commit | 4db018636dcc2c083f5dc92a7dd993766337c86c (patch) | |
| tree | ae3e8197ce150af71c69be6500cd94e0860f73e4 /nova/virt | |
| parent | fba02baf8dbf6d3d9a7ed58a498670157004bce5 (diff) | |
| parent | d14ac4bf38f23e429572f210f7b0560493968b15 (diff) | |
Merge "Adding 'host' info to volume-compute connection information."
Diffstat (limited to 'nova/virt')
| -rw-r--r-- | nova/virt/driver.py | 5 | ||||
| -rw-r--r-- | nova/virt/fake.py | 2 | ||||
| -rw-r--r-- | nova/virt/libvirt/connection.py | 1 | ||||
| -rw-r--r-- | nova/virt/vmwareapi_conn.py | 5 | ||||
| -rw-r--r-- | nova/virt/xenapi/connection.py | 11 |
5 files changed, 15 insertions, 9 deletions
diff --git a/nova/virt/driver.py b/nova/virt/driver.py index db004de80..68cbea340 100644 --- a/nova/virt/driver.py +++ b/nova/virt/driver.py @@ -676,12 +676,13 @@ class ComputeDriver(object): """Get connector information for the instance for attaching to volumes. Connector information is a dictionary representing the ip of the - machine that will be making the connection and and the name of the - iscsi initiator as follows:: + machine that will be making the connection, the name of the iscsi + initiator and the hostname of the machine as follows:: { 'ip': ip, 'initiator': initiator, + 'host': hostname } """ raise NotImplementedError() diff --git a/nova/virt/fake.py b/nova/virt/fake.py index 3b0dbfd4c..b08c7661d 100644 --- a/nova/virt/fake.py +++ b/nova/virt/fake.py @@ -335,4 +335,4 @@ class FakeConnection(driver.ComputeDriver): pass def get_volume_connector(self, instance): - return {'ip': '127.0.0.1', 'initiator': 'fake'} + return {'ip': '127.0.0.1', 'initiator': 'fake', 'host': 'fakehost'} diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py index 6d97ce170..4f7a15a86 100644 --- a/nova/virt/libvirt/connection.py +++ b/nova/virt/libvirt/connection.py @@ -489,6 +489,7 @@ class LibvirtConnection(driver.ComputeDriver): return { 'ip': FLAGS.my_ip, 'initiator': self._initiator, + 'host': FLAGS.host } def _cleanup_resize(self, instance): diff --git a/nova/virt/vmwareapi_conn.py b/nova/virt/vmwareapi_conn.py index 444fc785a..a5f771eee 100644 --- a/nova/virt/vmwareapi_conn.py +++ b/nova/virt/vmwareapi_conn.py @@ -177,10 +177,11 @@ class VMWareESXConnection(driver.ComputeDriver): def get_volume_connector(self, _instance): """Return volume connector information""" # TODO(vish): When volume attaching is supported, return the - # proper initiator iqn. + # proper initiator iqn and host. return { 'ip': FLAGS.vmwareapi_host_ip, - 'initiator': None + 'initiator': None, + 'host': None } def attach_volume(self, connection_info, instance_name, mountpoint): diff --git a/nova/virt/xenapi/connection.py b/nova/virt/xenapi/connection.py index 2fa5516d3..c02f3581d 100644 --- a/nova/virt/xenapi/connection.py +++ b/nova/virt/xenapi/connection.py @@ -156,6 +156,7 @@ class XenAPIConnection(driver.ComputeDriver): self._host = host.Host(self._session) self._vmops = vmops.VMOps(self._session) self._initiator = None + self._hypervisor_hostname = None self._pool = pool.ResourcePool(self._session) @property @@ -336,17 +337,19 @@ class XenAPIConnection(driver.ComputeDriver): def get_volume_connector(self, instance): """Return volume connector information""" - if not self._initiator: + if not self._initiator or not self._hypervisor_hostname: stats = self.get_host_stats(refresh=True) try: self._initiator = stats['host_other-config']['iscsi_iqn'] - except (TypeError, KeyError): - LOG.warn(_('Could not determine iscsi initiator name'), + self._hypervisor_hostname = stats['host_hostname'] + except (TypeError, KeyError) as err: + LOG.warn(_('Could not determine key: %s') % err, instance=instance) self._initiator = None return { 'ip': self.get_host_ip_addr(), - 'initiator': self._initiator + 'initiator': self._initiator, + 'host': self._hypervisor_hostname } @staticmethod |
