Chapter 3. Create Your First VM

You can use OpenStack API or the Dashboard to manage your own IaaS: go to http://10.0.0.10/horizon with demo / password credentials.

 

Procedure 3.1. To create a keypair with the dashboard

  1. Edit the security group "Default" to allow ICMP and SSH.

  2. Create a personal keypair, default_key.

    [Note]Note

    If you see an Error: Unable to create keypair: Key pair 'default_key' already exists, it may have been created using the command-line method below.

  3. Modify the permissions on the keypair file, default_key.

    # chmod 400 default_key
  4. Go to "Instances" and click "Launch Instance" for spawning a new VM.

 

Procedure 3.2. To create a keypair on the command line at the Cloud Controller

  1. Copy the ~/openrc file as ~/demorc and edit the contents to suit the demo user.

  2. Create an SSH keypair and add it to Nova:

    # ssh-keygen -f ~/.ssh/id_rsa -t rsa -N ''
    # nova keypair-add --pub_key ~/.ssh/id_rsa.pub default_key 
    [Note]Note

    If you see an Error: Unable to create keypair: Key pair 'default_key' already exists, it may have been created using the Dashboard method above.

  3. Modify the permissions on the keypair file, default_key.

    # chmod 400 default_key
 

Procedure 3.3. To launch an instance

  1. Edit the "default" Security Group to allow SSH and ICMP:

    # nova secgroup-add-rule default tcp 22 22 0.0.0.0/24
    # nova secgroup-add-rule default icmp -1 -1 0.0.0.0/24
  2. Query the Image Service and note the ID of the image you want to launch:

    # nova image-list
  3. Launch an instance:

    # nova boot --flavor 1 --image <image_id> --key-name default_key my_instance
  4. Wait a few seconds and check the status of your instance:

    # nova show my_instance
  5. If the status is in Error state, check the nova-scheduler log:

    # tail /var/log/nova/nova-scheduler.log 
  6. If the status is in Available state, check the instance's console for booting status:

    # nova console-log my_instance
 

Procedure 3.4. To SSH into the launched instance

After your instance has successfully booted and the console log is showing a log in prompt, you may now SSH into your instance. In order to do this, though, you have to work with the Linux network namespaces on the Network Controller:

  1. Print a list of all namespaces:

    # ip netns

    The output should contain two lines: one beginning with qrouter and the other beginning with qdhcp.

  2. Run SSH inside the qdhcp namespace. This example shows how to SSH to the Fedora image uploaded earlier:

    # ip netns exec qdhcp-c73d082f-d7ed-4b53-ac93-7a6a4c3fa3aa ssh -i default_key fedora@10.5.5.2 
  3. Once you have logged in as the fedora user with the keypair, you can create additional users and log out and back in with those credentials. If you are using the Cirros image, you can login with Cirros default credentials (username: cirros, password cubswin:)) and do not need the keypair.

Log a bug against this page