def setUp(self): super(TestDBArchiveDeletedRows, self).setUp() self.cli = manage.DbCommands() self.output = StringIO() self.useFixture(fixtures.MonkeyPatch('sys.stdout', self.output))
def setUp(self): super(DBCommandsTestCase, self).setUp() self.commands = manage.DbCommands()
def setUp(self): super(NovaManageDBIronicTest, self).setUp() self.commands = manage.DbCommands() self.context = context.RequestContext('fake-user', 'fake-project') self.service1 = objects.Service(context=self.context, host='fake-host1', binary='nova-compute', topic='fake-host1', report_count=1, disabled=False, disabled_reason=None, availability_zone='nova', forced_down=False) self.service1.create() self.service2 = objects.Service(context=self.context, host='fake-host2', binary='nova-compute', topic='fake-host2', report_count=1, disabled=False, disabled_reason=None, availability_zone='nova', forced_down=False) self.service2.create() self.service3 = objects.Service(context=self.context, host='fake-host3', binary='nova-compute', topic='fake-host3', report_count=1, disabled=False, disabled_reason=None, availability_zone='nova', forced_down=False) self.service3.create() self.cn1 = objects.ComputeNode(context=self.context, service_id=self.service1.id, host='fake-host1', hypervisor_type='ironic', vcpus=1, memory_mb=1024, local_gb=10, vcpus_used=1, memory_mb_used=1024, local_gb_used=10, hypervisor_version=0, hypervisor_hostname='fake-node1', cpu_info='{}') self.cn1.create() self.cn2 = objects.ComputeNode(context=self.context, service_id=self.service1.id, host='fake-host1', hypervisor_type='ironic', vcpus=1, memory_mb=1024, local_gb=10, vcpus_used=1, memory_mb_used=1024, local_gb_used=10, hypervisor_version=0, hypervisor_hostname='fake-node2', cpu_info='{}') self.cn2.create() self.cn3 = objects.ComputeNode(context=self.context, service_id=self.service2.id, host='fake-host2', hypervisor_type='ironic', vcpus=1, memory_mb=1024, local_gb=10, vcpus_used=1, memory_mb_used=1024, local_gb_used=10, hypervisor_version=0, hypervisor_hostname='fake-node3', cpu_info='{}') self.cn3.create() self.cn4 = objects.ComputeNode(context=self.context, service_id=self.service3.id, host='fake-host3', hypervisor_type='libvirt', vcpus=1, memory_mb=1024, local_gb=10, vcpus_used=1, memory_mb_used=1024, local_gb_used=10, hypervisor_version=0, hypervisor_hostname='fake-node4', cpu_info='{}') self.cn4.create() self.cn5 = objects.ComputeNode(context=self.context, service_id=self.service2.id, host='fake-host2', hypervisor_type='ironic', vcpus=1, memory_mb=1024, local_gb=10, vcpus_used=1, memory_mb_used=1024, local_gb_used=10, hypervisor_version=0, hypervisor_hostname='fake-node5', cpu_info='{}') self.cn5.create() self.insts = [] for cn in (self.cn1, self.cn2, self.cn3, self.cn4, self.cn4, self.cn5): flavor = objects.Flavor(extra_specs={}) inst = objects.Instance(context=self.context, user_id=self.context.user_id, project_id=self.context.project_id, flavor=flavor, node=cn.hypervisor_hostname) inst.create() self.insts.append(inst) self.ironic_insts = [ i for i in self.insts if i.node != self.cn4.hypervisor_hostname ] self.virt_insts = [ i for i in self.insts if i.node == self.cn4.hypervisor_hostname ]