Merge "[3/3]Replace six.iteritems() with .items()"
This commit is contained in:
commit
d4e70a4275
@ -30,7 +30,6 @@ from oslo_config import cfg
|
||||
from oslo_db.sqlalchemy import enginefacade
|
||||
import oslo_messaging as messaging
|
||||
from oslo_messaging import conffixture as messaging_conffixture
|
||||
import six
|
||||
|
||||
from nova.api.openstack.placement import deploy as placement_deploy
|
||||
from nova.compute import rpcapi as compute_rpcapi
|
||||
@ -657,7 +656,7 @@ class ConfPatcher(fixtures.Fixture):
|
||||
|
||||
def setUp(self):
|
||||
super(ConfPatcher, self).setUp()
|
||||
for k, v in six.iteritems(self.args):
|
||||
for k, v in self.args.items():
|
||||
self.addCleanup(CONF.clear_override, k, self.group)
|
||||
CONF.set_override(k, v, self.group)
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
import requests
|
||||
import six
|
||||
from six.moves.urllib import parse
|
||||
|
||||
|
||||
@ -255,7 +254,7 @@ class TestOpenStackClient(object):
|
||||
|
||||
if search_opts is not None:
|
||||
qparams = {}
|
||||
for opt, val in six.iteritems(search_opts):
|
||||
for opt, val in search_opts.items():
|
||||
qparams[opt] = val
|
||||
if qparams:
|
||||
query_string = "?%s" % parse.urlencode(qparams)
|
||||
|
@ -14,8 +14,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
|
||||
import testscenarios
|
||||
|
||||
from nova import context
|
||||
@ -112,7 +110,7 @@ class FlavorManageFullstack(testscenarios.WithScenarios, test.TestCase):
|
||||
'id': 'flavorid',
|
||||
'swap': 'swap'
|
||||
}
|
||||
for k, v in six.iteritems(mapping):
|
||||
for k, v in mapping.items():
|
||||
if k in flav:
|
||||
self.assertEqual(flav[k], flavdb[v],
|
||||
"%s != %s" % (flav, flavdb))
|
||||
@ -120,7 +118,7 @@ class FlavorManageFullstack(testscenarios.WithScenarios, test.TestCase):
|
||||
def assertFlavorAPIEqual(self, flav, flavapi):
|
||||
# for all keys in the flavor, ensure they are correctly set in
|
||||
# flavapi response.
|
||||
for k, v in six.iteritems(flav):
|
||||
for k in flav:
|
||||
if k in flavapi:
|
||||
self.assertEqual(flav[k], flavapi[k],
|
||||
"%s != %s" % (flav, flavapi))
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import encodeutils
|
||||
import six
|
||||
import webob.dec
|
||||
import webob.exc
|
||||
|
||||
@ -142,7 +141,7 @@ class APITest(test.NoDBTestCase):
|
||||
self.assertEqual(resp.status_int, exception_type.code, resp.text)
|
||||
|
||||
if hasattr(exception_type, 'headers'):
|
||||
for (key, value) in six.iteritems(exception_type.headers):
|
||||
for (key, value) in exception_type.headers.items():
|
||||
self.assertIn(key, resp.headers)
|
||||
self.assertEqual(resp.headers[key], str(value))
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
import datetime
|
||||
|
||||
import mock
|
||||
import six
|
||||
from webob import exc
|
||||
|
||||
from nova.api.openstack import api_version_request as api_version
|
||||
@ -90,7 +89,7 @@ def fake_get_all_flavors_sorted_list(context, inactive=False,
|
||||
return sorted(INSTANCE_TYPES.values(), key=lambda item: item[sort_key])
|
||||
|
||||
res = {}
|
||||
for k, v in six.iteritems(INSTANCE_TYPES):
|
||||
for k, v in INSTANCE_TYPES.items():
|
||||
if filters['is_public'] and _has_flavor_access(k, context.project_id):
|
||||
res.update({k: v})
|
||||
continue
|
||||
|
@ -14,7 +14,6 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
import six
|
||||
|
||||
from nova.api.openstack import api_version_request
|
||||
from nova.api.openstack.compute import used_limits \
|
||||
@ -71,7 +70,7 @@ class UsedLimitsTestCaseV21(test.NoDBTestCase):
|
||||
}
|
||||
limits = {}
|
||||
expected_abs_limits = []
|
||||
for display_name, q in six.iteritems(quota_map):
|
||||
for display_name, q in quota_map.items():
|
||||
limits[q] = {'limit': len(display_name),
|
||||
'in_use': len(display_name) / 2,
|
||||
'reserved': len(display_name) / 3}
|
||||
|
@ -231,7 +231,7 @@ class FakeToken(object):
|
||||
def __init__(self, **kwargs):
|
||||
FakeToken.id_count += 1
|
||||
self.id = FakeToken.id_count
|
||||
for k, v in six.iteritems(kwargs):
|
||||
for k, v in kwargs.items():
|
||||
setattr(self, k, v)
|
||||
|
||||
|
||||
|
@ -35,7 +35,6 @@ from oslo_utils import fixture as utils_fixture
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import units
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
import testtools
|
||||
from testtools import matchers as testtools_matchers
|
||||
|
||||
@ -118,7 +117,7 @@ def unify_instance(instance):
|
||||
model-initiated sources that can reasonably be compared.
|
||||
"""
|
||||
newdict = dict()
|
||||
for k, v in six.iteritems(instance):
|
||||
for k, v in instance.items():
|
||||
if isinstance(v, datetime.datetime):
|
||||
# NOTE(danms): DB models and Instance objects have different
|
||||
# timezone expectations
|
||||
@ -6907,7 +6906,7 @@ class ComputeTestCase(BaseTestCase):
|
||||
|
||||
self.compute._poll_unconfirmed_resizes(ctxt)
|
||||
|
||||
for instance_uuid, status in six.iteritems(expected_migration_status):
|
||||
for instance_uuid, status in expected_migration_status.items():
|
||||
self.assertEqual(status,
|
||||
fetch_instance_migration_status(instance_uuid))
|
||||
|
||||
@ -7991,7 +7990,7 @@ class ComputeAPITestCase(BaseTestCase):
|
||||
image_props = {'image_kernel_id': uuids.kernel_id,
|
||||
'image_ramdisk_id': uuids.ramdisk_id,
|
||||
'image_something_else': 'meow', }
|
||||
for key, value in six.iteritems(image_props):
|
||||
for key, value in image_props.items():
|
||||
self.assertIn(key, instance.system_metadata)
|
||||
self.assertEqual(value, instance.system_metadata[key])
|
||||
|
||||
|
@ -24,7 +24,6 @@ import oslo_messaging as messaging
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
|
||||
import nova
|
||||
from nova.compute import build_results
|
||||
@ -109,7 +108,7 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase):
|
||||
power_state.SUSPENDED,
|
||||
}
|
||||
|
||||
for transition, pwr_state in six.iteritems(event_map):
|
||||
for transition, pwr_state in event_map.items():
|
||||
self._test_handle_lifecycle_event(transition=transition,
|
||||
event_pwr_state=pwr_state,
|
||||
current_pwr_state=pwr_state)
|
||||
|
@ -18,7 +18,6 @@ Unit Tests for nova.consoleauth.rpcapi
|
||||
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
import six
|
||||
|
||||
from nova.consoleauth import rpcapi as consoleauth_rpcapi
|
||||
from nova import context
|
||||
@ -42,7 +41,7 @@ class ConsoleAuthRpcAPITestCase(test.NoDBTestCase):
|
||||
orig_prepare = rpcapi.client.prepare
|
||||
|
||||
version = kwargs.pop('version', None)
|
||||
rpc_kwargs = {k: v for k, v in six.iteritems(kwargs)
|
||||
rpc_kwargs = {k: v for k, v in kwargs.items()
|
||||
if v is not self.DROPPED_ARG}
|
||||
|
||||
with test.nested(
|
||||
|
@ -19,8 +19,6 @@
|
||||
import copy
|
||||
import datetime
|
||||
|
||||
import six
|
||||
|
||||
from nova import exception
|
||||
|
||||
|
||||
@ -439,7 +437,7 @@ def stub_out_db_instance_api(test, injected=True):
|
||||
|
||||
@classmethod
|
||||
def fake_flavor_get(cls, context, id):
|
||||
for name, inst_type in six.iteritems(INSTANCE_TYPES):
|
||||
for inst_type in INSTANCE_TYPES.values():
|
||||
if str(inst_type['id']) == str(id):
|
||||
return inst_type
|
||||
return None
|
||||
|
@ -8219,7 +8219,7 @@ class ComputeNodeTestCase(test.TestCase, ModelsObjectComparatorMixin):
|
||||
'local_gb': 2048,
|
||||
'free_ram_mb': 1024,
|
||||
'memory_mb_used': 0}
|
||||
for key, value in six.iteritems(data):
|
||||
for key, value in data.items():
|
||||
self.assertEqual(value, stats.pop(key))
|
||||
|
||||
def test_compute_node_not_found(self):
|
||||
|
@ -24,7 +24,6 @@ library to work with nova.
|
||||
import fnmatch
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
from six.moves import range
|
||||
|
||||
|
||||
@ -313,11 +312,11 @@ class FakeLDAP(object):
|
||||
# get the attributes from the store
|
||||
attrs = store.hgetall(key)
|
||||
# turn the values from the store into lists
|
||||
attrs = {k: _from_json(v) for k, v in six.iteritems(attrs)}
|
||||
attrs = {k: _from_json(v) for k, v in attrs.items()}
|
||||
# filter the objects by query
|
||||
if not query or _match_query(query, attrs):
|
||||
# filter the attributes by fields
|
||||
attrs = {k: v for k, v in six.iteritems(attrs)
|
||||
attrs = {k: v for k, v in attrs.items()
|
||||
if not fields or k in fields}
|
||||
objects.append((key[len(self.__prefix):], attrs))
|
||||
return objects
|
||||
|
@ -1990,7 +1990,7 @@ class VlanNetworkTestCase(test.TestCase):
|
||||
|
||||
class _TestDomainObject(object):
|
||||
def __init__(self, **kwargs):
|
||||
for k, v in six.iteritems(kwargs):
|
||||
for k, v in kwargs.items():
|
||||
self.__setattr__(k, v)
|
||||
|
||||
|
||||
|
@ -76,7 +76,7 @@ class MyComparator(mox.Comparator):
|
||||
def _com_dict(self, lhs, rhs):
|
||||
if len(lhs) != len(rhs):
|
||||
return False
|
||||
for key, value in six.iteritems(lhs):
|
||||
for key, value in lhs.items():
|
||||
if key not in rhs:
|
||||
return False
|
||||
rhs_value = rhs[key]
|
||||
|
@ -13,7 +13,6 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
import six
|
||||
|
||||
from nova.cells import rpcapi as cells_rpcapi
|
||||
from nova import context
|
||||
@ -289,7 +288,7 @@ class _TestBlockDeviceMappingObject(object):
|
||||
'bdm_update_or_create_at_top'):
|
||||
bdm.create()
|
||||
|
||||
for k, v in six.iteritems(values):
|
||||
for k, v in values.items():
|
||||
self.assertEqual(v, getattr(bdm, k))
|
||||
|
||||
def test_create_fails(self):
|
||||
|
@ -1011,7 +1011,7 @@ class TestArgsSerializer(test.NoDBTestCase):
|
||||
|
||||
expected_kwargs = {'a': 'untouched', 'b': self.str_now,
|
||||
'c': self.str_now, 'exc_val': self.unicode_str}
|
||||
for key, val in six.iteritems(kwargs):
|
||||
for key, val in kwargs.items():
|
||||
self.assertEqual(expected_kwargs[key], val)
|
||||
|
||||
def test_serialize_args(self):
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
import six
|
||||
|
||||
from nova import exception
|
||||
from nova import objects
|
||||
@ -266,7 +265,7 @@ class PciDeviceStatsWithTagsTestCase(test.NoDBTestCase):
|
||||
self.assertEqual(product_id, pool['product_id'])
|
||||
self.assertEqual(count, pool['count'])
|
||||
if tags:
|
||||
for k, v in six.iteritems(tags):
|
||||
for k, v in tags.items():
|
||||
self.assertEqual(v, pool[k])
|
||||
|
||||
def _assertPools(self):
|
||||
|
@ -17,7 +17,6 @@ import os
|
||||
import fixtures
|
||||
from oslo_policy import policy as oslo_policy
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
from nova.conf import paths
|
||||
@ -124,7 +123,7 @@ class RoleBasedPolicyFixture(RealPolicyFixture):
|
||||
self.add_missing_default_rules(policy)
|
||||
|
||||
# Convert all actions to require specified role
|
||||
for action, rule in six.iteritems(policy):
|
||||
for action in policy:
|
||||
policy[action] = 'role:%s' % self.role
|
||||
|
||||
self.policy_dir = self.useFixture(fixtures.TempDir())
|
||||
|
@ -17,7 +17,6 @@ Fakes For Scheduler tests.
|
||||
"""
|
||||
|
||||
import datetime
|
||||
import six
|
||||
|
||||
from nova import objects
|
||||
from nova.scheduler import driver
|
||||
@ -162,7 +161,7 @@ class FakeHostState(host_manager.HostState):
|
||||
self.instances = {inst.uuid: inst for inst in instances}
|
||||
else:
|
||||
self.instances = {}
|
||||
for (key, val) in six.iteritems(attribute_dict):
|
||||
for (key, val) in attribute_dict.items():
|
||||
setattr(self, key, val)
|
||||
|
||||
|
||||
|
@ -35,7 +35,6 @@ from oslo_config import cfg
|
||||
from oslo_serialization import base64
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import encodeutils
|
||||
import six
|
||||
import webob
|
||||
|
||||
from nova.api.metadata import base
|
||||
@ -726,7 +725,7 @@ class OpenStackMetadataTestCase(test.TestCase):
|
||||
mdjson = mdinst.lookup("/openstack/2012-08-10/meta_data.json")
|
||||
mddict = jsonutils.loads(mdjson)
|
||||
|
||||
for key, val in six.iteritems(extra):
|
||||
for key, val in extra.items():
|
||||
self.assertEqual(mddict[key], val)
|
||||
|
||||
def test_password(self):
|
||||
|
@ -1054,7 +1054,7 @@ class GetSystemMetadataFromImageTestCase(test.NoDBTestCase):
|
||||
sys_meta = utils.get_system_metadata_from_image(image)
|
||||
|
||||
# Verify that we inherit all the image properties
|
||||
for key, expected in six.iteritems(image["properties"]):
|
||||
for key, expected in image["properties"].items():
|
||||
sys_key = "%s%s" % (utils.SM_IMAGE_PROP_PREFIX, key)
|
||||
self.assertEqual(sys_meta[sys_key], expected)
|
||||
|
||||
@ -1068,7 +1068,7 @@ class GetSystemMetadataFromImageTestCase(test.NoDBTestCase):
|
||||
sys_meta = utils.get_system_metadata_from_image(image)
|
||||
|
||||
# Verify that we inherit all the image properties
|
||||
for key, expected in six.iteritems(image["properties"]):
|
||||
for key, expected in image["properties"].items():
|
||||
sys_key = "%s%s" % (utils.SM_IMAGE_PROP_PREFIX, key)
|
||||
|
||||
if key in utils.SM_SKIP_KEYS:
|
||||
@ -1131,7 +1131,7 @@ class GetImageFromSystemMetadataTestCase(test.NoDBTestCase):
|
||||
# Verify that we inherit the rest of metadata as properties
|
||||
self.assertIn("properties", image)
|
||||
|
||||
for key, value in six.iteritems(image["properties"]):
|
||||
for key in image["properties"]:
|
||||
sys_key = "%s%s" % (utils.SM_IMAGE_PROP_PREFIX, key)
|
||||
self.assertEqual(image["properties"][key], sys_meta[sys_key])
|
||||
|
||||
|
@ -19,7 +19,6 @@ import os
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
import six
|
||||
|
||||
from nova.virt.libvirt import config
|
||||
from nova.virt.libvirt import driver
|
||||
@ -87,7 +86,7 @@ class ImageBackendFixture(fixtures.Fixture):
|
||||
"""
|
||||
|
||||
# A disk was created iff either cache() or import_file() was called.
|
||||
return {name: disk for name, disk in six.iteritems(self.disks)
|
||||
return {name: disk for name, disk in self.disks.items()
|
||||
if any([disk.cache.called, disk.import_file.called])}
|
||||
|
||||
def _mock_disk(self):
|
||||
|
@ -17,7 +17,6 @@ import time
|
||||
|
||||
import fixtures
|
||||
from lxml import etree
|
||||
import six
|
||||
|
||||
from nova.objects import fields as obj_fields
|
||||
from nova.tests import uuidsentinel as uuids
|
||||
@ -1033,7 +1032,7 @@ class Connection(object):
|
||||
|
||||
dom._id = -1
|
||||
|
||||
for (k, v) in six.iteritems(self._running_vms):
|
||||
for (k, v) in self._running_vms.items():
|
||||
if v == dom:
|
||||
del self._running_vms[k]
|
||||
self._emit_lifecycle(dom, VIR_DOMAIN_EVENT_STOPPED, 0)
|
||||
|
@ -6519,7 +6519,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
||||
_get_prefix(prefix, 'ubda'))]
|
||||
}
|
||||
|
||||
for (virt_type, checks) in six.iteritems(type_disk_map):
|
||||
for (virt_type, checks) in type_disk_map.items():
|
||||
self.flags(virt_type=virt_type, group='libvirt')
|
||||
if prefix:
|
||||
self.flags(disk_prefix=prefix, group='libvirt')
|
||||
@ -6835,7 +6835,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
||||
# implementation doesn't fiddle around with the CONF.
|
||||
testuri = 'something completely different'
|
||||
self.flags(connection_uri=testuri, group='libvirt')
|
||||
for (virt_type, (expected_uri, checks)) in six.iteritems(type_uri_map):
|
||||
for virt_type in type_uri_map:
|
||||
self.flags(virt_type=virt_type, group='libvirt')
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
self.assertEqual(drvr._uri(), testuri)
|
||||
@ -10614,7 +10614,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
||||
|
||||
# Assert that kernel and ramdisk were fetched with fetch_raw_image
|
||||
# and no size
|
||||
for name, disk in six.iteritems(fake_backend.disks):
|
||||
for name, disk in fake_backend.disks.items():
|
||||
cache = disk.cache
|
||||
if name in ('kernel', 'ramdisk'):
|
||||
cache.assert_called_once_with(
|
||||
@ -11565,7 +11565,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
||||
# We translate all the full paths into disk names here to make the
|
||||
# test readable
|
||||
disks = {os.path.basename(name): value
|
||||
for name, value in six.iteritems(disks)}
|
||||
for name, value in disks.items()}
|
||||
|
||||
# We should have called cache() on the root and ephemeral disks
|
||||
for name in ('disk', 'disk.local'):
|
||||
@ -18503,7 +18503,7 @@ class _BaseSnapshotTests(test.NoDBTestCase):
|
||||
|
||||
if expected_properties:
|
||||
for expected_key, expected_value in \
|
||||
six.iteritems(expected_properties):
|
||||
expected_properties.items():
|
||||
self.assertEqual(expected_value, props[expected_key])
|
||||
|
||||
def _create_image(self, extra_properties=None):
|
||||
|
@ -370,7 +370,7 @@ ID TAG VM SIZE DATE VM CLOCK
|
||||
# NOTE(aloga): Xen is tested in test_pick_disk_driver_name_xen
|
||||
|
||||
version = 1005001
|
||||
for (virt_type, checks) in six.iteritems(type_map):
|
||||
for (virt_type, checks) in type_map.items():
|
||||
self.flags(virt_type=virt_type, group='libvirt')
|
||||
for (is_block_dev, expected_result) in checks:
|
||||
result = libvirt_utils.pick_disk_driver_name(version,
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
import mock
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
|
||||
from nova import block_device
|
||||
from nova import context
|
||||
@ -232,7 +231,7 @@ class TestDriverBlockDevice(test.NoDBTestCase):
|
||||
self.assertThat(test_bdm, matchers.DictMatches(
|
||||
getattr(self, "%s_driver_bdm" % name)))
|
||||
|
||||
for k, v in six.iteritems(db_bdm):
|
||||
for k, v in db_bdm.items():
|
||||
field_val = getattr(test_bdm._bdm_obj, k)
|
||||
if isinstance(field_val, bool):
|
||||
v = bool(v)
|
||||
@ -248,7 +247,7 @@ class TestDriverBlockDevice(test.NoDBTestCase):
|
||||
getattr(test_bdm._bdm_obj, passthru))
|
||||
|
||||
# Make sure that all others raise _invalidType
|
||||
for other_name, cls in six.iteritems(self.driver_classes):
|
||||
for other_name, cls in self.driver_classes.items():
|
||||
if other_name == name:
|
||||
continue
|
||||
self.assertRaises(driver_block_device._InvalidType,
|
||||
@ -257,14 +256,14 @@ class TestDriverBlockDevice(test.NoDBTestCase):
|
||||
|
||||
# Test the save method
|
||||
with mock.patch.object(test_bdm._bdm_obj, 'save') as save_mock:
|
||||
for fld, alias in six.iteritems(test_bdm._update_on_save):
|
||||
for fld, alias in test_bdm._update_on_save.items():
|
||||
# We can't set fake values on enums, like device_type,
|
||||
# so skip those.
|
||||
if not isinstance(test_bdm._bdm_obj.fields[fld],
|
||||
fields.BaseEnumField):
|
||||
test_bdm[alias or fld] = 'fake_changed_value'
|
||||
test_bdm.save()
|
||||
for fld, alias in six.iteritems(test_bdm._update_on_save):
|
||||
for fld, alias in test_bdm._update_on_save.items():
|
||||
self.assertEqual(test_bdm[alias or fld],
|
||||
getattr(test_bdm._bdm_obj, fld))
|
||||
|
||||
|
@ -205,7 +205,7 @@ class VirtDriverLoaderTestCase(_FakeDriverBackendTestCase, test.TestCase):
|
||||
}
|
||||
|
||||
def test_load_new_drivers(self):
|
||||
for cls, driver in six.iteritems(self.new_drivers):
|
||||
for cls, driver in self.new_drivers.items():
|
||||
self.flags(compute_driver=cls)
|
||||
# NOTE(sdague) the try block is to make it easier to debug a
|
||||
# failure by knowing which driver broke
|
||||
|
@ -28,7 +28,6 @@ from oslo_utils import units
|
||||
from oslo_utils import uuidutils
|
||||
from oslo_vmware import exceptions as vexc
|
||||
from oslo_vmware.objects import datastore as ds_obj
|
||||
import six
|
||||
|
||||
from nova import exception
|
||||
from nova.virt.vmwareapi import constants
|
||||
@ -1008,7 +1007,7 @@ def create_vm(uuid=None, name=None,
|
||||
if vm_path.rel_path == '':
|
||||
vm_path = vm_path.join(name, name + '.vmx')
|
||||
|
||||
for key, value in six.iteritems(_db_content["Datastore"]):
|
||||
for key, value in _db_content["Datastore"].items():
|
||||
if value.get('summary.name') == vm_path.datastore:
|
||||
ds = key
|
||||
break
|
||||
|
@ -22,7 +22,6 @@ import mock
|
||||
from os_xenapi.client import session
|
||||
from os_xenapi.client import XenAPI
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
|
||||
from nova import test
|
||||
import nova.tests.unit.image.fake
|
||||
@ -70,8 +69,8 @@ def stubout_session(stubs, cls, product_version=(5, 6, 2),
|
||||
|
||||
def stubout_get_this_vm_uuid(stubs):
|
||||
def f(session):
|
||||
vms = [rec['uuid'] for ref, rec
|
||||
in six.iteritems(fake.get_all_records('VM'))
|
||||
vms = [rec['uuid'] for rec
|
||||
in fake.get_all_records('VM').values()
|
||||
if rec['is_control_domain']]
|
||||
return vms[0]
|
||||
stubs.Set(vm_utils, 'get_this_vm_uuid', f)
|
||||
|
@ -146,7 +146,7 @@ class ParseVolumeInfoTestCase(stubs.XenAPITestBaseNoDB):
|
||||
'xvdq': -1,
|
||||
}
|
||||
|
||||
for (input, expected) in six.iteritems(cases):
|
||||
for (input, expected) in cases.items():
|
||||
actual = volume_utils._mountpoint_to_number(input)
|
||||
self.assertEqual(actual, expected,
|
||||
'%s yielded %s, not %s' % (input, actual, expected))
|
||||
|
@ -32,7 +32,6 @@ from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
import testtools
|
||||
|
||||
from nova.compute import api as compute_api
|
||||
@ -596,8 +595,8 @@ class XenAPIVMTestCase(stubs.XenAPITestBase):
|
||||
# Get Nova record for VM
|
||||
vm_info = conn.get_info({'name': name})
|
||||
# Get XenAPI record for VM
|
||||
vms = [rec for ref, rec
|
||||
in six.iteritems(xenapi_fake.get_all_records('VM'))
|
||||
vms = [rec for rec
|
||||
in xenapi_fake.get_all_records('VM').values()
|
||||
if not rec['is_control_domain']]
|
||||
vm = vms[0]
|
||||
self.vm_info = vm_info
|
||||
@ -2533,7 +2532,7 @@ class XenAPIBWCountersTestCase(stubs.XenAPITestBaseNoDB):
|
||||
|
||||
@classmethod
|
||||
def _fake_list_vms(cls, session):
|
||||
return six.iteritems(cls.FAKE_VMS)
|
||||
return cls.FAKE_VMS.items()
|
||||
|
||||
@staticmethod
|
||||
def _fake_fetch_bandwidth_mt(session):
|
||||
@ -2923,7 +2922,7 @@ class XenAPISRSelectionTestCase(stubs.XenAPITestBaseNoDB):
|
||||
def _create_service_entries(context, values={'avail_zone1': ['fake_host1',
|
||||
'fake_host2'],
|
||||
'avail_zone2': ['fake_host3'], }):
|
||||
for avail_zone, hosts in six.iteritems(values):
|
||||
for hosts in values.values():
|
||||
for service_host in hosts:
|
||||
db.service_create(context,
|
||||
{'host': service_host,
|
||||
|
Loading…
Reference in New Issue
Block a user