Backslash continuations (nova.tests)
Fixes bug #925285 Backslash continuations removal for package nova.tests Change-Id: I089dfb9a06a807e58ebb21329800a4eff40ed2bb
This commit is contained in:
@@ -95,9 +95,9 @@ class DomainReadWriteTestCase(test.TestCase):
|
|||||||
|
|
||||||
self.mox.StubOutWithMock(__builtin__, 'open')
|
self.mox.StubOutWithMock(__builtin__, 'open')
|
||||||
try:
|
try:
|
||||||
open('/tftpboot/test_fake_dom_file', 'r').AndRaise(\
|
open('/tftpboot/test_fake_dom_file',
|
||||||
IOError(2, 'No such file or directory',
|
'r').AndRaise(IOError(2, 'No such file or directory',
|
||||||
'/tftpboot/test_fake_dom_file'))
|
'/tftpboot/test_fake_dom_file'))
|
||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
@@ -128,8 +128,8 @@ class DomainReadWriteTestCase(test.TestCase):
|
|||||||
# Python object as expected_json
|
# Python object as expected_json
|
||||||
# We can't do an exact string comparison
|
# We can't do an exact string comparison
|
||||||
# because of ordering and whitespace
|
# because of ordering and whitespace
|
||||||
mock_file.write(mox.Func(functools.partial(self.assertJSONEquals,\
|
mock_file.write(mox.Func(functools.partial(self.assertJSONEquals,
|
||||||
expected_json)))
|
expected_json)))
|
||||||
mock_file.close()
|
mock_file.close()
|
||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
@@ -236,8 +236,8 @@ class BareMetalDomTestCase(test.TestCase):
|
|||||||
self.mox.StubOutWithMock(dom, 'write_domains')
|
self.mox.StubOutWithMock(dom, 'write_domains')
|
||||||
|
|
||||||
# Expected calls
|
# Expected calls
|
||||||
dom.read_domains('/tftpboot/test_fake_dom_file')\
|
dom.read_domains('/tftpboot/'
|
||||||
.AndReturn(fake_domains)
|
'test_fake_dom_file').AndReturn(fake_domains)
|
||||||
dom.write_domains('/tftpboot/test_fake_dom_file', fake_domains)
|
dom.write_domains('/tftpboot/test_fake_dom_file', fake_domains)
|
||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
@@ -274,8 +274,8 @@ class ProxyBareMetalTestCase(test.TestCase):
|
|||||||
self.mox.StubOutWithMock(dom, 'write_domains')
|
self.mox.StubOutWithMock(dom, 'write_domains')
|
||||||
|
|
||||||
# Expected calls
|
# Expected calls
|
||||||
dom.read_domains('/tftpboot/test_fake_dom_file')\
|
dom.read_domains('/tftpboot/'
|
||||||
.AndReturn(fake_domains)
|
'test_fake_dom_file').AndReturn(fake_domains)
|
||||||
dom.write_domains('/tftpboot/test_fake_dom_file', fake_domains)
|
dom.write_domains('/tftpboot/test_fake_dom_file', fake_domains)
|
||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
@@ -26,26 +26,29 @@ class TileraBareMetalNodesTestCase(test.TestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TileraBareMetalNodesTestCase, self).setUp()
|
super(TileraBareMetalNodesTestCase, self).setUp()
|
||||||
self.board_info = """\
|
self.board_info = "\n".join([
|
||||||
# board_id ip_address mac_address 00:1A:CA:00:57:90 \
|
'# board_id ip_address mac_address 00:1A:CA:00:57:90 '
|
||||||
00:1A:CA:00:58:98 00:1A:CA:00:58:50
|
'00:1A:CA:00:58:98 00:1A:CA:00:58:50',
|
||||||
6 10.0.2.7 00:1A:CA:00:58:5C 10 16218 917 476 1 tilera_hv 1 \
|
'6 10.0.2.7 00:1A:CA:00:58:5C 10 16218 917 476 1 tilera_hv 1 '
|
||||||
{"vendor":"tilera","model":"TILEmpower","arch":"TILEPro64","features":\
|
'{"vendor":"tilera","model":"TILEmpower","arch":"TILEPro64",'
|
||||||
["8x8Grid","32bVLIW","5.6MBCache","443BOPS","37TbMesh","700MHz-866MHz",\
|
'"features":["8x8Grid","32bVLIW","5.6MBCache","443BOPS","37TbMesh",'
|
||||||
"4DDR2","2XAUIMAC/PHY","2GbEMAC"],"topology":{"cores":"64"}}
|
'"700MHz-866MHz","4DDR2","2XAUIMAC/PHY","2GbEMAC"],'
|
||||||
7 10.0.2.8 00:1A:CA:00:58:A4 10 16218 917 476 1 tilera_hv 1 \
|
'"topology":{"cores":"64"}}',
|
||||||
{"vendor":"tilera","model":"TILEmpower","arch":"TILEPro64","features":\
|
'7 10.0.2.8 00:1A:CA:00:58:A4 10 16218 917 476 1 tilera_hv 1 '
|
||||||
["8x8Grid","32bVLIW","5.6MBCache","443BOPS","37TbMesh","700MHz-866MHz",\
|
'{"vendor":"tilera","model":"TILEmpower","arch":"TILEPro64",'
|
||||||
"4DDR2","2XAUIMAC/PHY","2GbEMAC"],"topology":{"cores":"64"}}
|
'"features":["8x8Grid","32bVLIW","5.6MBCache","443BOPS","37TbMesh",'
|
||||||
8 10.0.2.9 00:1A:CA:00:58:1A 10 16218 917 476 1 tilera_hv 1 \
|
'"700MHz-866MHz","4DDR2","2XAUIMAC/PHY","2GbEMAC"],'
|
||||||
{"vendor":"tilera","model":"TILEmpower","arch":"TILEPro64","features":\
|
'"topology":{"cores":"64"}}',
|
||||||
["8x8Grid","32bVLIW","5.6MBCache","443BOPS","37TbMesh","700MHz-866MHz",\
|
'8 10.0.2.9 00:1A:CA:00:58:1A 10 16218 917 476 1 tilera_hv 1 '
|
||||||
"4DDR2","2XAUIMAC/PHY","2GbEMAC"],"topology":{"cores":"64"}}
|
'{"vendor":"tilera","model":"TILEmpower","arch":"TILEPro64",'
|
||||||
9 10.0.2.10 00:1A:CA:00:58:38 10 16385 1000 0 0 tilera_hv 1 \
|
'"features":["8x8Grid","32bVLIW","5.6MBCache","443BOPS","37TbMesh",'
|
||||||
{"vendor":"tilera","model":"TILEmpower","arch":"TILEPro64","features":\
|
'"700MHz-866MHz","4DDR2","2XAUIMAC/PHY","2GbEMAC"],'
|
||||||
["8x8Grid","32bVLIW","5.6MBCache","443BOPS","37TbMesh","700MHz-866MHz",\
|
'"topology":{"cores":"64"}}',
|
||||||
"4DDR2","2XAUIMAC/PHY","2GbEMAC"],"topology":{"cores":"64"}}
|
'9 10.0.2.10 00:1A:CA:00:58:38 10 16385 1000 0 0 tilera_hv 1 '
|
||||||
"""
|
'{"vendor":"tilera","model":"TILEmpower","arch":"TILEPro64",'
|
||||||
|
'"features":["8x8Grid","32bVLIW","5.6MBCache","443BOPS","37TbMesh",'
|
||||||
|
'"700MHz-866MHz","4DDR2","2XAUIMAC/PHY","2GbEMAC"],'
|
||||||
|
'"topology":{"cores":"64"}}'])
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
super(TileraBareMetalNodesTestCase, self).tearDown()
|
super(TileraBareMetalNodesTestCase, self).tearDown()
|
||||||
@@ -63,8 +66,8 @@ class TileraBareMetalNodesTestCase(test.TestCase):
|
|||||||
try:
|
try:
|
||||||
self.mox.StubOutWithMock(__builtin__, 'open')
|
self.mox.StubOutWithMock(__builtin__, 'open')
|
||||||
|
|
||||||
open("/tftpboot/tilera_boards", "r").AndReturn(\
|
open("/tftpboot/tilera_boards",
|
||||||
StringIO.StringIO(self.board_info))
|
"r").AndReturn(StringIO.StringIO(self.board_info))
|
||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
@@ -78,8 +81,8 @@ class TileraBareMetalNodesTestCase(test.TestCase):
|
|||||||
|
|
||||||
self.mox.StubOutWithMock(__builtin__, 'open')
|
self.mox.StubOutWithMock(__builtin__, 'open')
|
||||||
|
|
||||||
open("/tftpboot/tilera_boards", "r").AndReturn(\
|
open("/tftpboot/tilera_boards",
|
||||||
StringIO.StringIO(self.board_info))
|
"r").AndReturn(StringIO.StringIO(self.board_info))
|
||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
nodes = tilera.BareMetalNodes()
|
nodes = tilera.BareMetalNodes()
|
||||||
|
@@ -122,10 +122,10 @@ class VsaSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
|||||||
dtype['DriveType'] = 'type_' + str(j)
|
dtype['DriveType'] = 'type_' + str(j)
|
||||||
dtype['TotalDrives'] = 2 * (self.init_num_drives + i)
|
dtype['TotalDrives'] = 2 * (self.init_num_drives + i)
|
||||||
dtype['DriveCapacity'] = vsa_sched.GB_TO_BYTES(1 + 100 * j)
|
dtype['DriveCapacity'] = vsa_sched.GB_TO_BYTES(1 + 100 * j)
|
||||||
dtype['TotalCapacity'] = dtype['TotalDrives'] * \
|
dtype['TotalCapacity'] = (dtype['TotalDrives'] *
|
||||||
dtype['DriveCapacity']
|
dtype['DriveCapacity'])
|
||||||
dtype['AvailableCapacity'] = (dtype['TotalDrives'] - i) * \
|
dtype['AvailableCapacity'] = ((dtype['TotalDrives'] - i) *
|
||||||
dtype['DriveCapacity']
|
dtype['DriveCapacity'])
|
||||||
dtype['DriveRpm'] = 7200
|
dtype['DriveRpm'] = 7200
|
||||||
dtype['DifCapable'] = 0
|
dtype['DifCapable'] = 0
|
||||||
dtype['SedCapable'] = 0
|
dtype['SedCapable'] = 0
|
||||||
@@ -150,18 +150,20 @@ class VsaSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
|||||||
qos = host_val['volume']['drive_qos_info']
|
qos = host_val['volume']['drive_qos_info']
|
||||||
|
|
||||||
for k, d in qos.iteritems():
|
for k, d in qos.iteritems():
|
||||||
LOG.info("\t%s: type %s: drives (used %2d, total %2d) "\
|
LOG.info("\t%s: type %s: drives (used %2d, total %2d) "
|
||||||
"size %3d, total %4d, used %4d, avail %d",
|
"size %3d, total %4d, used %4d, avail %d",
|
||||||
k, d['DriveType'],
|
k,
|
||||||
d['FullDrive']['NumOccupiedDrives'], d['TotalDrives'],
|
d['DriveType'],
|
||||||
vsa_sched.BYTES_TO_GB(d['DriveCapacity']),
|
d['FullDrive']['NumOccupiedDrives'],
|
||||||
vsa_sched.BYTES_TO_GB(d['TotalCapacity']),
|
d['TotalDrives'],
|
||||||
vsa_sched.BYTES_TO_GB(d['TotalCapacity'] - \
|
vsa_sched.BYTES_TO_GB(d['DriveCapacity']),
|
||||||
d['AvailableCapacity']),
|
vsa_sched.BYTES_TO_GB(d['TotalCapacity']),
|
||||||
vsa_sched.BYTES_TO_GB(d['AvailableCapacity']))
|
vsa_sched.BYTES_TO_GB(d['TotalCapacity'] -
|
||||||
|
d['AvailableCapacity']),
|
||||||
|
vsa_sched.BYTES_TO_GB(d['AvailableCapacity']))
|
||||||
|
|
||||||
total_used += vsa_sched.BYTES_TO_GB(d['TotalCapacity'] - \
|
total_used += vsa_sched.BYTES_TO_GB(d['TotalCapacity'] -
|
||||||
d['AvailableCapacity'])
|
d['AvailableCapacity'])
|
||||||
total_available += vsa_sched.BYTES_TO_GB(
|
total_available += vsa_sched.BYTES_TO_GB(
|
||||||
d['AvailableCapacity'])
|
d['AvailableCapacity'])
|
||||||
LOG.info("Host %s: used %d, avail %d",
|
LOG.info("Host %s: used %d, avail %d",
|
||||||
@@ -196,7 +198,7 @@ class VsaSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
|||||||
LOG.debug(_("\t vol=%(vol)s"), locals())
|
LOG.debug(_("\t vol=%(vol)s"), locals())
|
||||||
|
|
||||||
def _fake_vsa_update(self, context, vsa_id, values):
|
def _fake_vsa_update(self, context, vsa_id, values):
|
||||||
LOG.debug(_("Test: VSA update request: vsa_id=%(vsa_id)s "\
|
LOG.debug(_("Test: VSA update request: vsa_id=%(vsa_id)s "
|
||||||
"values=%(values)s"), locals())
|
"values=%(values)s"), locals())
|
||||||
|
|
||||||
def _fake_volume_create(self, context, options):
|
def _fake_volume_create(self, context, options):
|
||||||
@@ -214,7 +216,7 @@ class VsaSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
|||||||
return global_volume
|
return global_volume
|
||||||
|
|
||||||
def _fake_volume_update(self, context, volume_id, values):
|
def _fake_volume_update(self, context, volume_id, values):
|
||||||
LOG.debug(_("Test: Volume update request: id=%(volume_id)s "\
|
LOG.debug(_("Test: Volume update request: id=%(volume_id)s "
|
||||||
"values=%(values)s"), locals())
|
"values=%(values)s"), locals())
|
||||||
global scheduled_volume
|
global scheduled_volume
|
||||||
scheduled_volume = {'id': volume_id, 'host': values['host']}
|
scheduled_volume = {'id': volume_id, 'host': values['host']}
|
||||||
|
@@ -279,7 +279,7 @@ class ApiEc2TestCase(test.TestCase):
|
|||||||
a key pair, that the API call to list key pairs works properly"""
|
a key pair, that the API call to list key pairs works properly"""
|
||||||
self.expect_http()
|
self.expect_http()
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
keyname = "".join(random.choice("sdiuisudfsdcnpaqwertasd") \
|
keyname = "".join(random.choice("sdiuisudfsdcnpaqwertasd")
|
||||||
for x in range(random.randint(4, 8)))
|
for x in range(random.randint(4, 8)))
|
||||||
# NOTE(vish): create depends on pool, so call helper directly
|
# NOTE(vish): create depends on pool, so call helper directly
|
||||||
cloud._gen_key(context.get_admin_context(), 'fake', keyname)
|
cloud._gen_key(context.get_admin_context(), 'fake', keyname)
|
||||||
@@ -293,7 +293,7 @@ class ApiEc2TestCase(test.TestCase):
|
|||||||
requesting a second keypair with the same name fails sanely"""
|
requesting a second keypair with the same name fails sanely"""
|
||||||
self.expect_http()
|
self.expect_http()
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
keyname = "".join(random.choice("sdiuisudfsdcnpaqwertasd") \
|
keyname = "".join(random.choice("sdiuisudfsdcnpaqwertasd")
|
||||||
for x in range(random.randint(4, 8)))
|
for x in range(random.randint(4, 8)))
|
||||||
# NOTE(vish): create depends on pool, so call helper directly
|
# NOTE(vish): create depends on pool, so call helper directly
|
||||||
self.ec2.create_key_pair('test')
|
self.ec2.create_key_pair('test')
|
||||||
|
@@ -74,8 +74,8 @@ orig_rpc_cast = rpc.cast
|
|||||||
|
|
||||||
def rpc_call_wrapper(context, topic, msg, do_cast=True):
|
def rpc_call_wrapper(context, topic, msg, do_cast=True):
|
||||||
"""Stub out the scheduler creating the instance entry"""
|
"""Stub out the scheduler creating the instance entry"""
|
||||||
if topic == FLAGS.scheduler_topic and \
|
if (topic == FLAGS.scheduler_topic and
|
||||||
msg['method'] == 'run_instance':
|
msg['method'] == 'run_instance'):
|
||||||
request_spec = msg['args']['request_spec']
|
request_spec = msg['args']['request_spec']
|
||||||
scheduler = scheduler_driver.Scheduler
|
scheduler = scheduler_driver.Scheduler
|
||||||
num_instances = request_spec.get('num_instances', 1)
|
num_instances = request_spec.get('num_instances', 1)
|
||||||
@@ -892,11 +892,11 @@ class ComputeTestCase(BaseTestCase):
|
|||||||
fake_get_nw_info)
|
fake_get_nw_info)
|
||||||
self.mox.StubOutWithMock(self.compute.network_api,
|
self.mox.StubOutWithMock(self.compute.network_api,
|
||||||
"allocate_for_instance")
|
"allocate_for_instance")
|
||||||
self.compute.network_api.allocate_for_instance(mox.IgnoreArg(),
|
self.compute.network_api.allocate_for_instance(
|
||||||
mox.IgnoreArg(),
|
mox.IgnoreArg(),
|
||||||
requested_networks=None,
|
mox.IgnoreArg(),
|
||||||
vpn=False).\
|
requested_networks=None,
|
||||||
AndRaise(quantum_client.QuantumServerException())
|
vpn=False).AndRaise(quantum_client.QuantumServerException())
|
||||||
|
|
||||||
self.flags(stub_network=False)
|
self.flags(stub_network=False)
|
||||||
|
|
||||||
@@ -918,9 +918,9 @@ class ComputeTestCase(BaseTestCase):
|
|||||||
instance = self._create_fake_instance()
|
instance = self._create_fake_instance()
|
||||||
|
|
||||||
self.mox.StubOutWithMock(self.compute, "_setup_block_device_mapping")
|
self.mox.StubOutWithMock(self.compute, "_setup_block_device_mapping")
|
||||||
self.compute._setup_block_device_mapping(mox.IgnoreArg(),
|
self.compute._setup_block_device_mapping(
|
||||||
mox.IgnoreArg()).\
|
mox.IgnoreArg(),
|
||||||
AndRaise(rpc.common.RemoteError('', '', ''))
|
mox.IgnoreArg()).AndRaise(rpc.common.RemoteError('', '', ''))
|
||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
@@ -1339,11 +1339,12 @@ class ComputeTestCase(BaseTestCase):
|
|||||||
self.mox.StubOutWithMock(self.compute.driver, 'get_instance_disk_info')
|
self.mox.StubOutWithMock(self.compute.driver, 'get_instance_disk_info')
|
||||||
self.compute.driver.get_instance_disk_info(inst_ref.name)
|
self.compute.driver.get_instance_disk_info(inst_ref.name)
|
||||||
|
|
||||||
rpc.call(c, topic, {"method": "pre_live_migration",
|
rpc.call(c, topic,
|
||||||
"args": {'instance_id': instance_id,
|
{"method": "pre_live_migration",
|
||||||
'block_migration': True,
|
"args": {'instance_id': instance_id,
|
||||||
'disk': None}}).\
|
'block_migration': True,
|
||||||
AndRaise(rpc.common.RemoteError('', '', ''))
|
'disk': None}
|
||||||
|
}).AndRaise(rpc.common.RemoteError('', '', ''))
|
||||||
# mocks for rollback
|
# mocks for rollback
|
||||||
rpc.call(c, topic, {"method": "remove_volume_connection",
|
rpc.call(c, topic, {"method": "remove_volume_connection",
|
||||||
"args": {'instance_id': instance_id,
|
"args": {'instance_id': instance_id,
|
||||||
|
@@ -125,8 +125,8 @@ class DirectTestCase(test.TestCase):
|
|||||||
req = webob.Request.blank('/fake/echo')
|
req = webob.Request.blank('/fake/echo')
|
||||||
req.environ['openstack.context'] = self.context
|
req.environ['openstack.context'] = self.context
|
||||||
req.method = 'POST'
|
req.method = 'POST'
|
||||||
req.body = 'data=foo&_underscored=ignoreMe&self=ignoreMe&context='\
|
req.body = ('data=foo&_underscored=ignoreMe&self=ignoreMe&context='
|
||||||
'ignoreMe'
|
'ignoreMe')
|
||||||
resp = req.get_response(self.router)
|
resp = req.get_response(self.router)
|
||||||
self.assertEqual(resp.status_int, 200)
|
self.assertEqual(resp.status_int, 200)
|
||||||
resp_parsed = json.loads(resp.body)
|
resp_parsed = json.loads(resp.body)
|
||||||
|
@@ -49,8 +49,8 @@ class InstanceTypeTestCase(test.TestCase):
|
|||||||
def _generate_flavorid(self):
|
def _generate_flavorid(self):
|
||||||
"""return a flavorid not in the DB"""
|
"""return a flavorid not in the DB"""
|
||||||
nonexistent_flavor = 2700
|
nonexistent_flavor = 2700
|
||||||
flavor_ids = [value["id"] for key, value in\
|
flavor_ids = [value["id"] for key, value in
|
||||||
instance_types.get_all_types().iteritems()]
|
instance_types.get_all_types().iteritems()]
|
||||||
while nonexistent_flavor in flavor_ids:
|
while nonexistent_flavor in flavor_ids:
|
||||||
nonexistent_flavor += 1
|
nonexistent_flavor += 1
|
||||||
else:
|
else:
|
||||||
|
@@ -83,17 +83,17 @@ class TgtAdmTestCase(test.TestCase, TargetAdminTestCase):
|
|||||||
super(TgtAdmTestCase, self).setUp()
|
super(TgtAdmTestCase, self).setUp()
|
||||||
TargetAdminTestCase.setUp(self)
|
TargetAdminTestCase.setUp(self)
|
||||||
self.flags(iscsi_helper='tgtadm')
|
self.flags(iscsi_helper='tgtadm')
|
||||||
self.script_template = """
|
self.script_template = "\n".join([
|
||||||
tgtadm --op new --lld=iscsi --mode=target --tid=%(tid)s \
|
"tgtadm --op new --lld=iscsi --mode=target --tid=%(tid)s "
|
||||||
--targetname=%(target_name)s
|
"--targetname=%(target_name)s",
|
||||||
tgtadm --op bind --lld=iscsi --mode=target --initiator-address=ALL \
|
"tgtadm --op bind --lld=iscsi --mode=target --initiator-address=ALL "
|
||||||
--tid=%(tid)s
|
"--tid=%(tid)s",
|
||||||
tgtadm --op show --lld=iscsi --mode=target --tid=%(tid)s
|
"tgtadm --op show --lld=iscsi --mode=target --tid=%(tid)s",
|
||||||
tgtadm --op new --lld=iscsi --mode=logicalunit --tid=%(tid)s --lun=%(lun)d \
|
"tgtadm --op new --lld=iscsi --mode=logicalunit --tid=%(tid)s "
|
||||||
--backing-store=%(path)s
|
"--lun=%(lun)d --backing-store=%(path)s",
|
||||||
tgtadm --op delete --lld=iscsi --mode=logicalunit --tid=%(tid)s --lun=%(lun)d
|
"tgtadm --op delete --lld=iscsi --mode=logicalunit --tid=%(tid)s "
|
||||||
tgtadm --op delete --lld=iscsi --mode=target --tid=%(tid)s
|
"--lun=%(lun)d",
|
||||||
"""
|
"tgtadm --op delete --lld=iscsi --mode=target --tid=%(tid)s"])
|
||||||
|
|
||||||
def get_script_params(self):
|
def get_script_params(self):
|
||||||
params = super(TgtAdmTestCase, self).get_script_params()
|
params = super(TgtAdmTestCase, self).get_script_params()
|
||||||
@@ -107,10 +107,10 @@ class IetAdmTestCase(test.TestCase, TargetAdminTestCase):
|
|||||||
super(IetAdmTestCase, self).setUp()
|
super(IetAdmTestCase, self).setUp()
|
||||||
TargetAdminTestCase.setUp(self)
|
TargetAdminTestCase.setUp(self)
|
||||||
self.flags(iscsi_helper='ietadm')
|
self.flags(iscsi_helper='ietadm')
|
||||||
self.script_template = """
|
self.script_template = "\n".join([
|
||||||
ietadm --op new --tid=%(tid)s --params Name=%(target_name)s
|
"ietadm --op new --tid=%(tid)s --params Name=%(target_name)s",
|
||||||
ietadm --op show --tid=%(tid)s
|
"ietadm --op show --tid=%(tid)s",
|
||||||
ietadm --op new --tid=%(tid)s --lun=%(lun)d --params Path=%(path)s,Type=fileio
|
"ietadm --op new --tid=%(tid)s --lun=%(lun)d "
|
||||||
ietadm --op delete --tid=%(tid)s --lun=%(lun)d
|
"--params Path=%(path)s,Type=fileio",
|
||||||
ietadm --op delete --tid=%(tid)s
|
"ietadm --op delete --tid=%(tid)s --lun=%(lun)d",
|
||||||
"""
|
"ietadm --op delete --tid=%(tid)s"])
|
||||||
|
@@ -906,10 +906,11 @@ class LibvirtConnTestCase(test.TestCase):
|
|||||||
# Preparing mocks
|
# Preparing mocks
|
||||||
vdmock = self.mox.CreateMock(libvirt.virDomain)
|
vdmock = self.mox.CreateMock(libvirt.virDomain)
|
||||||
self.mox.StubOutWithMock(vdmock, "migrateToURI")
|
self.mox.StubOutWithMock(vdmock, "migrateToURI")
|
||||||
|
_bandwidth = FLAGS.live_migration_bandwidth
|
||||||
vdmock.migrateToURI(FLAGS.live_migration_uri % 'dest',
|
vdmock.migrateToURI(FLAGS.live_migration_uri % 'dest',
|
||||||
mox.IgnoreArg(),
|
mox.IgnoreArg(),
|
||||||
None, FLAGS.live_migration_bandwidth).\
|
None,
|
||||||
AndRaise(libvirt.libvirtError('ERR'))
|
_bandwidth).AndRaise(libvirt.libvirtError('ERR'))
|
||||||
|
|
||||||
def fake_lookup(instance_name):
|
def fake_lookup(instance_name):
|
||||||
if instance_name == instance_ref.name:
|
if instance_name == instance_ref.name:
|
||||||
@@ -1025,8 +1026,8 @@ class LibvirtConnTestCase(test.TestCase):
|
|||||||
os.path.getsize('/test/disk').AndReturn((10737418240))
|
os.path.getsize('/test/disk').AndReturn((10737418240))
|
||||||
|
|
||||||
self.mox.StubOutWithMock(utils, "execute")
|
self.mox.StubOutWithMock(utils, "execute")
|
||||||
utils.execute('qemu-img', 'info', '/test/disk.local').\
|
utils.execute('qemu-img', 'info',
|
||||||
AndReturn((ret, ''))
|
'/test/disk.local').AndReturn((ret, ''))
|
||||||
|
|
||||||
os.path.getsize('/test/disk.local').AndReturn((21474836480))
|
os.path.getsize('/test/disk.local').AndReturn((21474836480))
|
||||||
|
|
||||||
@@ -1185,10 +1186,11 @@ class LibvirtConnTestCase(test.TestCase):
|
|||||||
|
|
||||||
class HostStateTestCase(test.TestCase):
|
class HostStateTestCase(test.TestCase):
|
||||||
|
|
||||||
cpu_info = '{"vendor": "Intel", "model": "pentium", "arch": "i686", '\
|
cpu_info = ('{"vendor": "Intel", "model": "pentium", "arch": "i686", '
|
||||||
'"features": ["ssse3", "monitor", "pni", "sse2", "sse", "fxsr", '\
|
'"features": ["ssse3", "monitor", "pni", "sse2", "sse", '
|
||||||
'"clflush", "pse36", "pat", "cmov", "mca", "pge", "mtrr", "sep", '\
|
'"fxsr", "clflush", "pse36", "pat", "cmov", "mca", "pge", '
|
||||||
'"apic"], "topology": {"cores": "1", "threads": "1", "sockets": "1"}}'
|
'"mtrr", "sep", "apic"], '
|
||||||
|
'"topology": {"cores": "1", "threads": "1", "sockets": "1"}}')
|
||||||
|
|
||||||
class FakeConnection(object):
|
class FakeConnection(object):
|
||||||
"""Fake connection object"""
|
"""Fake connection object"""
|
||||||
@@ -1232,13 +1234,13 @@ class HostStateTestCase(test.TestCase):
|
|||||||
stats = hs._stats
|
stats = hs._stats
|
||||||
self.assertEquals(stats["vcpus"], 1)
|
self.assertEquals(stats["vcpus"], 1)
|
||||||
self.assertEquals(stats["vcpus_used"], 0)
|
self.assertEquals(stats["vcpus_used"], 0)
|
||||||
self.assertEquals(stats["cpu_info"], \
|
self.assertEquals(stats["cpu_info"],
|
||||||
{"vendor": "Intel", "model": "pentium", "arch": "i686",
|
{"vendor": "Intel", "model": "pentium", "arch": "i686",
|
||||||
"features": ["ssse3", "monitor", "pni", "sse2", "sse", "fxsr",
|
"features": ["ssse3", "monitor", "pni", "sse2", "sse",
|
||||||
"clflush", "pse36", "pat", "cmov", "mca", "pge",
|
"fxsr", "clflush", "pse36", "pat", "cmov",
|
||||||
"mtrr", "sep", "apic"],
|
"mca", "pge", "mtrr", "sep", "apic"],
|
||||||
"topology": {"cores": "1", "threads": "1", "sockets": "1"}
|
"topology": {"cores": "1", "threads": "1", "sockets": "1"}
|
||||||
})
|
})
|
||||||
self.assertEquals(stats["disk_total"], 100)
|
self.assertEquals(stats["disk_total"], 100)
|
||||||
self.assertEquals(stats["disk_used"], 20)
|
self.assertEquals(stats["disk_used"], 20)
|
||||||
self.assertEquals(stats["disk_available"], 80)
|
self.assertEquals(stats["disk_available"], 80)
|
||||||
@@ -1523,10 +1525,10 @@ class IptablesFirewallTestCase(test.TestCase):
|
|||||||
admin_ctxt = context.get_admin_context()
|
admin_ctxt = context.get_admin_context()
|
||||||
|
|
||||||
fakefilter = NWFilterFakes()
|
fakefilter = NWFilterFakes()
|
||||||
self.fw.nwfilter._conn.nwfilterDefineXML =\
|
_xml_mock = fakefilter.filterDefineXMLMock
|
||||||
fakefilter.filterDefineXMLMock
|
self.fw.nwfilter._conn.nwfilterDefineXML = _xml_mock
|
||||||
self.fw.nwfilter._conn.nwfilterLookupByName =\
|
_lookup_name = fakefilter.nwfilterLookupByName
|
||||||
fakefilter.nwfilterLookupByName
|
self.fw.nwfilter._conn.nwfilterLookupByName = _lookup_name
|
||||||
instance_ref = self._create_instance_ref()
|
instance_ref = self._create_instance_ref()
|
||||||
|
|
||||||
network_info = _fake_network_info(self.stubs, 1)
|
network_info = _fake_network_info(self.stubs, 1)
|
||||||
|
@@ -206,21 +206,19 @@ class LinuxNetworkTestCase(test.TestCase):
|
|||||||
self.mox.StubOutWithMock(self.driver, 'ensure_path')
|
self.mox.StubOutWithMock(self.driver, 'ensure_path')
|
||||||
self.mox.StubOutWithMock(os, 'chmod')
|
self.mox.StubOutWithMock(os, 'chmod')
|
||||||
|
|
||||||
db.network_get_associated_fixed_ips(mox.IgnoreArg(),
|
db.network_get_associated_fixed_ips(
|
||||||
mox.IgnoreArg())\
|
mox.IgnoreArg(),
|
||||||
.AndReturn([fixed_ips[0],
|
mox.IgnoreArg()).AndReturn([fixed_ips[0], fixed_ips[3]])
|
||||||
fixed_ips[3]])
|
|
||||||
|
|
||||||
db.network_get_associated_fixed_ips(mox.IgnoreArg(),
|
db.network_get_associated_fixed_ips(
|
||||||
mox.IgnoreArg())\
|
mox.IgnoreArg(),
|
||||||
.AndReturn([fixed_ips[0],
|
mox.IgnoreArg()).AndReturn([fixed_ips[0], fixed_ips[3]])
|
||||||
fixed_ips[3]])
|
db.virtual_interface_get_by_instance(
|
||||||
db.virtual_interface_get_by_instance(mox.IgnoreArg(),
|
mox.IgnoreArg(),
|
||||||
mox.IgnoreArg())\
|
mox.IgnoreArg()).AndReturn([vifs[0], vifs[1]])
|
||||||
.AndReturn([vifs[0], vifs[1]])
|
db.virtual_interface_get_by_instance(
|
||||||
db.virtual_interface_get_by_instance(mox.IgnoreArg(),
|
mox.IgnoreArg(),
|
||||||
mox.IgnoreArg())\
|
mox.IgnoreArg()).AndReturn([vifs[2], vifs[3]])
|
||||||
.AndReturn([vifs[2], vifs[3]])
|
|
||||||
self.driver.write_to_file(mox.IgnoreArg(), mox.IgnoreArg())
|
self.driver.write_to_file(mox.IgnoreArg(), mox.IgnoreArg())
|
||||||
self.driver.write_to_file(mox.IgnoreArg(), mox.IgnoreArg())
|
self.driver.write_to_file(mox.IgnoreArg(), mox.IgnoreArg())
|
||||||
self.driver.ensure_path(mox.IgnoreArg())
|
self.driver.ensure_path(mox.IgnoreArg())
|
||||||
@@ -254,21 +252,19 @@ class LinuxNetworkTestCase(test.TestCase):
|
|||||||
self.mox.StubOutWithMock(self.driver, 'ensure_path')
|
self.mox.StubOutWithMock(self.driver, 'ensure_path')
|
||||||
self.mox.StubOutWithMock(os, 'chmod')
|
self.mox.StubOutWithMock(os, 'chmod')
|
||||||
|
|
||||||
db.network_get_associated_fixed_ips(mox.IgnoreArg(),
|
db.network_get_associated_fixed_ips(
|
||||||
mox.IgnoreArg())\
|
mox.IgnoreArg(),
|
||||||
.AndReturn([fixed_ips[1],
|
mox.IgnoreArg()).AndReturn([fixed_ips[1], fixed_ips[2]])
|
||||||
fixed_ips[2]])
|
|
||||||
|
|
||||||
db.network_get_associated_fixed_ips(mox.IgnoreArg(),
|
db.network_get_associated_fixed_ips(
|
||||||
mox.IgnoreArg())\
|
mox.IgnoreArg(),
|
||||||
.AndReturn([fixed_ips[1],
|
mox.IgnoreArg()).AndReturn([fixed_ips[1], fixed_ips[2]])
|
||||||
fixed_ips[2]])
|
db.virtual_interface_get_by_instance(
|
||||||
db.virtual_interface_get_by_instance(mox.IgnoreArg(),
|
mox.IgnoreArg(),
|
||||||
mox.IgnoreArg())\
|
mox.IgnoreArg()).AndReturn([vifs[0], vifs[1]])
|
||||||
.AndReturn([vifs[0], vifs[1]])
|
db.virtual_interface_get_by_instance(
|
||||||
db.virtual_interface_get_by_instance(mox.IgnoreArg(),
|
mox.IgnoreArg(),
|
||||||
mox.IgnoreArg())\
|
mox.IgnoreArg()).AndReturn([vifs[2], vifs[3]])
|
||||||
.AndReturn([vifs[2], vifs[3]])
|
|
||||||
self.driver.write_to_file(mox.IgnoreArg(), mox.IgnoreArg())
|
self.driver.write_to_file(mox.IgnoreArg(), mox.IgnoreArg())
|
||||||
self.driver.write_to_file(mox.IgnoreArg(), mox.IgnoreArg())
|
self.driver.write_to_file(mox.IgnoreArg(), mox.IgnoreArg())
|
||||||
self.driver.ensure_path(mox.IgnoreArg())
|
self.driver.ensure_path(mox.IgnoreArg())
|
||||||
@@ -298,17 +294,15 @@ class LinuxNetworkTestCase(test.TestCase):
|
|||||||
self.stubs.Set(db, 'instance_get', get_instance)
|
self.stubs.Set(db, 'instance_get', get_instance)
|
||||||
self.mox.StubOutWithMock(db, 'network_get_associated_fixed_ips')
|
self.mox.StubOutWithMock(db, 'network_get_associated_fixed_ips')
|
||||||
|
|
||||||
db.network_get_associated_fixed_ips(mox.IgnoreArg(),
|
db.network_get_associated_fixed_ips(
|
||||||
mox.IgnoreArg())\
|
mox.IgnoreArg(),
|
||||||
.AndReturn([fixed_ips[0],
|
mox.IgnoreArg()).AndReturn([fixed_ips[0], fixed_ips[3]])
|
||||||
fixed_ips[3]])
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
expected = \
|
expected = ("DE:AD:BE:EF:00:00,fake_instance00.novalocal,"
|
||||||
"DE:AD:BE:EF:00:00,fake_instance00.novalocal,"\
|
"192.168.0.100,net:NW-i00000000-0\n"
|
||||||
"192.168.0.100,net:NW-i00000000-0\n"\
|
"DE:AD:BE:EF:00:03,fake_instance01.novalocal,"
|
||||||
"DE:AD:BE:EF:00:03,fake_instance01.novalocal,"\
|
"192.168.1.101,net:NW-i00000001-0")
|
||||||
"192.168.1.101,net:NW-i00000001-0"
|
|
||||||
actual_hosts = self.driver.get_dhcp_hosts(self.context, networks[1])
|
actual_hosts = self.driver.get_dhcp_hosts(self.context, networks[1])
|
||||||
|
|
||||||
self.assertEquals(actual_hosts, expected)
|
self.assertEquals(actual_hosts, expected)
|
||||||
@@ -326,17 +320,15 @@ class LinuxNetworkTestCase(test.TestCase):
|
|||||||
self.stubs.Set(db, 'instance_get', get_instance)
|
self.stubs.Set(db, 'instance_get', get_instance)
|
||||||
self.mox.StubOutWithMock(db, 'network_get_associated_fixed_ips')
|
self.mox.StubOutWithMock(db, 'network_get_associated_fixed_ips')
|
||||||
|
|
||||||
db.network_get_associated_fixed_ips(mox.IgnoreArg(),
|
db.network_get_associated_fixed_ips(
|
||||||
mox.IgnoreArg())\
|
mox.IgnoreArg(),
|
||||||
.AndReturn([fixed_ips[1],
|
mox.IgnoreArg()).AndReturn([fixed_ips[1], fixed_ips[2]])
|
||||||
fixed_ips[2]])
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
expected = \
|
expected = ("DE:AD:BE:EF:00:01,fake_instance00.novalocal,"
|
||||||
"DE:AD:BE:EF:00:01,fake_instance00.novalocal,"\
|
"192.168.1.100,net:NW-i00000000-1\n"
|
||||||
"192.168.1.100,net:NW-i00000000-1\n"\
|
"DE:AD:BE:EF:00:02,fake_instance01.novalocal,"
|
||||||
"DE:AD:BE:EF:00:02,fake_instance01.novalocal,"\
|
"192.168.0.101,net:NW-i00000001-1")
|
||||||
"192.168.0.101,net:NW-i00000001-1"
|
|
||||||
actual_hosts = self.driver.get_dhcp_hosts(self.context, networks[0])
|
actual_hosts = self.driver.get_dhcp_hosts(self.context, networks[0])
|
||||||
|
|
||||||
self.assertEquals(actual_hosts, expected)
|
self.assertEquals(actual_hosts, expected)
|
||||||
@@ -349,21 +341,16 @@ class LinuxNetworkTestCase(test.TestCase):
|
|||||||
self.mox.StubOutWithMock(db, 'network_get_associated_fixed_ips')
|
self.mox.StubOutWithMock(db, 'network_get_associated_fixed_ips')
|
||||||
self.mox.StubOutWithMock(db, 'virtual_interface_get_by_instance')
|
self.mox.StubOutWithMock(db, 'virtual_interface_get_by_instance')
|
||||||
|
|
||||||
db.network_get_associated_fixed_ips(mox.IgnoreArg(),
|
db.network_get_associated_fixed_ips(
|
||||||
mox.IgnoreArg())\
|
mox.IgnoreArg(),
|
||||||
.AndReturn([fixed_ips[0],
|
mox.IgnoreArg()).AndReturn([fixed_ips[0], fixed_ips[3],
|
||||||
fixed_ips[3],
|
fixed_ips[4]])
|
||||||
fixed_ips[4]])
|
db.virtual_interface_get_by_instance(
|
||||||
db.virtual_interface_get_by_instance(mox.IgnoreArg(),
|
mox.IgnoreArg(),
|
||||||
mox.IgnoreArg())\
|
mox.IgnoreArg()).AndReturn([vifs[0], vifs[1], vifs[4]])
|
||||||
.AndReturn([vifs[0],
|
db.virtual_interface_get_by_instance(
|
||||||
vifs[1],
|
mox.IgnoreArg(),
|
||||||
vifs[4]])
|
mox.IgnoreArg()).AndReturn([vifs[2], vifs[3], vifs[5]])
|
||||||
db.virtual_interface_get_by_instance(mox.IgnoreArg(),
|
|
||||||
mox.IgnoreArg())\
|
|
||||||
.AndReturn([vifs[2],
|
|
||||||
vifs[3],
|
|
||||||
vifs[5]])
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
expected_opts = 'NW-i00000001-0,3'
|
expected_opts = 'NW-i00000001-0,3'
|
||||||
@@ -380,21 +367,16 @@ class LinuxNetworkTestCase(test.TestCase):
|
|||||||
self.mox.StubOutWithMock(db, 'network_get_associated_fixed_ips')
|
self.mox.StubOutWithMock(db, 'network_get_associated_fixed_ips')
|
||||||
self.mox.StubOutWithMock(db, 'virtual_interface_get_by_instance')
|
self.mox.StubOutWithMock(db, 'virtual_interface_get_by_instance')
|
||||||
|
|
||||||
db.network_get_associated_fixed_ips(mox.IgnoreArg(),
|
db.network_get_associated_fixed_ips(
|
||||||
mox.IgnoreArg())\
|
mox.IgnoreArg(),
|
||||||
.AndReturn([fixed_ips[1],
|
mox.IgnoreArg()).AndReturn([fixed_ips[1], fixed_ips[2],
|
||||||
fixed_ips[2],
|
fixed_ips[5]])
|
||||||
fixed_ips[5]])
|
db.virtual_interface_get_by_instance(
|
||||||
db.virtual_interface_get_by_instance(mox.IgnoreArg(),
|
mox.IgnoreArg(),
|
||||||
mox.IgnoreArg())\
|
mox.IgnoreArg()).AndReturn([vifs[0], vifs[1], vifs[4]])
|
||||||
.AndReturn([vifs[0],
|
db.virtual_interface_get_by_instance(
|
||||||
vifs[1],
|
mox.IgnoreArg(),
|
||||||
vifs[4]])
|
mox.IgnoreArg()).AndReturn([vifs[2], vifs[3], vifs[5]])
|
||||||
db.virtual_interface_get_by_instance(mox.IgnoreArg(),
|
|
||||||
mox.IgnoreArg())\
|
|
||||||
.AndReturn([vifs[2],
|
|
||||||
vifs[3],
|
|
||||||
vifs[5]])
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
expected_opts = "NW-i00000000-1,3"
|
expected_opts = "NW-i00000000-1,3"
|
||||||
@@ -498,8 +480,8 @@ class LinuxNetworkTestCase(test.TestCase):
|
|||||||
self._test_initialize_gateway(existing, expected)
|
self._test_initialize_gateway(existing, expected)
|
||||||
|
|
||||||
def test_initialize_gateway_resets_route(self):
|
def test_initialize_gateway_resets_route(self):
|
||||||
routes = "0.0.0.0 192.68.0.1 0.0.0.0 " \
|
routes = ("0.0.0.0 192.68.0.1 0.0.0.0 "
|
||||||
"UG 100 0 0 eth0"
|
"UG 100 0 0 eth0")
|
||||||
existing = ("2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> "
|
existing = ("2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> "
|
||||||
" mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000\n"
|
" mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000\n"
|
||||||
" link/ether de:ad:be:ef:be:ef brd ff:ff:ff:ff:ff:ff\n"
|
" link/ether de:ad:be:ef:be:ef brd ff:ff:ff:ff:ff:ff\n"
|
||||||
|
@@ -80,8 +80,9 @@ class LogHandlerTestCase(test.TestCase):
|
|||||||
class NovaFormatterTestCase(test.TestCase):
|
class NovaFormatterTestCase(test.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(NovaFormatterTestCase, self).setUp()
|
super(NovaFormatterTestCase, self).setUp()
|
||||||
self.flags(logging_context_format_string="HAS CONTEXT "\
|
self.flags(logging_context_format_string="HAS CONTEXT "
|
||||||
"[%(request_id)s]: %(message)s",
|
"[%(request_id)s]: "
|
||||||
|
"%(message)s",
|
||||||
logging_default_format_string="NOCTXT: %(message)s",
|
logging_default_format_string="NOCTXT: %(message)s",
|
||||||
logging_debug_format_suffix="--DBG")
|
logging_debug_format_suffix="--DBG")
|
||||||
self.log = log.logging.root
|
self.log = log.logging.root
|
||||||
|
@@ -1171,9 +1171,9 @@ class CommonNetworkTestCase(test.TestCase):
|
|||||||
manager = fake_network.FakeNetworkManager()
|
manager = fake_network.FakeNetworkManager()
|
||||||
fake_context = context.RequestContext('user', 'project')
|
fake_context = context.RequestContext('user', 'project')
|
||||||
self.mox.StubOutWithMock(manager.db, 'network_get_all_by_uuids')
|
self.mox.StubOutWithMock(manager.db, 'network_get_all_by_uuids')
|
||||||
manager.db.network_get_all_by_uuids(mox.IgnoreArg(),
|
manager.db.network_get_all_by_uuids(
|
||||||
mox.IgnoreArg()).\
|
mox.IgnoreArg(),
|
||||||
AndReturn(networks)
|
mox.IgnoreArg()).AndReturn(networks)
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
uuid = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
|
uuid = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
|
||||||
network = manager.get_network(fake_context, uuid)
|
network = manager.get_network(fake_context, uuid)
|
||||||
@@ -1184,8 +1184,7 @@ class CommonNetworkTestCase(test.TestCase):
|
|||||||
fake_context = context.RequestContext('user', 'project')
|
fake_context = context.RequestContext('user', 'project')
|
||||||
self.mox.StubOutWithMock(manager.db, 'network_get_all_by_uuids')
|
self.mox.StubOutWithMock(manager.db, 'network_get_all_by_uuids')
|
||||||
manager.db.network_get_all_by_uuids(mox.IgnoreArg(),
|
manager.db.network_get_all_by_uuids(mox.IgnoreArg(),
|
||||||
mox.IgnoreArg()).\
|
mox.IgnoreArg()).AndReturn([])
|
||||||
AndReturn([])
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
uuid = 'eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee'
|
uuid = 'eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee'
|
||||||
self.assertRaises(exception.NetworkNotFound,
|
self.assertRaises(exception.NetworkNotFound,
|
||||||
@@ -1195,8 +1194,7 @@ class CommonNetworkTestCase(test.TestCase):
|
|||||||
manager = fake_network.FakeNetworkManager()
|
manager = fake_network.FakeNetworkManager()
|
||||||
fake_context = context.RequestContext('user', 'project')
|
fake_context = context.RequestContext('user', 'project')
|
||||||
self.mox.StubOutWithMock(manager.db, 'network_get_all')
|
self.mox.StubOutWithMock(manager.db, 'network_get_all')
|
||||||
manager.db.network_get_all(mox.IgnoreArg()).\
|
manager.db.network_get_all(mox.IgnoreArg()).AndReturn(networks)
|
||||||
AndReturn(networks)
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
output = manager.get_all_networks(fake_context)
|
output = manager.get_all_networks(fake_context)
|
||||||
self.assertEqual(len(networks), 2)
|
self.assertEqual(len(networks), 2)
|
||||||
@@ -1209,9 +1207,9 @@ class CommonNetworkTestCase(test.TestCase):
|
|||||||
manager = fake_network.FakeNetworkManager()
|
manager = fake_network.FakeNetworkManager()
|
||||||
fake_context = context.RequestContext('user', 'project')
|
fake_context = context.RequestContext('user', 'project')
|
||||||
self.mox.StubOutWithMock(manager.db, 'network_get_all_by_uuids')
|
self.mox.StubOutWithMock(manager.db, 'network_get_all_by_uuids')
|
||||||
manager.db.network_get_all_by_uuids(mox.IgnoreArg(),
|
manager.db.network_get_all_by_uuids(
|
||||||
mox.IgnoreArg()).\
|
mox.IgnoreArg(),
|
||||||
AndReturn(networks)
|
mox.IgnoreArg()).AndReturn(networks)
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
uuid = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
|
uuid = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
|
||||||
manager.disassociate_network(fake_context, uuid)
|
manager.disassociate_network(fake_context, uuid)
|
||||||
@@ -1221,8 +1219,7 @@ class CommonNetworkTestCase(test.TestCase):
|
|||||||
fake_context = context.RequestContext('user', 'project')
|
fake_context = context.RequestContext('user', 'project')
|
||||||
self.mox.StubOutWithMock(manager.db, 'network_get_all_by_uuids')
|
self.mox.StubOutWithMock(manager.db, 'network_get_all_by_uuids')
|
||||||
manager.db.network_get_all_by_uuids(mox.IgnoreArg(),
|
manager.db.network_get_all_by_uuids(mox.IgnoreArg(),
|
||||||
mox.IgnoreArg()).\
|
mox.IgnoreArg()).AndReturn([])
|
||||||
AndReturn([])
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
uuid = 'eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee'
|
uuid = 'eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee'
|
||||||
self.assertRaises(exception.NetworkNotFound,
|
self.assertRaises(exception.NetworkNotFound,
|
||||||
|
@@ -465,8 +465,8 @@ class QuantumNovaPortSecurityTestCase(QuantumNovaTestCase):
|
|||||||
self.assertTrue(pairs[0]['mac_address'] == fake_mac)
|
self.assertTrue(pairs[0]['mac_address'] == fake_mac)
|
||||||
self.net_man.q_conn.create_and_attach_port = oldfunc
|
self.net_man.q_conn.create_and_attach_port = oldfunc
|
||||||
return oldfunc(tenant_id, net_id, interface_id, **kwargs)
|
return oldfunc(tenant_id, net_id, interface_id, **kwargs)
|
||||||
self.net_man.q_conn.create_and_attach_port = \
|
_port_attach = _instrumented_create_and_attach_port
|
||||||
_instrumented_create_and_attach_port
|
self.net_man.q_conn.create_and_attach_port = _port_attach
|
||||||
nw_info = self.net_man.allocate_for_instance(ctx,
|
nw_info = self.net_man.allocate_for_instance(ctx,
|
||||||
instance_id=instance_ref['id'], host="",
|
instance_id=instance_ref['id'], host="",
|
||||||
rxtx_factor=3,
|
rxtx_factor=3,
|
||||||
@@ -500,8 +500,8 @@ class QuantumNovaPortSecurityTestCase(QuantumNovaTestCase):
|
|||||||
self.assertTrue(len(pairs) == 0)
|
self.assertTrue(len(pairs) == 0)
|
||||||
self.net_man.q_conn.create_and_attach_port = oldfunc
|
self.net_man.q_conn.create_and_attach_port = oldfunc
|
||||||
return oldfunc(tenant_id, net_id, interface_id, **kwargs)
|
return oldfunc(tenant_id, net_id, interface_id, **kwargs)
|
||||||
self.net_man.q_conn.create_and_attach_port = \
|
_port_attach = _instrumented_create_and_attach_port
|
||||||
_instrumented_create_and_attach_port
|
self.net_man.q_conn.create_and_attach_port = _port_attach
|
||||||
nw_info = self.net_man.allocate_for_instance(ctx,
|
nw_info = self.net_man.allocate_for_instance(ctx,
|
||||||
instance_id=instance_ref['id'], host="",
|
instance_id=instance_ref['id'], host="",
|
||||||
rxtx_factor=3,
|
rxtx_factor=3,
|
||||||
|
@@ -78,8 +78,7 @@ class VolumeTypeTestCase(test.TestCase):
|
|||||||
def test_get_all_volume_types(self):
|
def test_get_all_volume_types(self):
|
||||||
"""Ensures that all volume types can be retrieved"""
|
"""Ensures that all volume types can be retrieved"""
|
||||||
session = get_session()
|
session = get_session()
|
||||||
total_volume_types = session.query(models.VolumeTypes).\
|
total_volume_types = session.query(models.VolumeTypes).count()
|
||||||
count()
|
|
||||||
vol_types = volume_types.get_all_types(self.ctxt)
|
vol_types = volume_types.get_all_types(self.ctxt)
|
||||||
self.assertEqual(total_volume_types, len(vol_types))
|
self.assertEqual(total_volume_types, len(vol_types))
|
||||||
|
|
||||||
|
@@ -513,8 +513,8 @@ class XenAPIVMTestCase(test.TestCase):
|
|||||||
# Change the default host_call_plugin to one that'll return
|
# Change the default host_call_plugin to one that'll return
|
||||||
# a swap disk
|
# a swap disk
|
||||||
orig_func = stubs.FakeSessionForVMTests.host_call_plugin
|
orig_func = stubs.FakeSessionForVMTests.host_call_plugin
|
||||||
stubs.FakeSessionForVMTests.host_call_plugin = \
|
_host_call_plugin = stubs.FakeSessionForVMTests.host_call_plugin_swap
|
||||||
stubs.FakeSessionForVMTests.host_call_plugin_swap
|
stubs.FakeSessionForVMTests.host_call_plugin = _host_call_plugin
|
||||||
# Stubbing out firewall driver as previous stub sets a particular
|
# Stubbing out firewall driver as previous stub sets a particular
|
||||||
# stub for async plugin calls
|
# stub for async plugin calls
|
||||||
stubs.stubout_firewall_driver(self.stubs, self.conn)
|
stubs.stubout_firewall_driver(self.stubs, self.conn)
|
||||||
@@ -954,8 +954,8 @@ class XenAPIMigrateInstance(test.TestCase):
|
|||||||
self.assertEqual(self.fake_vm_start_called, True)
|
self.assertEqual(self.fake_vm_start_called, True)
|
||||||
|
|
||||||
def test_finish_migrate_no_local_storage(self):
|
def test_finish_migrate_no_local_storage(self):
|
||||||
tiny_type_id = \
|
tiny_type = instance_types.get_instance_type_by_name('m1.tiny')
|
||||||
instance_types.get_instance_type_by_name('m1.tiny')['id']
|
tiny_type_id = tiny_type['id']
|
||||||
self.instance_values.update({'instance_type_id': tiny_type_id,
|
self.instance_values.update({'instance_type_id': tiny_type_id,
|
||||||
'root_gb': 0})
|
'root_gb': 0})
|
||||||
instance = db.instance_create(self.context, self.instance_values)
|
instance = db.instance_create(self.context, self.instance_values)
|
||||||
@@ -1550,10 +1550,10 @@ class XenAPIDom0IptablesFirewallTestCase(test.TestCase):
|
|||||||
ipv6_addr_per_network = 1
|
ipv6_addr_per_network = 1
|
||||||
networks_count = 5
|
networks_count = 5
|
||||||
instance_ref = self._create_instance_ref()
|
instance_ref = self._create_instance_ref()
|
||||||
network_info = fake_network.\
|
_get_instance_nw_info = fake_network.fake_get_instance_nw_info
|
||||||
fake_get_instance_nw_info(self.stubs,
|
network_info = _get_instance_nw_info(self.stubs,
|
||||||
networks_count,
|
networks_count,
|
||||||
ipv4_addr_per_network)
|
ipv4_addr_per_network)
|
||||||
ipv4_len = len(self.fw.iptables.ipv4['filter'].rules)
|
ipv4_len = len(self.fw.iptables.ipv4['filter'].rules)
|
||||||
ipv6_len = len(self.fw.iptables.ipv6['filter'].rules)
|
ipv6_len = len(self.fw.iptables.ipv6['filter'].rules)
|
||||||
inst_ipv4, inst_ipv6 = self.fw.instance_rules(instance_ref,
|
inst_ipv4, inst_ipv6 = self.fw.instance_rules(instance_ref,
|
||||||
@@ -1681,8 +1681,8 @@ class XenAPISRSelectionTestCase(test.TestCase):
|
|||||||
helper = vm_utils.VMHelper
|
helper = vm_utils.VMHelper
|
||||||
helper.XenAPI = session.get_imported_xenapi()
|
helper.XenAPI = session.get_imported_xenapi()
|
||||||
host_ref = xenapi_fake.get_all('host')[0]
|
host_ref = xenapi_fake.get_all('host')[0]
|
||||||
local_sr = xenapi_fake.\
|
local_sr = xenapi_fake.create_sr(
|
||||||
create_sr(name_label='Fake Storage',
|
name_label='Fake Storage',
|
||||||
type='lvm',
|
type='lvm',
|
||||||
other_config={'i18n-original-value-name_label':
|
other_config={'i18n-original-value-name_label':
|
||||||
'Local storage',
|
'Local storage',
|
||||||
@@ -1699,11 +1699,10 @@ class XenAPISRSelectionTestCase(test.TestCase):
|
|||||||
helper = vm_utils.VMHelper
|
helper = vm_utils.VMHelper
|
||||||
helper.XenAPI = session.get_imported_xenapi()
|
helper.XenAPI = session.get_imported_xenapi()
|
||||||
host_ref = xenapi_fake.get_all('host')[0]
|
host_ref = xenapi_fake.get_all('host')[0]
|
||||||
local_sr = xenapi_fake.\
|
local_sr = xenapi_fake.create_sr(name_label='Fake Storage',
|
||||||
create_sr(name_label='Fake Storage',
|
type='lvm',
|
||||||
type='lvm',
|
other_config={'my_fake_sr': 'true'},
|
||||||
other_config={'my_fake_sr': 'true'},
|
host_ref=host_ref)
|
||||||
host_ref=host_ref)
|
|
||||||
expected = helper.safe_find_sr(session)
|
expected = helper.safe_find_sr(session)
|
||||||
self.assertEqual(local_sr, expected)
|
self.assertEqual(local_sr, expected)
|
||||||
|
|
||||||
|
@@ -160,14 +160,14 @@ def _make_fake_vdi():
|
|||||||
class FakeSessionForVMTests(fake.SessionBase):
|
class FakeSessionForVMTests(fake.SessionBase):
|
||||||
""" Stubs out a XenAPISession for VM tests """
|
""" Stubs out a XenAPISession for VM tests """
|
||||||
|
|
||||||
_fake_iptables_save_output = \
|
_fake_iptables_save_output = ("# Generated by iptables-save v1.4.10 on "
|
||||||
"# Generated by iptables-save v1.4.10 on Sun Nov 6 22:49:02 2011\n"\
|
"Sun Nov 6 22:49:02 2011\n"
|
||||||
"*filter\n"\
|
"*filter\n"
|
||||||
":INPUT ACCEPT [0:0]\n"\
|
":INPUT ACCEPT [0:0]\n"
|
||||||
":FORWARD ACCEPT [0:0]\n"\
|
":FORWARD ACCEPT [0:0]\n"
|
||||||
":OUTPUT ACCEPT [0:0]\n"\
|
":OUTPUT ACCEPT [0:0]\n"
|
||||||
"COMMIT\n"\
|
"COMMIT\n"
|
||||||
"# Completed on Sun Nov 6 22:49:02 2011\n"
|
"# Completed on Sun Nov 6 22:49:02 2011\n")
|
||||||
|
|
||||||
def __init__(self, uri):
|
def __init__(self, uri):
|
||||||
super(FakeSessionForVMTests, self).__init__(uri)
|
super(FakeSessionForVMTests, self).__init__(uri)
|
||||||
|
Reference in New Issue
Block a user