Ejemplo n.º 1
0
 def setUp(self):
     super(IronicHostManagerTestFilters, self).setUp()
     self.host_manager = ironic_host_manager.IronicHostManager()
     self.fake_hosts = [
         ironic_host_manager.IronicNodeState('fake_host%s' % x, 'fake-node')
         for x in range(1, 5)
     ]
     self.fake_hosts += [
         ironic_host_manager.IronicNodeState('fake_multihost',
                                             'fake-node%s' % x)
         for x in range(1, 5)
     ]
Ejemplo n.º 2
0
    def test_update_from_compute_node(self):
        host = ironic_host_manager.IronicNodeState("fakehost", "fakenode")
        host.update_from_compute_node(self.compute_node)

        self.assertEqual(1024, host.free_ram_mb)
        self.assertEqual(1024, host.total_usable_ram_mb)
        self.assertEqual(10240, host.free_disk_mb)
        self.assertEqual(1, host.vcpus_total)
        self.assertEqual(0, host.vcpus_used)
Ejemplo n.º 3
0
    def test_consume_smaller_instance_from_compute(self):
        host = ironic_host_manager.IronicNodeState("fakehost", "fakenode")
        host.update_from_compute_node(self.compute_node)

        instance = dict(root_gb=5, ephemeral_gb=0, memory_mb=512, vcpus=1)
        host.consume_from_instance(instance)

        self.assertEqual(1, host.vcpus_used)
        self.assertEqual(0, host.free_ram_mb)
        self.assertEqual(0, host.free_disk_mb)
Ejemplo n.º 4
0
 def setUp(self):
     super(IronicHostManagerChangedNodesTestCase, self).setUp()
     self.host_manager = ironic_host_manager.IronicHostManager()
     self.fake_hosts = [
         ironic_host_manager.IronicNodeState('host1', 'node1uuid'),
         ironic_host_manager.IronicNodeState('host2', 'node2uuid'),
         ironic_host_manager.IronicNodeState('host3', 'node3uuid'),
         ironic_host_manager.IronicNodeState('host4', 'node4uuid')
     ]
     self.compute_node = dict(
         id=1,
         local_gb=10,
         memory_mb=1024,
         vcpus=1,
         vcpus_used=0,
         local_gb_used=0,
         memory_mb_used=0,
         updated_at=None,
         cpu_info='baremetal cpu',
         stats=dict(ironic_driver="nova.virt.ironic.driver.IronicDriver",
                    cpu_arch='i386'),
         supported_instances='[["i386", "baremetal", "baremetal"]]',
         free_disk_gb=10,
         free_ram_mb=1024)