def resume_server(self):
     instance = self.get_resource('instance')
     instance_id = instance.id
     LOG.debug("Resuming instance %s. Current status: %s",
               instance_id, instance.status)
     instance.resume()
     test.status_timeout(self.compute_client.servers, instance_id, 'ACTIVE')
Example #2
0
 def _create_server(self, client, network, name, key_name, security_groups):
     flavor_id = self.config.compute.flavor_ref
     base_image_id = self.config.compute.image_ref
     create_kwargs = {
         'nics': [
             {
                 'net-id': network.id
             },
         ],
         'key_name': key_name,
         'security_groups': security_groups,
     }
     server = client.servers.create(name, base_image_id, flavor_id,
                                    **create_kwargs)
     try:
         self.assertEqual(server.name, name)
         self.set_resource(name, server)
     except AttributeError:
         self.fail("Server not successfully created.")
     test.status_timeout(client.servers, server.id, 'ACTIVE')
     # The instance retrieved on creation is missing network
     # details, necessitating retrieval after it becomes active to
     # ensure correct details.
     server = client.servers.get(server.id)
     self.set_resource(name, server)
     return server
 def pause_server(self):
     instance = self.get_resource('instance')
     instance_id = instance.id
     LOG.debug("Pausing instance %s. Current status: %s",
               instance_id, instance.status)
     instance.pause()
     test.status_timeout(self.compute_client.servers, instance_id, 'PAUSED')
Example #4
0
 def pause_server(self):
     instance = self.get_resource('instance')
     instance_id = instance.id
     LOG.debug("Pausing instance %s. Current status: %s", instance_id,
               instance.status)
     instance.pause()
     test.status_timeout(self.compute_client.servers, instance_id, 'PAUSED')
Example #5
0
 def resume_server(self):
     instance = self.get_resource('instance')
     instance_id = instance.id
     LOG.debug("Resuming instance %s. Current status: %s", instance_id,
               instance.status)
     instance.resume()
     test.status_timeout(self.compute_client.servers, instance_id, 'ACTIVE')
 def suspend_server(self):
     instance = self.get_resource('instance')
     instance_id = instance.id
     LOG.debug("Suspending instance %s. Current status: %s",
               instance_id, instance.status)
     instance.suspend()
     test.status_timeout(self.compute_client.servers,
                         instance_id, 'SUSPENDED')
Example #7
0
 def suspend_server(self):
     instance = self.get_resource('instance')
     instance_id = instance.id
     LOG.debug("Suspending instance %s. Current status: %s", instance_id,
               instance.status)
     instance.suspend()
     test.status_timeout(self.compute_client.servers, instance_id,
                         'SUSPENDED')
    def test_resize_server_confirm(self):
        # We create an instance for use in this test
        i_name = rand_name('instance')
        flavor_id = self.config.compute.flavor_ref
        base_image_id = self.config.compute.image_ref
        self.instance = self.compute_client.servers.create(
                i_name, base_image_id, flavor_id)
        try:
            self.assertEqual(self.instance.name, i_name)
            self.set_resource('instance', self.instance)
        except AttributeError:
            self.fail("Instance not successfully created.")

        self.assertEqual(self.instance.status, 'BUILD')
        instance_id = self.get_resource('instance').id
        test.status_timeout(self.compute_client.servers, instance_id, 'ACTIVE')
        instance = self.get_resource('instance')
        instance_id = instance.id
        resize_flavor = self.config.compute.flavor_ref_alt
        LOG.debug("Resizing instance %s from flavor %s to flavor %s",
                  instance.id, instance.flavor, resize_flavor)
        instance.resize(resize_flavor)
        test.status_timeout(self.compute_client.servers, instance_id,
                            'VERIFY_RESIZE')

        LOG.debug("Confirming resize of instance %s", instance_id)
        instance.confirm_resize()
        test.status_timeout(self.compute_client.servers, instance_id, 'ACTIVE')
Example #9
0
    def test_resize_server_confirm(self):
        # We create an instance for use in this test
        i_name = rand_name('instance')
        flavor_id = self.config.compute.flavor_ref
        base_image_id = self.config.compute.image_ref
        self.instance = self.compute_client.servers.create(
            i_name, base_image_id, flavor_id)
        try:
            self.assertEqual(self.instance.name, i_name)
            self.set_resource('instance', self.instance)
        except AttributeError:
            self.fail("Instance not successfully created.")

        self.assertEqual(self.instance.status, 'BUILD')
        instance_id = self.get_resource('instance').id
        test.status_timeout(self.compute_client.servers, instance_id, 'ACTIVE')
        instance = self.get_resource('instance')
        instance_id = instance.id
        resize_flavor = self.config.compute.flavor_ref_alt
        LOG.debug("Resizing instance %s from flavor %s to flavor %s",
                  instance.id, instance.flavor, resize_flavor)
        instance.resize(resize_flavor)
        test.status_timeout(self.compute_client.servers, instance_id,
                            'VERIFY_RESIZE')

        LOG.debug("Confirming resize of instance %s", instance_id)
        instance.confirm_resize()
        test.status_timeout(self.compute_client.servers, instance_id, 'ACTIVE')
Example #10
0
 def _create_server(self, client, network, name, key_name, security_groups):
     flavor_id = self.config.compute.flavor_ref
     base_image_id = self.config.compute.image_ref
     create_kwargs = {
         'nics': [
             {'net-id': network.id},
         ],
         'key_name': key_name,
         'security_groups': security_groups,
     }
     server = client.servers.create(name, base_image_id, flavor_id,
                                    **create_kwargs)
     try:
         self.assertEqual(server.name, name)
         self.set_resource(name, server)
     except AttributeError:
         self.fail("Server not successfully created.")
     test.status_timeout(client.servers, server.id, 'ACTIVE')
     # The instance retrieved on creation is missing network
     # details, necessitating retrieval after it becomes active to
     # ensure correct details.
     server = client.servers.get(server.id)
     self.set_resource(name, server)
     return server
 def wait_on_active(self):
     instance_id = self.get_resource('instance').id
     test.status_timeout(self.compute_client.servers, instance_id, 'ACTIVE')
Example #12
0
 def wait_on_active(self):
     instance_id = self.get_resource('instance').id
     test.status_timeout(self.compute_client.servers, instance_id, 'ACTIVE')