~rohitk/nova/network-unittests

« back to all changes in this revision

Viewing changes to nova/tests/test_xenapi.py

  • Committer: Tarmac
  • Author(s): kevin.mitchell at rackspace
  • Date: 2011-08-02 21:45:57 UTC
  • mfrom: (1309.1.19 glance-private-images)
  • Revision ID: tarmac-20110802214557-yh58mrpp3uuhrinu
Glance has been updated for integration with keystone.  That means that nova needs to forward the user's credentials (the auth token) when it uses the glance API.  This patch, combined with a forth-coming patch for nova_auth_token.py in keystone, establishes that for nova itself and for xenapi; other hypervisors will need to set up the appropriate hooks for their use of glance.

Show diffs side-by-side

added added

removed removed

Lines of Context:
226
226
                               'mac': 'DE:AD:BE:EF:00:00',
227
227
                               'rxtx_cap': 3})]
228
228
            instance = db.instance_create(self.context, values)
229
 
            self.conn.spawn(instance, network_info)
 
229
            self.conn.spawn(self.context, instance, network_info)
230
230
 
231
231
        gt1 = eventlet.spawn(_do_build, 1, self.project_id, self.user_id)
232
232
        gt2 = eventlet.spawn(_do_build, 2, self.project_id, self.user_id)
256
256
        instance = self._create_instance()
257
257
 
258
258
        name = "MySnapshot"
259
 
        self.assertRaises(exception.Error, self.conn.snapshot, instance, name)
 
259
        self.assertRaises(exception.Error, self.conn.snapshot,
 
260
                          self.context, instance, name)
260
261
 
261
262
    def test_instance_snapshot(self):
262
263
        stubs.stubout_instance_snapshot(self.stubs)
263
264
        instance = self._create_instance()
264
265
 
265
266
        name = "MySnapshot"
266
 
        template_vm_ref = self.conn.snapshot(instance, name)
 
267
        template_vm_ref = self.conn.snapshot(self.context, instance, name)
267
268
 
268
269
        def ensure_vm_was_torn_down():
269
270
            vm_labels = []
425
426
                           'label': 'fake',
426
427
                           'mac': 'DE:AD:BE:EF:00:00',
427
428
                           'rxtx_cap': 3})]
428
 
        self.conn.spawn(instance, network_info)
 
429
        self.conn.spawn(self.context, instance, network_info)
429
430
        self.create_vm_record(self.conn, os_type, instance_id)
430
431
        self.check_vm_record(self.conn, check_injection)
431
432
        self.assertTrue(instance.os_type)
629
630
        self.flags(flat_injected=False)
630
631
        instance = self._create_instance()
631
632
        conn = xenapi_conn.get_connection(False)
632
 
        conn.rescue(instance, None, [])
 
633
        conn.rescue(self.context, instance, None, [])
633
634
 
634
635
    def test_unrescue(self):
635
636
        instance = self._create_instance()
666
667
                           'mac': 'DE:AD:BE:EF:00:00',
667
668
                           'rxtx_cap': 3})]
668
669
        if spawn:
669
 
            self.conn.spawn(instance, network_info)
 
670
            self.conn.spawn(self.context, instance, network_info)
670
671
        return instance
671
672
 
672
673
 
776
777
                           'label': 'fake',
777
778
                           'mac': 'DE:AD:BE:EF:00:00',
778
779
                           'rxtx_cap': 3})]
779
 
        conn.finish_migration(instance, dict(base_copy='hurr', cow='durr'),
780
 
                           network_info, resize_instance=True)
 
780
        conn.finish_migration(self.context, instance,
 
781
                              dict(base_copy='hurr', cow='durr'),
 
782
                              network_info, resize_instance=True)
781
783
        self.assertEqual(self.called, True)
782
784
 
783
785
    def test_finish_migrate_no_local_storage(self):
808
810
                           'label': 'fake',
809
811
                           'mac': 'DE:AD:BE:EF:00:00',
810
812
                           'rxtx_cap': 3})]
811
 
        conn.finish_migration(instance, dict(base_copy='hurr', cow='durr'),
812
 
                           network_info, resize_instance=True)
 
813
        conn.finish_migration(self.context, instance,
 
814
                              dict(base_copy='hurr', cow='durr'),
 
815
                              network_info, resize_instance=True)
813
816
 
814
817
    def test_finish_migrate_no_resize_vdi(self):
815
818
        instance = db.instance_create(self.context, self.values)
838
841
                           'rxtx_cap': 3})]
839
842
 
840
843
        # Resize instance would be determined by the compute call
841
 
        conn.finish_migration(instance, dict(base_copy='hurr', cow='durr'),
842
 
                           network_info, resize_instance=False)
 
844
        conn.finish_migration(self.context, instance,
 
845
                              dict(base_copy='hurr', cow='durr'),
 
846
                              network_info, resize_instance=False)
843
847
 
844
848
 
845
849
class XenAPIImageTypeTestCase(test.TestCase):