Step 6: Your first VM

Once Nova works as desired, starting your first own cloud VM is easy. As we're using a Ubuntu image for this example which allows for SSH-key based login only, we first need to store a public SSH key for our admin user in the OpenStack database. Upload the file containing your SSH public key onto the server (i'll assume the file is called id_dsa.pub) and do this:

nova keypair-add --pub_key id_rsa.pub key1
This will add the key to OpenStack Nova and store it with the name "key1". The only thing left to do after this is firing up your VM. Find out what ID your Ubuntu image has, you can do this with:
nova image-list
When starting a VM, you also need to define the flavor it is supposed to use. Flavors are pre-defined hardware schemes in OpenStack with which you can define what resources your newly created VM has. OpenStack comes with five pre-defined flavors; you can get an overview over the existing flavors with
nova flavor-list
Flavors are referenced by their ID, not by  their name. That's important for the actual command to execute to start your VM. That command's syntax basically is this:
nova boot --flavor ID --image Image-UUID --key_name key-name vm_name
So let's assume you want to start a VM with the m1.tiny flavor, which has the ID 1. Let's further assume that your image's UUID in Glance is 9bab7ce7-7523-4d37-831f-c18fbc5cb543 and that you want to use the SSH key key1. Last but nut least, you want your new VM to have the name superfrobnicator. Here's the command you would need to start that particular VM:
nova boot --flavor 1 --image 9bab7ce7-7523-4d37-831f-c18fbc5cb543 --key_name key1 superfrobnicator
After hitting the Enter key, Nova will show you a summary with all important details concerning the new VM. After some seconds, issue the command
nova show superfrobnicator
In the line with the private_network keyword, you'll see the IP address that Nova has assigned this particular VM. As soon as the VMs status is ACTIVE, you should be able to log into that VM by issuing
ssh -i Private-Key ubuntu@IP
Of course Private-Key needs to be replaced with the path to your SSH private key and IP needs to be replaced with the VMs actual IP. If you're using SSH agent forwarding, you can leave out the "-i"-parameter altogether. 

Comments

cannot ssh to VM

Hi Martin,

Many thanks for writing the article above Ive found it most useful when trying to set up my first cloud instance however i appear to be stumbling at one of the final hurdles, it appears that when i ssh in from the cloud (server) itself then I end up in the designated virtual instance however when i ssh in from any other machine on the network (public) i am dropped into a shell on the host server itself. I have tried a few DNAT rules but these dont have any affect, I was wondering if you could point me in the right direction.

I would be happy to supply you with any other information you require

Mat

 

Well, you gotta inject the

Well, you gotta inject the public key from the system you want to login with passwordlessly (is that w word?). I found once you get in from the server, you can change sshd_config to listen on whatever IP you want, and go from there. Keep in mind that these VMs that you spinup in this step only have a 192.168.22.X IP, so you won't be able to reach them from an outside network without setting up additional interfaces on the public side. 

Unable to start/boot VM

Hello,

I tried starting/boot the VM following your tutorial and firing the command mentioned in this step 6. But the command

nova show superfrobnicator

gives me error indicating VM is not started/booted. You can view the output of above command visiting the following url.

http://destiny4u.co.cc/screenshot.png

The above screenshot also shows the command that is used to start/boot the VM.

Please help...

Regards,

Prashant

Confusion related to number of machines to setup.

Hello,In this article, do we need more then one machine???If we need to setup more then one machine. What will be the steps I need to follow on individual machines?Regards,Prashant

Nobody replying

Hello?????????

Is there someone to help me???

Prashant

--os_username required

Entering "nova list", or any "nova" command gives me a the following error, "ERROR: You must provide a username via either --os_username or env[OS_USERNAME]". When I specify an OS username, I get a similar error, except with a request for "--os_password" and finally "--os_tenant_name".

Any ideas?

RE: --os_username required

Please disregard my note.  Somehow I overlooked the step to set environment variables and download an image.

some problems on booting vms

Hello there ! I have the error below trying to conect to my VM !

ssh: connect to host 192.168.22.34 port 22: Connection refused

Here's the sumary of startup:

 nova show sd_teste+-------------------------------------+---------------------------------------------------------------------------------+|               Property              |                                      Value                                      |+-------------------------------------+---------------------------------------------------------------------------------+| OS-DCF:diskConfig                   | MANUAL                                                                          || OS-EXT-SRV-ATTR:host                | hgb-laptop                                                                      || OS-EXT-SRV-ATTR:hypervisor_hostname | None                                                                            || OS-EXT-SRV-ATTR:instance_name       | instance-00000001                                                               || OS-EXT-STS:power_state              | 0                                                                               || OS-EXT-STS:task_state               | networking                                                                      || OS-EXT-STS:vm_state                 | error                                                                           || accessIPv4                          |                                                                                 || accessIPv6                          |                                                                                 || config_drive                        |                                                                                 || created                             | 2012-05-30T16:35:46Z                                                            || fault                               | {u'message': u'RemoteError', u'code': 500, u'created': u'2012-05-30T16:35:49Z'} || flavor                              | m1.tiny                                                                         || hostId                              | 929fbde2a091224f1a80b3ef4bee483d38afa12c91deac3f0f7b75f8                        || id                                  | 02205163-0416-443d-ab79-22a867d32b9e                                            || image                               | Ubuntu 11.10 cloudimg amd64                                                     || key_name                            | key1                                                                            || metadata                            | {}                                                                              || name                                | sd_teste                                                                        || private network                     | 192.168.22.34                                                                   || status                              | ERROR                                                                           || tenant_id                           | da3c4155c4a54b9297b2e4f3520c6fe5                                                || updated                             | 2012-05-30T16:35:49Z                                                            || user_id                             | 2cef0a349ab84f5899d91df46aa6d3bd                                                |+-------------------------------------+---------------------------------------------------------------------------------+

Anyone can help me ?

I had to edit the

I had to edit the /etc/nova/nova-compute.conf file from kvm to qemu

Please forward information

Could you possibly forward any information relevant about this (network config etc. pp. and the above message in normal format) to martin@hastexo.com pretty please? :)

If you solved hgb's problem,

If you solved hgb's problem, would you martin please let us know about that as well? Thanks!