[one-users] Creating virtual machines from scratch

Fabian Wenk fabian at wenks.ch
Fri Dec 9 08:10:23 PST 2011


Hello Richard

On 08.12.2011 17:45, richard -rw- weinberger wrote:
> I'm a bit confused how to create a vm from scratch.
> Assume I want a vm running with CentOS6 and a new virtual hard disk of 500GiB.
>
> How can I create a new disk using OpenNebula (especially with Sunstone)?

I do not know how to do this steps in Sunstone, I did it with the 
command line tools.

Create the image manually (outside of OpenNebula) with this steps 
(for KVM):

On a system which has KVM available:
qemu-img create -f raw servername.img 10G
qemu-system-x86_64 -hda servername.img -cdrom 
/path/to/install.iso -boot d -m 512
Connect through VNC for installation, the above command will 
report you the used port (default 5900), see blow as 
qemu-system-x86_64 listen only on localhost for VNC
qemu-system-x86_64 servername.img -m 512  # to test after install
Connect through VNC
login and run 'poweroff' as root or with sudo

Now on the front-end:
Create an image template (servername-image.one)
oneimage register servername-image.one
Create an VM template for the host (servername.one)
onevm create servername.one


Connect to VNC on the cluster node:
I do not know about your workstation, but from my Mac client I 
use Chicken [1], which supports connection through ssh. I guess 
there is a VNC client for the OS of your workstation available 
which also can do this. Else you could run it with manual ssh 
forwarding like this:
ssh -L localhost:5900:localhost:5907 <server-with-KVM>
replace 5907 with the port which qemu-system-x86_64 as reported 
and then use the local VNC client to connect to localhost port 5900.

    [1] http://sourceforge.net/projects/chicken/

> In my setup each vm will have it's own disk image, thus no disk image
> needs to be copied.
> Is there a way to enforce this?

The best is to register each image in the Image Repository with 
'oneimage register ...'

> A final question, is it possible to change the boot order of a vm?
> Do I really have to delete and recreate it?

You need to shutdown and recreate the VM. Best done with the 
command line tool 'onevm create <template>' and the template you 
can modify.


bye
Fabian



More information about the Users mailing list