Fixing a broken instance deployment

When deploying an instance, sometimes an error occurs and deployment fails. If this happens with a new deployment, usually it is simplest to delete the failed instance and deploy again. However, if you must fix the broken instance, there is a nova rescue command that will help you. This section explains how to use the nova rescue command to fix broken instances.

Getting ready

If you are using the Vagrant environment, these steps are to be carried out on our network node under the user that has access to our OpenStack Compute credentials (as created in the Installation of command-line tools on network recipe).

Ensure that you are logged onto the network node and that it has Internet access to allow us to install the required packages in our environment for running OVS and Neutron. If you created this node with Vagrant, you can execute the following command:

vagrant ssh network

How to do it...

From our network machine, list the running instances to identify the instance you want to fix using the following steps:

  1. We first identify the instance that we want to fix by issuing the following command from our client:
    nova list
    
  2. To set instance in a rescue mode, we can either specify the name of our instance or use the UUID:
    nova rescue myInstance
    nova rescue 6f41bb91-0f4f-41e5-90c3-7ee1f9c39e5a
    

    The preceding commands will give you a temporary root password:

    +-----------+--------------+
    | Property  | Value        |
    +-----------+--------------+
    | adminPass | VMHm2BEyCnKa |
    +-----------+--------------+
    

    However, if the instance was created with a nova key, you will still need to use the key rather than the password to log in. The instance will be set in the RESCUE status now.

  3. To log in to the node, first get a list of network spaces:
    ip netns
    

    The preceding command gives the following example output:

    qdhcp-0375e772-b021-425c-bc17-5a3263247fb8
    

    Connect to the instance using the following commands:

    sudo ip netns exec 
       qdhcp-0375e772-b021-425c-bc17-5a3263247fb8 
       ssh -i demokey [email protected]
    

    This will allow you to repair the instance.

  4. After repairing the instance, restart the server from the normal boot disk again:
    nova unrescue myInstance
    

How it works...

We identify a server that needs rescuing via the nova list command. Then, we use either the server name or the server ID to set the server in rescue mode using the nova rescue command. This reboots the server into a rescue mode, which starts the machine from the initial image and attaches the current boot disk as a secondary. After repairing the server, we need to set it back to ACTIVE status and reboot by using the nova unrescue command.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.24.60