def setUp(self): self.addCleanup(mock.patch.stopall) patch = mock.patch('novaclient.v1_1.client.Client') self.client = mock.Mock() self.client_cls = patch.start() self.client_cls.return_value = self.client self.nova = nova.Nova(FakeConf)
def take_action(self, parsed_args): uuid = parsed_args.router_image_uuid if uuid: nova_client = nova.Nova(cfg.CONF).client try: nova_client.images.get(uuid) except exceptions.NotFound: self.log.exception( 'could not retrieve custom image %s from Glance:' % uuid) raise return super(RouterRebuild, self).take_action(parsed_args)
def setUp(self): self.addCleanup(mock.patch.stopall) patch = mock.patch('novaclient.v1_1.client.Client') self.client = mock.Mock() self.client_cls = patch.start() self.client_cls.return_value = self.client self.nova = nova.Nova(FakeConf) self.INSTANCE_INFO = nova.InstanceInfo( instance_id='fake_instance_id', name='fake_name', image_uuid='fake_image_id', booting=False, last_boot=datetime.datetime.utcnow(), ports=(fake_ext_port, fake_int_port), management_port=fake_mgt_port, )
def __init__(self, conf, db, workers): self.db = db self.conn = sqlite3.connect(self.db) self.conn.row_factory = RouterRow.from_cursor self.nova = nova_api.Nova(conf) self.neutron = neutron_api.Neutron(conf) self.nova_queue = Queue.Queue() self.save_queue = Queue.Queue() # Create X threads to perform Nova calls and put results into a queue threads = [ threading.Thread( name='fetcher-t%02d' % i, target=self.fetch_router_metadata, ) for i in xrange(workers) ] for t in threads: t.setDaemon(True) t.start()
def __init__(self): self.neutron = quantum.Quantum(cfg.CONF) self.nova_client = nova.Nova(cfg.CONF)