Unit tests fixes in nova and neutron
Patch 1: [General] Removed unused parameters from InstanceInfo Many of unused parameters were removed from nova.virt.hardware.InstanceInfo in Pike. Same was notified to OOT(Out of tree) drivers. References: [1] https://review.openstack.org/#/c/471146/6/nova/virt/hardware.py [2] http://lists.openstack.org/pipermail/openstack-dev/2017-June/117962.html Closes-Bug: #1717907 Patch 2: [General] Remove l3_db.subscribe calls from router plugins l3_db.subscribe has been deprecated from newton. Removing it was recently disabled from pike release. Refer bug description for more details. Closes-Bug: #1718180 Change-Id: Ied1868736c4edb9da839d6d4b49aa1d98cbef251
This commit is contained in:
parent
882ab1d8b1
commit
38f171bdea
neutron/neutron/services/l3_router
nova
@ -69,7 +69,6 @@ class AwsRouterPlugin(
|
||||
def __init__(self):
|
||||
self.aws_utils = AwsUtils()
|
||||
super(AwsRouterPlugin, self).__init__()
|
||||
l3_db.subscribe()
|
||||
|
||||
def get_plugin_type(self):
|
||||
return plugin_type
|
||||
|
@ -67,7 +67,6 @@ class AzureRouterPlugin(
|
||||
@resource_registry.tracked_resources(router=router, floatingip=floating_ip)
|
||||
def __init__(self):
|
||||
super(AzureRouterPlugin, self).__init__()
|
||||
l3_db.subscribe()
|
||||
self._compute_client = None
|
||||
self._network_client = None
|
||||
self.tenant_id = azure_conf.tenant_id
|
||||
|
@ -70,7 +70,6 @@ class GceRouterPlugin(
|
||||
floatingip=floating_ip)
|
||||
def __init__(self):
|
||||
super(GceRouterPlugin, self).__init__()
|
||||
l3_db.subscribe()
|
||||
self.gce_zone = gceconf.zone
|
||||
self.gce_region = gceconf.region
|
||||
self.gce_project = gceconf.project_id
|
||||
|
@ -535,7 +535,6 @@ class EC2DriverTestCase(test.NoDBTestCase):
|
||||
self._create_vm_in_aws_nova()
|
||||
vm_info = self.conn.get_info(self.instance)
|
||||
self.assertEqual(0, vm_info.state)
|
||||
self.assertEqual(self.instance.id, vm_info.id)
|
||||
self.reset()
|
||||
|
||||
@mock_ec2_deprecated
|
||||
|
@ -542,31 +542,11 @@ class AzureDriver(driver.ComputeDriver):
|
||||
return state
|
||||
|
||||
def get_info(self, instance):
|
||||
"""Get the current status of an instance, by name (not ID!)
|
||||
|
||||
:param instance: nova.objects.instance.Instance object
|
||||
Returns a dict containing:
|
||||
:state: the running state, one of the power_state codes
|
||||
:max_mem: (int) the maximum memory in KBytes allowed
|
||||
:mem: (int) the memory in KBytes used by the domain
|
||||
:num_cpu: (int) the number of virtual CPUs for the domain
|
||||
:cpu_time: (int) the CPU time used in nanoseconds
|
||||
"""
|
||||
|
||||
azure_name = self._get_omni_name_from_instance(instance)
|
||||
azure_instance = utils.get_instance(
|
||||
self.compute_client, drv_conf.resource_group, azure_name)
|
||||
state = self._get_power_state(azure_instance)
|
||||
flavor = self.flavor_info[instance.flavor.name]
|
||||
memory = flavor.memory_in_mb * 1024
|
||||
cpus = flavor.number_of_cores
|
||||
return hardware.InstanceInfo(
|
||||
state=state,
|
||||
max_mem_kb=memory,
|
||||
mem_kb=memory,
|
||||
num_cpu=cpus,
|
||||
cpu_time_ns=0,
|
||||
id=instance.id)
|
||||
return hardware.InstanceInfo(state=state)
|
||||
|
||||
def allow_key(self, key):
|
||||
DIAGNOSTIC_KEYS_TO_FILTER = ['group', 'block_device_mapping']
|
||||
|
@ -707,17 +707,6 @@ class EC2Driver(driver.ComputeDriver):
|
||||
raise exception.InterfaceDetachFailed('not attached')
|
||||
|
||||
def get_info(self, instance):
|
||||
"""Get the current status of an instance, by name (not ID!)
|
||||
|
||||
:param instance: nova.objects.instance.Instance object
|
||||
Returns a dict containing:
|
||||
:state: the running state, one of the power_state codes
|
||||
:max_mem: (int) the maximum memory in KBytes allowed
|
||||
:mem: (int) the memory in KBytes used by the domain
|
||||
:num_cpu: (int) the number of virtual CPUs for the domain
|
||||
:cpu_time: (int) the CPU time used in nanoseconds
|
||||
"""
|
||||
|
||||
if instance.uuid in self._uuid_to_ec2_instance:
|
||||
ec2_instance = self._uuid_to_ec2_instance[instance.uuid]
|
||||
elif 'metadata' in instance and 'ec2_id' in instance['metadata']:
|
||||
@ -734,13 +723,7 @@ class EC2Driver(driver.ComputeDriver):
|
||||
raise exception.InstanceNotFound(instance_id=instance['name'])
|
||||
|
||||
power_state = EC2_STATE_MAP.get(ec2_instance.state)
|
||||
ec2_flavor = self.ec2_flavor_info.get(ec2_instance.instance_type)
|
||||
memory_mb = ec2_flavor['memory_mb']
|
||||
vcpus = ec2_flavor['vcpus']
|
||||
|
||||
return hardware.InstanceInfo(state=power_state, max_mem_kb=memory_mb,
|
||||
mem_kb=memory_mb, num_cpu=vcpus,
|
||||
cpu_time_ns=0, id=instance.id)
|
||||
return hardware.InstanceInfo(state=power_state)
|
||||
|
||||
def allow_key(self, key):
|
||||
for key_to_filter in DIAGNOSTIC_KEYS_TO_FILTER:
|
||||
|
@ -641,29 +641,11 @@ class GCEDriver(driver.ComputeDriver):
|
||||
raise NotImplementedError()
|
||||
|
||||
def get_info(self, instance):
|
||||
"""Get the current status of an instance, by name (not ID!)
|
||||
|
||||
:param instance: nova.objects.instance.Instance object
|
||||
Returns a dict containing:
|
||||
:state: the running state, one of the power_state codes
|
||||
:max_mem: (int) the maximum memory in KBytes allowed
|
||||
:mem: (int) the memory in KBytes used by the domain
|
||||
:num_cpu: (int) the number of virtual CPUs for the domain
|
||||
:cpu_time: (int) the CPU time used in nanoseconds
|
||||
"""
|
||||
compute, project, zone = self.gce_svc, self.gce_project, self.gce_zone
|
||||
gce_id = self._get_gce_id_from_instance(instance)
|
||||
gce_instance = gceutils.get_instance(compute, project, zone, gce_id)
|
||||
power_state = GCE_STATE_MAP[gce_instance['status']]
|
||||
|
||||
gce_flavor = self.gce_flavor_info[instance.flavor.name]
|
||||
memory_mb = gce_flavor['memory_mb']
|
||||
vcpus = gce_flavor['vcpus']
|
||||
|
||||
return hardware.InstanceInfo(state=power_state,
|
||||
max_mem_kb=memory_mb * 1024,
|
||||
mem_kb=memory_mb * 1024, num_cpu=vcpus,
|
||||
cpu_time_ns=0, id=instance.id)
|
||||
return hardware.InstanceInfo(state=power_state)
|
||||
|
||||
def allow_key(self, key):
|
||||
if key in DIAGNOSTIC_KEYS_TO_FILTER:
|
||||
|
Loading…
x
Reference in New Issue
Block a user