Ejemplo n.º 1
0
 def test_get_nova_client(self, session=None, shared=True):
     client1 = nova.get_nova_client(session=session, shared=shared)
     client2 = nova.get_nova_client(session=session, shared=shared)
     if shared:
         self.assertIs(client1, client2)
     else:
         self.assertIsNot(client1, client2)
     self.assertIsInstance(client1, nova.CLIENT_CLASSES)
     self.assertIsInstance(client2, nova.CLIENT_CLASSES)
Ejemplo n.º 2
0
 def test_server(self):
     "Test actual server details"
     server = self.stack.resources.server
     self.assertEqual('OS::Nova::Server', server.resource_type)
     # Verify actual server status (is alive, etc.)
     nova_client = nova.get_nova_client()
     server_data = nova_client.servers.get(server.physical_resource_id)
     self.assertEqual(self.stack.server_name, server_data.name)
Ejemplo n.º 3
0
def power_off_overcloud_node(server: nova.ServerType,
                             timeout: tobiko.Seconds = None,
                             sleep_time: tobiko.Seconds = None):
    session = _undercloud.undercloud_keystone_session()
    node = getattr(server, 'OS-EXT-SRV-ATTR:hypervisor_hostname', None)
    if node is None:
        client = nova.get_nova_client(session=session)
        nova.shutoff_server(client=client,
                            server=server,
                            timeout=timeout,
                            sleep_time=sleep_time)
    else:
        client = ironic.get_ironic_client(session=session)
        ironic.power_off_node(client=client,
                              node=node,
                              timeout=timeout,
                              sleep_time=sleep_time)
Ejemplo n.º 4
0
def find_overcloud_node(**params):
    session = undercloud.undercloud_keystone_session()
    client = nova.get_nova_client(session=session)
    return nova.find_server(client=client, **params)
Ejemplo n.º 5
0
def list_overcloud_nodes(**params):
    session = undercloud.undercloud_keystone_session()
    client = nova.get_nova_client(session=session)
    return nova.list_servers(client=client, **params)
Ejemplo n.º 6
0
 def test_undercloud_keystone_session(self):
     session = tripleo.undercloud_keystone_session()
     client = nova.get_nova_client(session=session)
     overcloud_nodes = nova.list_servers(client=client)
     self.assertTrue(overcloud_nodes)
Ejemplo n.º 7
0
 def test_neutron_client_with_client(self):
     default_client = nova.get_nova_client()
     client = nova.nova_client(default_client)
     self.assertIsInstance(client, nova.CLIENT_CLASSES)
     self.assertIs(default_client, client)