@@ -9050,12 +9050,11 @@ def sleep(self, t):
9050
9050
self.assertEqual(29, fake_timer.counter, "Didn't wait the expected "
9051
9051
"amount of time")
9052
9052
9053
- @mock.patch.object(objects.Service, 'get_by_compute_host')
9054
9053
@mock.patch.object(libvirt_driver.LibvirtDriver,
9055
9054
'_create_shared_storage_test_file')
9056
9055
@mock.patch.object(fakelibvirt.Connection, 'compareCPU')
9057
9056
def test_check_can_live_migrate_dest_all_pass_with_block_migration(
9058
- self, mock_cpu, mock_test_file, mock_svc ):
9057
+ self, mock_cpu, mock_test_file):
9059
9058
instance_ref = objects.Instance(**self.test_instance)
9060
9059
instance_ref.vcpu_model = test_vcpu_model.fake_vcpumodel
9061
9060
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
@@ -9087,12 +9086,11 @@ def test_check_can_live_migrate_dest_all_pass_with_block_migration(
9087
9086
'serial_listen_addr': None},
9088
9087
return_value.obj_to_primitive()['nova_object.data'])
9089
9088
9090
- @mock.patch.object(objects.Service, 'get_by_compute_host')
9091
9089
@mock.patch.object(libvirt_driver.LibvirtDriver,
9092
9090
'_create_shared_storage_test_file')
9093
9091
@mock.patch.object(fakelibvirt.Connection, 'compareCPU')
9094
9092
def test_check_can_live_migrate_dest_all_pass_with_over_commit(
9095
- self, mock_cpu, mock_test_file, mock_svc ):
9093
+ self, mock_cpu, mock_test_file):
9096
9094
instance_ref = objects.Instance(**self.test_instance)
9097
9095
instance_ref.vcpu_model = test_vcpu_model.fake_vcpumodel
9098
9096
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
@@ -9125,12 +9123,11 @@ def test_check_can_live_migrate_dest_all_pass_with_over_commit(
9125
9123
'serial_listen_addr': None},
9126
9124
return_value.obj_to_primitive()['nova_object.data'])
9127
9125
9128
- @mock.patch.object(objects.Service, 'get_by_compute_host')
9129
9126
@mock.patch.object(libvirt_driver.LibvirtDriver,
9130
9127
'_create_shared_storage_test_file')
9131
9128
@mock.patch.object(fakelibvirt.Connection, 'compareCPU')
9132
9129
def test_check_can_live_migrate_dest_all_pass_no_block_migration(
9133
- self, mock_cpu, mock_test_file, mock_svc ):
9130
+ self, mock_cpu, mock_test_file):
9134
9131
instance_ref = objects.Instance(**self.test_instance)
9135
9132
instance_ref.vcpu_model = test_vcpu_model.fake_vcpumodel
9136
9133
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
@@ -9160,13 +9157,12 @@ def test_check_can_live_migrate_dest_all_pass_no_block_migration(
9160
9157
'serial_listen_addr': None},
9161
9158
return_value.obj_to_primitive()['nova_object.data'])
9162
9159
9163
- @mock.patch.object(objects.Service, 'get_by_compute_host')
9164
9160
@mock.patch.object(libvirt_driver.LibvirtDriver,
9165
9161
'_create_shared_storage_test_file',
9166
9162
return_value='fake')
9167
9163
@mock.patch.object(fakelibvirt.Connection, 'compareCPU')
9168
9164
def test_check_can_live_migrate_dest_fills_listen_addrs(
9169
- self, mock_cpu, mock_test_file, mock_svc ):
9165
+ self, mock_cpu, mock_test_file):
9170
9166
# Tests that check_can_live_migrate_destination returns the listen
9171
9167
# addresses required by check_can_live_migrate_source.
9172
9168
self.flags(server_listen='192.0.2.12', group='vnc')
@@ -9189,14 +9185,13 @@ def test_check_can_live_migrate_dest_fills_listen_addrs(
9189
9185
self.assertEqual('203.0.113.56',
9190
9186
str(result.serial_listen_addr))
9191
9187
9192
- @mock.patch.object(objects.Service, 'get_by_compute_host')
9193
9188
@mock.patch.object(libvirt_driver.LibvirtDriver,
9194
9189
'_create_shared_storage_test_file',
9195
9190
return_value='fake')
9196
9191
@mock.patch.object(fakelibvirt.Connection, 'compareCPU',
9197
9192
return_value=1)
9198
9193
def test_check_can_live_migrate_dest_ensure_serial_adds_not_set(
9199
- self, mock_cpu, mock_test_file, mock_svc ):
9194
+ self, mock_cpu, mock_test_file):
9200
9195
self.flags(proxyclient_address='127.0.0.1', group='serial_console')
9201
9196
self.flags(enabled=False, group='serial_console')
9202
9197
instance_ref = objects.Instance(**self.test_instance)
@@ -9237,12 +9232,11 @@ def test_check_can_live_migrate_guest_cpu_none_model(
9237
9232
'serial_listen_addr': None},
9238
9233
result.obj_to_primitive()['nova_object.data'])
9239
9234
9240
- @mock.patch.object(objects.Service, 'get_by_compute_host')
9241
9235
@mock.patch.object(libvirt_driver.LibvirtDriver,
9242
9236
'_create_shared_storage_test_file')
9243
9237
@mock.patch.object(fakelibvirt.Connection, 'compareCPU')
9244
9238
def test_check_can_live_migrate_dest_no_instance_cpu_info(
9245
- self, mock_cpu, mock_test_file, mock_svc ):
9239
+ self, mock_cpu, mock_test_file):
9246
9240
instance_ref = objects.Instance(**self.test_instance)
9247
9241
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
9248
9242
compute_info = {'cpu_info': jsonutils.dumps({
@@ -9276,12 +9270,11 @@ def test_check_can_live_migrate_dest_no_instance_cpu_info(
9276
9270
'serial_listen_addr': None},
9277
9271
return_value.obj_to_primitive()['nova_object.data'])
9278
9272
9279
- @mock.patch.object(objects.Service, 'get_by_compute_host')
9280
9273
@mock.patch.object(libvirt_driver.LibvirtDriver,
9281
9274
'_create_shared_storage_test_file')
9282
9275
@mock.patch.object(fakelibvirt.Connection, 'compareCPU')
9283
9276
def test_check_can_live_migrate_dest_file_backed(
9284
- self, mock_cpu, mock_test_file, mock_svc ):
9277
+ self, mock_cpu, mock_test_file):
9285
9278
9286
9279
self.flags(file_backed_memory=1024, group='libvirt')
9287
9280
@@ -9295,10 +9288,6 @@ def test_check_can_live_migrate_dest_file_backed(
9295
9288
9296
9289
filename = "file"
9297
9290
9298
- svc = objects.Service()
9299
- svc.version = 32
9300
- mock_svc.return_value = svc
9301
-
9302
9291
# _check_cpu_match
9303
9292
mock_cpu.return_value = 1
9304
9293
# mounted_on_same_shared_storage
@@ -9311,13 +9300,12 @@ def test_check_can_live_migrate_dest_file_backed(
9311
9300
9312
9301
@mock.patch.object(fakelibvirt.Connection, 'getVersion')
9313
9302
@mock.patch.object(fakelibvirt.Connection, 'getLibVersion')
9314
- @mock.patch.object(objects.Service, 'get_by_compute_host')
9315
9303
@mock.patch.object(libvirt_driver.LibvirtDriver,
9316
9304
'_create_shared_storage_test_file')
9317
9305
@mock.patch.object(fakelibvirt.Connection, 'compareCPU')
9318
9306
def _test_check_can_live_migrate_dest_file_backed_discard(
9319
9307
self, libvirt_version, qemu_version, mock_cpu, mock_test_file,
9320
- mock_svc, mock_lib_version, mock_version):
9308
+ mock_lib_version, mock_version):
9321
9309
9322
9310
self.flags(file_backed_memory=1024, group='libvirt')
9323
9311
@@ -9334,10 +9322,6 @@ def _test_check_can_live_migrate_dest_file_backed_discard(
9334
9322
9335
9323
filename = "file"
9336
9324
9337
- svc = objects.Service()
9338
- svc.version = 32
9339
- mock_svc.return_value = svc
9340
-
9341
9325
# _check_cpu_match
9342
9326
mock_cpu.return_value = 1
9343
9327
# mounted_on_same_shared_storage
@@ -9384,19 +9368,14 @@ def test_check_can_live_migrate_dest_file_backed_discard_bad_qemu(self):
9384
9368
self.assertTrue(data.dst_wants_file_backed_memory)
9385
9369
self.assertFalse(data.file_backed_memory_discard)
9386
9370
9387
- @mock.patch.object(objects.Service, 'get_by_compute_host')
9388
9371
@mock.patch.object(fakelibvirt.Connection, 'compareCPU')
9389
9372
def test_check_can_live_migrate_dest_incompatible_cpu_raises(
9390
- self, mock_cpu, mock_svc ):
9373
+ self, mock_cpu):
9391
9374
instance_ref = objects.Instance(**self.test_instance)
9392
9375
instance_ref.vcpu_model = test_vcpu_model.fake_vcpumodel
9393
9376
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
9394
9377
compute_info = {'cpu_info': 'asdf', 'disk_available_least': 1}
9395
9378
9396
- svc = objects.Service(host="old")
9397
- svc.version = 32
9398
- mock_svc.return_value = svc
9399
-
9400
9379
mock_cpu.side_effect = exception.InvalidCPUInfo(reason='foo')
9401
9380
self.assertRaises(exception.InvalidCPUInfo,
9402
9381
drvr.check_can_live_migrate_destination,
0 commit comments