Custom Search

SUBSCRIBE

SUBSCRIBE : 300 + Free Video Tutorials Programming (Python, golang, Julia), DevOps

Thursday, July 10, 2014

OpenStack glance Upload new qcow2 image and create Virtual Machine via CLI

0)
Download Image (qcow2)
http://cloud-images.ubuntu.com/precise/current/
http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img

* Please do this as "demo" user
* If you are using devstack, goto devstack folder and run "#source openrc demo demo" to execute CLI commands as demo user.



1)
Get help
#glance help image-create

2)
Upload and create a qcow2 image
#glance image-create --progress --name ubuntu12.04-server --disk-format qcow2 --container-format bare --is-public True --file precise-server-cloudimg-amd64-disk1.img

3)
List all images
#glance image-list

4)
Delete Image
#glance image-delete e6f5c8b9-6944-4dc8-8f05-5021b72a62ed

5)
* Add rules (ICMP,SSH,--) to "Default" security group to Ping or SSH to the instance
* Create Keypair and download Private key, Public key will automatically pushed to VM by OpenStack.
#nova keypair-add kp1 > my-private-key.txt
#chmod 700 my-private-key.txt

6)
Create a VM from new image
#nova boot myvm1 --key-name kp1 --security-groups default --flavor m1.small --image 09af5938-2b27-422a-9126-fb62b54af8e3

7)
Open VM console
* Please wait for login prompt in the terminal
#sudo virsh list
#ps -aux | grep name-of-vm | grep vnc
#vncviewer :0

8)
Test ping
#ping ip-of-vm

9)
SSH to VM
#ssh -i my-private-key.txt root@ip-of-vm

10)
Delete VM
#nova delete 036a6158-d0cf-489f-a4fd-381164528a7f


No comments:

Post a Comment