~rlane/nova/lp773690

« back to all changes in this revision

Viewing changes to nova/tests/test_virt.py

  • Committer: rlane at wikimedia
  • Date: 2011-01-27 12:17:43 UTC
  • mfrom: (382.1.252 nova)
  • Revision ID: rlane@wikimedia.org-20110127121743-imwx28difrjvnzrq
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
221
221
        self.project = self.manager.create_project('fake', 'fake', 'fake')
222
222
        self.context = context.RequestContext('fake', 'fake')
223
223
        self.network = utils.import_object(FLAGS.network_manager)
224
 
        self.fw = libvirt_conn.IptablesFirewallDriver()
 
224
 
 
225
        class FakeLibvirtConnection(object):
 
226
            pass
 
227
        self.fake_libvirt_connection = FakeLibvirtConnection()
 
228
        self.fw = libvirt_conn.IptablesFirewallDriver(
 
229
                      get_connection=lambda: self.fake_libvirt_connection)
225
230
 
226
231
    def tearDown(self):
227
232
        self.manager.delete_project(self.project)
474
479
                                          'project_id': 'fake'})
475
480
        inst_id = instance_ref['id']
476
481
 
 
482
        ip = '10.11.12.13'
 
483
 
 
484
        network_ref = db.project_get_network(self.context,
 
485
                                             'fake')
 
486
 
 
487
        fixed_ip = {'address': ip,
 
488
                    'network_id': network_ref['id']}
 
489
 
 
490
        admin_ctxt = context.get_admin_context()
 
491
        db.fixed_ip_create(admin_ctxt, fixed_ip)
 
492
        db.fixed_ip_update(admin_ctxt, ip, {'allocated': True,
 
493
                                            'instance_id': instance_ref['id']})
 
494
 
477
495
        def _ensure_all_called():
478
496
            instance_filter = 'nova-instance-%s' % instance_ref['name']
479
497
            secgroup_filter = 'nova-secgroup-%s' % self.security_group['id']