~ubuntu-branches/ubuntu/quantal/nova/quantal-proposed

« back to all changes in this revision

Viewing changes to nova/tests/test_virt_drivers.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-08-16 14:04:11 UTC
  • mto: This revision was merged to the branch mainline in revision 84.
  • Revision ID: package-import@ubuntu.com-20120816140411-0mr4n241wmk30t9l
Tags: upstream-2012.2~f3
ImportĀ upstreamĀ versionĀ 2012.2~f3

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
        self.flags(firewall_driver=nova.virt.libvirt.firewall.drivers[0],
80
80
                   rescue_image_id="2",
81
81
                   rescue_kernel_id="3",
82
 
                   rescue_ramdisk_id=None)
 
82
                   rescue_ramdisk_id=None,
 
83
                   libvirt_snapshots_directory='./')
83
84
 
84
85
        def fake_extend(image, size):
85
86
            pass
86
87
 
 
88
        def fake_migrateToURI(*a):
 
89
            pass
 
90
 
 
91
        def fake_make_drive(_self, _path):
 
92
            pass
 
93
 
87
94
        self.stubs.Set(nova.virt.libvirt.driver.disk,
88
95
                       'extend', fake_extend)
89
96
 
 
97
        # Like the existing fakelibvirt.migrateToURI, do nothing,
 
98
        # but don't fail for these tests.
 
99
        self.stubs.Set(nova.virt.libvirt.driver.libvirt.Domain,
 
100
                       'migrateToURI', fake_migrateToURI)
 
101
 
 
102
        # We can't actually make a config drive v2 because ensure_tree has
 
103
        # been faked out
 
104
        self.stubs.Set(nova.virt.configdrive.ConfigDriveBuilder,
 
105
                       'make_drive', fake_make_drive)
 
106
 
90
107
    def _teardown_fakelibvirt(self):
91
108
        # Restore libvirt
92
109
        import nova.virt.libvirt.driver
189
206
        instance_ref = test_utils.get_test_instance()
190
207
        network_info = test_utils.get_test_network_info()
191
208
        image_info = test_utils.get_test_image_info(None, instance_ref)
192
 
        self.connection.spawn(self.ctxt, instance=instance_ref,
193
 
                              image_meta=image_info,
194
 
                              network_info=network_info)
 
209
        self.connection.spawn(self.ctxt, instance_ref, image_info,
 
210
                              [], 'herp', network_info=network_info)
195
211
        return instance_ref, network_info
196
212
 
197
213
    @catch_notimplementederror
203
219
        self.connection.list_instances()
204
220
 
205
221
    @catch_notimplementederror
206
 
    def test_list_instances_detail(self):
207
 
        self.connection.list_instances_detail()
208
 
 
209
 
    @catch_notimplementederror
210
222
    def test_spawn(self):
211
223
        instance_ref, network_info = self._get_running_instance()
212
224
        domains = self.connection.list_instances()
213
225
        self.assertIn(instance_ref['name'], domains)
214
226
 
215
 
        domains_details = self.connection.list_instances_detail()
216
 
        self.assertIn(instance_ref['name'], [i.name for i in domains_details])
 
227
        num_instances = self.connection.get_num_instances()
 
228
        self.assertEqual(1, num_instances)
217
229
 
218
230
    @catch_notimplementederror
219
231
    def test_snapshot_not_running(self):
258
270
                                    base64.b64encode('testcontents'))
259
271
 
260
272
    @catch_notimplementederror
261
 
    def test_agent_update(self):
262
 
        instance_ref, network_info = self._get_running_instance()
263
 
        self.connection.agent_update(instance_ref, 'http://www.openstack.org/',
264
 
                                     'd41d8cd98f00b204e9800998ecf8427e')
265
 
 
266
 
    @catch_notimplementederror
267
273
    def test_resume_state_on_host_boot(self):
268
274
        instance_ref, network_info = self._get_running_instance()
269
275
        self.connection.resume_state_on_host_boot(self.ctxt, instance_ref,
272
278
    @catch_notimplementederror
273
279
    def test_rescue(self):
274
280
        instance_ref, network_info = self._get_running_instance()
275
 
        self.connection.rescue(self.ctxt, instance_ref, network_info, None)
 
281
        self.connection.rescue(self.ctxt, instance_ref, network_info, None, '')
276
282
 
277
283
    @catch_notimplementederror
278
284
    def test_unrescue_unrescued_instance(self):
282
288
    @catch_notimplementederror
283
289
    def test_unrescue_rescued_instance(self):
284
290
        instance_ref, network_info = self._get_running_instance()
285
 
        self.connection.rescue(self.ctxt, instance_ref, network_info, None)
 
291
        self.connection.rescue(self.ctxt, instance_ref, network_info, None, '')
286
292
        self.connection.unrescue(instance_ref, network_info)
287
293
 
288
294
    @catch_notimplementederror
401
407
    @catch_notimplementederror
402
408
    def test_get_diagnostics(self):
403
409
        instance_ref, network_info = self._get_running_instance()
404
 
        self.connection.get_diagnostics(instance_ref['name'])
 
410
        self.connection.get_diagnostics(instance_ref)
405
411
 
406
412
    @catch_notimplementederror
407
413
    def test_block_stats(self):
455
461
        self.connection.refresh_provider_fw_rules()
456
462
 
457
463
    @catch_notimplementederror
458
 
    def test_compare_cpu(self):
459
 
        cpu_info = '''{ "topology": {
460
 
                               "sockets": 1,
461
 
                               "cores": 2,
462
 
                               "threads": 1 },
463
 
                        "features": [
464
 
                            "xtpr",
465
 
                            "tm2",
466
 
                            "est",
467
 
                            "vmx",
468
 
                            "ds_cpl",
469
 
                            "monitor",
470
 
                            "pbe",
471
 
                            "tm",
472
 
                            "ht",
473
 
                            "ss",
474
 
                            "acpi",
475
 
                            "ds",
476
 
                            "vme"],
477
 
                        "arch": "x86_64",
478
 
                        "model": "Penryn",
479
 
                        "vendor": "Intel" }'''
480
 
 
481
 
        self.connection.compare_cpu(cpu_info)
482
 
 
483
 
    @catch_notimplementederror
484
464
    def test_ensure_filtering_for_instance(self):
485
465
        instance_ref = test_utils.get_test_instance()
486
466
        network_info = test_utils.get_test_network_info()
497
477
    def test_live_migration(self):
498
478
        instance_ref, network_info = self._get_running_instance()
499
479
        self.connection.live_migration(self.ctxt, instance_ref, 'otherhost',
500
 
                                       None, None)
 
480
                                       lambda *a: None, lambda *a: None)
501
481
 
502
482
    @catch_notimplementederror
503
483
    def _check_host_status_fields(self, host_status):
521
501
        self.connection.set_host_enabled('a useless argument?', True)
522
502
 
523
503
    @catch_notimplementederror
 
504
    def test_get_host_uptime(self):
 
505
        self.connection.get_host_uptime('a useless argument?')
 
506
 
 
507
    @catch_notimplementederror
524
508
    def test_host_power_action_reboot(self):
525
509
        self.connection.host_power_action('a useless argument?', 'reboot')
526
510