Make ComputeDrivers send hypervisor_hostname
hypervisor_hostname is set in get_available_resource() and in get_host_stats(). Except for vmwareapi driver. Change-Id: I66348ae1e986162b8139b04ab03c42c424338175
This commit is contained in:
parent
d8d00ef308
commit
c918ff377f
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"server": {
|
"server": {
|
||||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": null,
|
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||||
"OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
|
"OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
|
||||||
"accessIPv4": "",
|
"accessIPv4": "",
|
||||||
"accessIPv6": "",
|
"accessIPv6": "",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<server xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="%(timestamp)s" hostId="%(hostid)s" name="new-server-test" created="%(timestamp)s" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="%(id)s" OS-EXT-SRV-ATTR:instance_name="%(instance_name)s" OS-EXT-SRV-ATTR:host="%(compute_host)s" OS-EXT-SRV-ATTR:hypervisor_hostname="None">
|
<server xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="%(timestamp)s" hostId="%(hostid)s" name="new-server-test" created="%(timestamp)s" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="%(id)s" OS-EXT-SRV-ATTR:instance_name="%(instance_name)s" OS-EXT-SRV-ATTR:host="%(compute_host)s" OS-EXT-SRV-ATTR:hypervisor_hostname="%(hypervisor_hostname)s">
|
||||||
<image id="%(uuid)s">
|
<image id="%(uuid)s">
|
||||||
<atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/>
|
<atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/>
|
||||||
</image>
|
</image>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"servers": [
|
"servers": [
|
||||||
{
|
{
|
||||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": null,
|
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||||
"OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
|
"OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
|
||||||
"accessIPv4": "",
|
"accessIPv4": "",
|
||||||
"accessIPv6": "",
|
"accessIPv6": "",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<servers xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
|
<servers xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
|
||||||
<server xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="%(timestamp)s" hostId="%(hostid)s" name="new-server-test" created="%(timestamp)s" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="%(id)s" OS-EXT-SRV-ATTR:instance_name="%(instance_name)s" OS-EXT-SRV-ATTR:host="%(compute_host)s" OS-EXT-SRV-ATTR:hypervisor_hostname="None">
|
<server xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="%(timestamp)s" hostId="%(hostid)s" name="new-server-test" created="%(timestamp)s" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="%(id)s" OS-EXT-SRV-ATTR:instance_name="%(instance_name)s" OS-EXT-SRV-ATTR:host="%(compute_host)s" OS-EXT-SRV-ATTR:hypervisor_hostname="%(hypervisor_hostname)s">
|
||||||
<image id="%(uuid)s">
|
<image id="%(uuid)s">
|
||||||
<atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/>
|
<atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/>
|
||||||
</image>
|
</image>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"server": {
|
"server": {
|
||||||
"OS-DCF:diskConfig": "AUTO",
|
"OS-DCF:diskConfig": "AUTO",
|
||||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": null,
|
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||||
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
|
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
|
||||||
"OS-EXT-STS:power_state": 1,
|
"OS-EXT-STS:power_state": 1,
|
||||||
"OS-EXT-STS:task_state": null,
|
"OS-EXT-STS:task_state": null,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<server xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-STS="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="%(timestamp)s" hostId="%(hostid)s" name="new-server-test" created="%(timestamp)s" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="%(id)s" key_name="None" config_drive="" OS-EXT-SRV-ATTR:vm_state="active" OS-EXT-SRV-ATTR:task_state="None" OS-EXT-SRV-ATTR:power_state="1" OS-EXT-SRV-ATTR:instance_name="instance-00000001" OS-EXT-SRV-ATTR:host="%(compute_host)s" OS-EXT-SRV-ATTR:hypervisor_hostname="None" OS-DCF:diskConfig="AUTO">
|
<server xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-STS="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="%(timestamp)s" hostId="%(hostid)s" name="new-server-test" created="%(timestamp)s" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="%(id)s" key_name="None" config_drive="" OS-EXT-SRV-ATTR:vm_state="active" OS-EXT-SRV-ATTR:task_state="None" OS-EXT-SRV-ATTR:power_state="1" OS-EXT-SRV-ATTR:instance_name="instance-00000001" OS-EXT-SRV-ATTR:host="%(compute_host)s" OS-EXT-SRV-ATTR:hypervisor_hostname="%(hypervisor_hostname)s" OS-DCF:diskConfig="AUTO">
|
||||||
<image id="%(uuid)s">
|
<image id="%(uuid)s">
|
||||||
<atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/>
|
<atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/>
|
||||||
</image>
|
</image>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
{
|
{
|
||||||
"OS-DCF:diskConfig": "AUTO",
|
"OS-DCF:diskConfig": "AUTO",
|
||||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": null,
|
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||||
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
|
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
|
||||||
"OS-EXT-STS:power_state": 1,
|
"OS-EXT-STS:power_state": 1,
|
||||||
"OS-EXT-STS:task_state": null,
|
"OS-EXT-STS:task_state": null,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<servers xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-STS="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
|
<servers xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-STS="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
|
||||||
<server xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-STS="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="%(timestamp)s" hostId="%(hostid)s" name="new-server-test" created="%(timestamp)s" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="%(id)s" key_name="None" config_drive="" OS-EXT-SRV-ATTR:vm_state="active" OS-EXT-SRV-ATTR:task_state="None" OS-EXT-SRV-ATTR:power_state="1" OS-EXT-SRV-ATTR:instance_name="instance-00000001" OS-EXT-SRV-ATTR:host="%(compute_host)s" OS-EXT-SRV-ATTR:hypervisor_hostname="None" OS-DCF:diskConfig="AUTO">
|
<server xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-STS="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="%(timestamp)s" hostId="%(hostid)s" name="new-server-test" created="%(timestamp)s" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="%(id)s" key_name="None" config_drive="" OS-EXT-SRV-ATTR:vm_state="active" OS-EXT-SRV-ATTR:task_state="None" OS-EXT-SRV-ATTR:power_state="1" OS-EXT-SRV-ATTR:instance_name="instance-00000001" OS-EXT-SRV-ATTR:host="%(compute_host)s" OS-EXT-SRV-ATTR:hypervisor_hostname="%(hypervisor_hostname)s" OS-DCF:diskConfig="AUTO">
|
||||||
<image id="%(uuid)s">
|
<image id="%(uuid)s">
|
||||||
<atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/>
|
<atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/>
|
||||||
</image>
|
</image>
|
||||||
|
|
|
@ -303,6 +303,7 @@ class ServersSampleJsonTest(ServersSampleBase):
|
||||||
subs = self._get_regexes()
|
subs = self._get_regexes()
|
||||||
subs['hostid'] = '[a-f0-9]+'
|
subs['hostid'] = '[a-f0-9]+'
|
||||||
subs['id'] = uuid
|
subs['id'] = uuid
|
||||||
|
subs['hypervisor_hostname'] = r'[\w\.\-]+'
|
||||||
return self._verify_response('server-get-resp', subs, response)
|
return self._verify_response('server-get-resp', subs, response)
|
||||||
|
|
||||||
def test_servers_list(self):
|
def test_servers_list(self):
|
||||||
|
@ -320,6 +321,7 @@ class ServersSampleJsonTest(ServersSampleBase):
|
||||||
subs = self._get_regexes()
|
subs = self._get_regexes()
|
||||||
subs['hostid'] = '[a-f0-9]+'
|
subs['hostid'] = '[a-f0-9]+'
|
||||||
subs['id'] = uuid
|
subs['id'] = uuid
|
||||||
|
subs['hypervisor_hostname'] = r'[\w\.\-]+'
|
||||||
return self._verify_response('servers-details-resp', subs, response)
|
return self._verify_response('servers-details-resp', subs, response)
|
||||||
|
|
||||||
|
|
||||||
|
@ -804,6 +806,7 @@ class ExtendedServerAttributesJsonTest(ServersSampleBase):
|
||||||
subs['hostid'] = '[a-f0-9]+'
|
subs['hostid'] = '[a-f0-9]+'
|
||||||
subs['id'] = uuid
|
subs['id'] = uuid
|
||||||
subs['instance_name'] = 'instance-\d{8}'
|
subs['instance_name'] = 'instance-\d{8}'
|
||||||
|
subs['hypervisor_hostname'] = r'[\w\.\-]+'
|
||||||
return self._verify_response('extended-server-attrs-get',
|
return self._verify_response('extended-server-attrs-get',
|
||||||
subs, response)
|
subs, response)
|
||||||
|
|
||||||
|
@ -815,6 +818,7 @@ class ExtendedServerAttributesJsonTest(ServersSampleBase):
|
||||||
subs['hostid'] = '[a-f0-9]+'
|
subs['hostid'] = '[a-f0-9]+'
|
||||||
subs['id'] = uuid
|
subs['id'] = uuid
|
||||||
subs['instance_name'] = 'instance-\d{8}'
|
subs['instance_name'] = 'instance-\d{8}'
|
||||||
|
subs['hypervisor_hostname'] = r'[\w\.\-]+'
|
||||||
return self._verify_response('extended-server-attrs-list',
|
return self._verify_response('extended-server-attrs-list',
|
||||||
subs, response)
|
subs, response)
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,9 @@ class FakeIVMOperator(object):
|
||||||
'disk_used': 0,
|
'disk_used': 0,
|
||||||
'disk_avail': 10168}
|
'disk_avail': 10168}
|
||||||
|
|
||||||
|
def get_hostname(self):
|
||||||
|
return 'fake-powervm'
|
||||||
|
|
||||||
|
|
||||||
def fake_get_powervm_operator():
|
def fake_get_powervm_operator():
|
||||||
return FakeIVMOperator()
|
return FakeIVMOperator()
|
||||||
|
|
|
@ -676,6 +676,7 @@ class BareMetalDriver(driver.ComputeDriver):
|
||||||
'local_gb_used': self.get_local_gb_used(),
|
'local_gb_used': self.get_local_gb_used(),
|
||||||
'hypervisor_type': self.get_hypervisor_type(),
|
'hypervisor_type': self.get_hypervisor_type(),
|
||||||
'hypervisor_version': self.get_hypervisor_version(),
|
'hypervisor_version': self.get_hypervisor_version(),
|
||||||
|
'hypervisor_hostname': FLAGS.host,
|
||||||
'cpu_info': self.get_cpu_info(),
|
'cpu_info': self.get_cpu_info(),
|
||||||
'cpu_arch': FLAGS.cpu_arch}
|
'cpu_arch': FLAGS.cpu_arch}
|
||||||
|
|
||||||
|
@ -737,4 +738,5 @@ class HostState(object):
|
||||||
self.connection.get_memory_mb_used())
|
self.connection.get_memory_mb_used())
|
||||||
data["hypervisor_type"] = self.connection.get_hypervisor_type()
|
data["hypervisor_type"] = self.connection.get_hypervisor_type()
|
||||||
data["hypervisor_version"] = self.connection.get_hypervisor_version()
|
data["hypervisor_version"] = self.connection.get_hypervisor_version()
|
||||||
|
data["hypervisor_hostname"] = FLAGS.host
|
||||||
self._stats = data
|
self._stats = data
|
||||||
|
|
|
@ -70,7 +70,9 @@ class FakeDriver(driver.ComputeDriver):
|
||||||
'disk_total': 600000000000,
|
'disk_total': 600000000000,
|
||||||
'disk_used': 100000000000,
|
'disk_used': 100000000000,
|
||||||
'host_uuid': 'cedb9b39-9388-41df-8891-c5c9a0c0fe5f',
|
'host_uuid': 'cedb9b39-9388-41df-8891-c5c9a0c0fe5f',
|
||||||
'host_name_label': 'fake-mini'}
|
'host_name_label': 'fake-mini',
|
||||||
|
'hypervisor_hostname': 'fake-mini',
|
||||||
|
}
|
||||||
self._mounts = {}
|
self._mounts = {}
|
||||||
|
|
||||||
def init_host(self, host):
|
def init_host(self, host):
|
||||||
|
@ -265,6 +267,7 @@ class FakeDriver(driver.ComputeDriver):
|
||||||
'local_gb_used': 0,
|
'local_gb_used': 0,
|
||||||
'hypervisor_type': 'fake',
|
'hypervisor_type': 'fake',
|
||||||
'hypervisor_version': '1.0',
|
'hypervisor_version': '1.0',
|
||||||
|
'hypervisor_hostname': 'fake-mini',
|
||||||
'cpu_info': '?'}
|
'cpu_info': '?'}
|
||||||
return dic
|
return dic
|
||||||
|
|
||||||
|
|
|
@ -152,6 +152,7 @@ class HostOps(baseops.BaseOps):
|
||||||
data["supported_instances"] = \
|
data["supported_instances"] = \
|
||||||
[('i686', 'hyperv', 'hvm'),
|
[('i686', 'hyperv', 'hvm'),
|
||||||
('x86_64', 'hyperv', 'hvm')]
|
('x86_64', 'hyperv', 'hvm')]
|
||||||
|
data["hypervisor_hostname"] = platform.node()
|
||||||
|
|
||||||
self._stats = data
|
self._stats = data
|
||||||
|
|
||||||
|
|
|
@ -156,6 +156,7 @@ class PowerVMOperator(object):
|
||||||
data['host_memory_free'] = memory_info['avail_mem']
|
data['host_memory_free'] = memory_info['avail_mem']
|
||||||
data['hypervisor_type'] = constants.POWERVM_HYPERVISOR_TYPE
|
data['hypervisor_type'] = constants.POWERVM_HYPERVISOR_TYPE
|
||||||
data['hypervisor_version'] = constants.POWERVM_HYPERVISOR_VERSION
|
data['hypervisor_version'] = constants.POWERVM_HYPERVISOR_VERSION
|
||||||
|
data['hypervisor_hostname'] = self._operator.get_hostname()
|
||||||
data['extres'] = ''
|
data['extres'] = ''
|
||||||
|
|
||||||
self._host_stats = data
|
self._host_stats = data
|
||||||
|
|
|
@ -583,7 +583,9 @@ class SessionBase(object):
|
||||||
return jsonutils.dumps({'host_memory': {'total': 10,
|
return jsonutils.dumps({'host_memory': {'total': 10,
|
||||||
'overhead': 20,
|
'overhead': 20,
|
||||||
'free': 30,
|
'free': 30,
|
||||||
'free-computed': 40}})
|
'free-computed': 40},
|
||||||
|
'host_hostname': 'fake-xenhost',
|
||||||
|
})
|
||||||
|
|
||||||
def _plugin_poweraction(self, method, args):
|
def _plugin_poweraction(self, method, args):
|
||||||
return jsonutils.dumps({"power_action": method[5:]})
|
return jsonutils.dumps({"power_action": method[5:]})
|
||||||
|
|
|
@ -174,6 +174,7 @@ class HostState(object):
|
||||||
data["host_memory_free_computed"] = host_memory.get(
|
data["host_memory_free_computed"] = host_memory.get(
|
||||||
'free-computed', 0)
|
'free-computed', 0)
|
||||||
del data['host_memory']
|
del data['host_memory']
|
||||||
|
data['hypervisor_hostname'] = data['host_hostname']
|
||||||
self._stats = data
|
self._stats = data
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue