How to import KVM virtual machines in Cloudmin

18 posts / 0 new
Last post
#1 Sun, 09/23/2012 - 10:49
fakemoth
fakemoth's picture

How to import KVM virtual machines in Cloudmin

Hello, is there a way (should be) to import some old (previously working) KVM virtual machines in Cloudmin? Recently had to reinstall the host due to HDD problems and I can't get back my VM's. In New System>Add KVM Instance (the page reads "Add Existing System") it keeps throwing the dumb error Failed to add system : Missing or invalid hostname

How is this possible that it can't see some files in a directory?

Sun, 09/23/2012 - 23:07
andreychek

Howdy,

Yeah, it should indeed be possible to add one using the "Add KVM Instance" you tried.

It sounds like it's unhappy with the hostname you're using there... I know when creating a new KVM instance, you have to enter only the hostname itself -- not an FQDN, but just the first part of the name (ie, just "host", and not "host.example.tld").

Let us know if that works -- as if it does, I'll see if Jamie can improve the error message there :-)

-Eric

Mon, 09/24/2012 - 02:26
fakemoth
fakemoth's picture

Hi, I tried everything, done it again right now (even with just the first part) - nothing. What should i check? This should be more straight forward than this, maybe a browse button, pick the VM & OK ? Or even an autosearch in the provided location?

Tried also System Operations>Find KVM Instances and I get

Finding running KVM processes ..
.. no processes found

no matter wich settings I choose.

Don't take the name of root in vain...

Wed, 09/26/2012 - 15:04 (Reply to #3)
JamieCameron

There isn't really any easy way to do this, unless you preserved the /etc/webmin/servers directory from the old system. The reason is that for KVM virtual machines, a lot of the information is kept in files under that directory..

''

Wed, 09/26/2012 - 01:20
fakemoth
fakemoth's picture

Anyone?

Don't take the name of root in vain...

Thu, 09/27/2012 - 01:23
fakemoth
fakemoth's picture

:( well this wasn't documented or at least not very clear. So what is the hard way?

Don't take the name of root in vain...

Thu, 09/27/2012 - 15:46
fakemoth
fakemoth's picture

I also have some backups (what kind of backups are those exactly, to what? the files are pretty small) that doesn't work either:

     Finding systems to restore ..
    .. found 0 systems

    Working out backup sources ..
    .. found 0 usable sources

Restores of 0 systems completed successfully.

If this is still not enough... I don't know what to say.

Don't take the name of root in vain...

Thu, 09/27/2012 - 15:58 (Reply to #7)
JamieCameron

What files are in that backups directory?

''

Thu, 09/27/2012 - 16:59
fakemoth
fakemoth's picture

.disks

.gz

.gz1

.serv

All with the name of the VMs

Don't take the name of root in vain...

Fri, 09/28/2012 - 00:36 (Reply to #9)
JamieCameron

Try copying the .serv file into the /etc/webmin/servers directory on the Cloudmin master system. This should make it show up in the left menu - and you can then start up the VM.

''

Thu, 12/13/2012 - 22:03
yngens

What about importing KVM instance file with extension .img from non-Cloudmin server? Besides .img file I have corresponding .xml file for that instance. Is it possible at all?

Thu, 12/13/2012 - 22:43 (Reply to #11)
JamieCameron

That depends on what format the img file is in .. is it a raw disk image, or some other format?

''

Thu, 12/13/2012 - 22:52 (Reply to #12)
yngens

Hi Jamie,

Thanks for replying. I am trying to import existing KVM guest instances from non-Cloudmin system. So since I still have them running I can pre-format them to any required format. What is the ideal format to make it easy to import existing KVM images to Cloudmin? And what sequence of steps I should follow when I have them in best format?

Thanks again!

Thu, 12/13/2012 - 23:37 (Reply to #13)
JamieCameron

The only supported format is a raw disk image.

Once you have that, you could perform an import as follows :

  1. Shut down the VM using your old software
  2. Create an empty VM in Cloudmin with the same RAM, CPU, IP address and other settings
  3. Go to Resources -> Manage Disks and remove the default disk
  4. On the same page, add the disk image file from the VM you are importing.
  5. Start up the VM in Cloudmin

''

Fri, 12/14/2012 - 00:02 (Reply to #14)
yngens

Thanks Jamie,

Stuck again on step 2. It gives: "Failed to create system : Missing or non-absolute path for CD image file" Should I specify path to the image of copied guest system? I think I should not, because in step 3 you recommend to remove the disk and add in step 4. So then what path and to which file I should specify in step 2?

Fri, 12/14/2012 - 02:45 (Reply to #15)
yngens

Jamie,

I've created a small raw.img file and overcome the problem described in my previous comment. Then I proceeded to the rest of steps and couldn't start the VM. Further troubleshooting I found out that Cloudmin normally puts "/dev/hda" for "Device on virtual system" and creates "/etc/fstab" with the following content:

/dev/vda1 / ext3    grpquota,usrquota,rw    0 1
tmpfs   /dev/shm        tmpfs   defaults        0 0
devpts  /dev/pts        devpts  gid=5,mode=620  0 0
sysfs   /sys    sysfs   defaults        0 0
proc    /proc   proc    defaults        0 0
/dev/vdb1 swap    swap    defaults        0 0

However "/etc/fstab" file of VM that I am trying to import to Cloudmin has:

#
# /etc/fstab
# Created by anaconda on Mon May 21 14:03:15 2012
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_ns1007-lv_root  /  ext4  grpquota,usrquota,rw  0  1
UUID=0fdc149d-b9d9-434f-9278-15a02a84261c /boot                   ext4    defaults        1 2
/dev/mapper/vg_ns1007-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc 

I tried to detach and re-add the img by putting "/dev/mapper/vg_ns1007-lv_root" for "Device on virtual system" field this time. I am not sure what should I choose for "Mount new disk as", so left default "Don't mount". Unfortunately when I go to Edit disk it again shows "/dev/hda" for "Device on virtual system".

Also file system of default Cloudmin VM ext3 differs from ext4 of the image I am trying to import.

Is it possible to successfully import this kind of images in my situation?

Fri, 12/14/2012 - 11:41 (Reply to #16)
JamieCameron

For "device on virtual system", entering /dev/hda should work just fine. There is no need to enter any mount point, as that is already specific in the /etc/fstab file.

Be aware though that a VM like this which uses LVM internally cannot be fully managed by Cloudmin, as its filesystem won't be accessible from on the host. Only VMs that have their root filesystem directly on /dev/hda1 can be properly managed.

''

Fri, 12/14/2012 - 14:56 (Reply to #17)
yngens

Thanks for clarification. I tried different ways and couldn't make Cloudmin to see any of this kind of KVM guest systems. Besides you say this kind of guests can't be fully managed by Cloudmin. So I am giving up importing trials, I guess I have to just copy files and databases, instead of whole guest images.

Topic locked