Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We're currently running our infrastructure with XEN + CentOS and are thinking to make the move to Ubuntu (Both as Host and Guest) + KVM.

Our objective is to, at a later stage, create a private cloud using openstack/cloudstack however due to strict budgets we can't invest on the hardware needed to setup the cloud infrastructure alongside our current one. Since we have less than 10 Physical servers (yet with quite a few VM's) our idea was to migrate machines one by one from our current setup to the KVM+Ubuntu, my question here is the following, once we have the full kvm+Ubuntu infrastructure running, will we be able to "cloudify" it without having to rebuild all the machines (somehow import kvm guests to instances on openstack/cloudstack)? Or do we really need to build the cloud first?

Why the shift from CentOS to Ubuntu? Because aparently one needs to reinstall machines from scratch on major version upgrades (Say Centos 5 to 6), as you can imagine this is not ideal having to do every few years (specially when we will be scaling our infrastructure greatly in the future).

Both Dom0 and DomU's would be managed by puppet. Thanks for any suggestions

share|improve this question

4 Answers 4

up vote 0 down vote accepted

OpenStack does not have any built-in support for taking a running instance that was created outside of OpenStack and adding it so that it is managed by OpenStack.

However, you can export your running KVM/Xen instance as an image file, and then import the image file into OpenStack.

share|improve this answer
    
As far as I understood the image functionality of openstack it works as a kind of template, or? Which means I have to create 10 images for my 10 running vm's which are all based on the same template when we created them months ago.....hmmmmm not really what I had in mind. So it looks like I have to recreate the running vms and move the data. This I wanted to avoid :-) –  Laoneo May 31 '12 at 6:00

Here's how I would do it. Create the KVM+Ubuntu VMs in the raw format using less than 10 GB for the "disk".

qemu-img create myserver.raw 8G

Install Ubuntu on it.

kvm -m 2G -cdrom ubuntu-12.04-server-amd64.iso -drive if=virtio,file=myserver.raw,boot=off -vnc :9

Connect to it with VNC and install whatever apps you want but store no data on that disk! If you need to store data, create separate volumes for it. Treat each KVM VM you create as a template that you will use to create instances of when you move to OpenStack. Some VMs/templates you might want to keep more general so they're more flexible. Some VMs/templates you might want to be very specific so there's less work to do to make them useful after you've started an instance of them.

When you're ready to move to OpenStack shutdown your VMs and add them to the OpenStack Image Service (Glance), see the section Bootable Images.

glance add name="My Server" is_public=true container_format=ovf disk_format=raw < myserver.raw

If you have any data you want to migrate into OpenStack:

  1. Start your original KVM VM with the volume(s) that contain the data you want.
  2. Create volumes of at least equal size in OpenStack and attach them to the instances you want.
  3. scp or rsync the data from the KVM VM volume to the volume attached to an instance in OpenStack.

The way I've proposed it here isn't exactly a seamless process but I think it's safe and reliable.

share|improve this answer
    
Thanks for your explanation. The problem is that we have our virtualized infrastructure already and want move on with it to a cloud infrastructure based on kvm and openstack. –  Laoneo Jun 4 '12 at 11:46

I am totally biased, but why not stay on Xen when you move to OpenStack + Ubuntu? It should stop you needing to convert the images.

In OpenStack, you will have to export your images from your old hosts, import those image files into Glance (the image service), and then start them up inside your OpenStack environment.

It is also a very similar story when you look at CloudStack.

All the cloud orchestration pieces I know about deal best with the "greenfield" cases. In terms of importing images currently running on a hypervisor, it just doesn't fit their model of fully managing your whole environment: Storage, Networking and freshly installed Hypervisor.

share|improve this answer
    
Xen removed the auoboot feature in version 6 which we use on our applicanes. There are also other reasons why we want to move to kvm. Is an image in openstack not a kind of template? –  Laoneo May 31 '12 at 12:49

virt-v2v supports exporting VMs from libvirt+Xen to libvirt+KVM. Once you have those VMs, look at the management solution of your choice for how to import the VMs in. Without virt-v2v, your VMs will have Xen related bits in them, and will lack those for KVM, so it's a useful first step in any case

EDIT: A quick google shows there's plenty of documentation: http://docs.openstack.org/trunk/openstack-compute/admin/content/creating-images-from-running-instances.html

share|improve this answer
    
I know the virt command already. The question is if it is possible to import this existing VM's into openstack or cloudstack? –  Laoneo May 30 '12 at 10:47
    
a quick google reveals docs.openstack.org/trunk/openstack-compute/admin/content/… –  dyasny May 30 '12 at 11:06
    
I was probably searching with closed eyes....thanks for the link!! I'm happy that the solution is so easy. –  Laoneo May 30 '12 at 11:14
    
I was reading your link but my use case is different. What I need is to import the virtual machine from a non openstack environment into openstack (not only to create an image). The link you provided is to create an image from an existing virtual machine in openstack. I'm an absolutely newbie with openstack, perhaps I'm not understanding the image functionality of openstack the right way. –  Laoneo May 30 '12 at 11:31
    
I don't see an import function for a VM as such, however, I've seen it mentioned that Nova has an "import" feature, that supports OVF. If your VMs are prepared to run on the platform in question, you can write the OVF for them manually, and import the VMs that way. –  dyasny May 30 '12 at 12:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.