Discussion:
[openstack-dev] Migrating KVM VM to Openstack
Shyam Goud
2013-02-07 06:48:05 UTC
Permalink
Hello,

I have a VM Instacne (ServerA) running on KVM hypervisor, I want to
Launch the same VM in Openstack by adding its disk image to glance.

Followed these steps:

1. Copied (ServerA) VM disk image to my openstack server. Image type
shows as qcow2.

/***@oscontroller-desktop:/home/os-controller# qemu-img info disk//
//image: disk//
//file format: //*qcow2*//
//virtual size: 10G (10737418240 bytes)//
//disk size: 9.8G//
//cluster_size: 2097152//
//backing file:
/var/lib/nova/instances/_base/902ba3cda1883801594b6e1b452790cc53948fda//
/
2. And added disk image to glance,

/***@oscontroller-desktop:/home/os-controller# glance image-list
+--------------------------------------+-------------------------+-------------+------------------+-------------+--------+
| ID | Name | Disk Format | Container
Format | Size | Status |
+--------------------------------------+-------------------------+-------------+------------------+-------------+--------+
| 1214e050-5445-49af-a35f-0f01071ae83f | ubuntu-precise-21012013 |
qcow2 | bare | 250019840 | active |
| 2f9dfb90-6a1f-4226-8cac-d85d4f6b2258 | jenkins-disk-img | qcow2
| bare | 10546577408 | active |/
Pádraig Brady
2013-02-07 09:25:35 UTC
Permalink
Post by Shyam Goud
Hello,
I have a VM Instacne (ServerA) running on KVM hypervisor, I want to Launch the same VM in Openstack by adding its disk image to glance.
1. Copied (ServerA) VM disk image to my openstack server. Image type shows as qcow2.
//image: disk//
//file format: //*qcow2*//
//virtual size: 10G (10737418240 bytes)//
//disk size: 9.8G//
//cluster_size: 2097152//
//backing file: /var/lib/nova/instances/_base/902ba3cda1883801594b6e1b452790cc53948fda//
/
2. And added disk image to glance,
+--------------------------------------+-------------------------+-------------+------------------+-------------+--------+
| ID | Name | Disk Format | Container Format | Size | Status |
+--------------------------------------+-------------------------+-------------+------------------+-------------+--------+
| 1214e050-5445-49af-a35f-0f01071ae83f | ubuntu-precise-21012013 | qcow2 | bare | 250019840 | active |
| 2f9dfb90-6a1f-4226-8cac-d85d4f6b2258 | jenkins-disk-img | qcow2 | bare | 10546577408 | active |/
3. But While Launching the VM in Openstack, State goes to Error.
Shyam Goud
2013-02-07 10:12:04 UTC
Permalink
Padriag, Thanks for the info

But i see this issue while converting as you suggested.

***@oscontroller-desktop:/home/os-controller# qemu-img convert -f qcow2
-O qcow2 disk newdisk
/qemu-img: Could not open 'disk': No such file or directory//
//qemu-img: Could not open 'disk'/

***@oscontroller-desktop:/home/os-controller# ls -lrt disk
-rw-r--r-- 1 root root 10546577408 Feb 5 21:48 disk
***@oscontroller-desktop:/home/os-controller#

-Shyam.
Post by Shyam Goud
Hello,
I have a VM Instacne (ServerA) running on KVM hypervisor, I want to
Launch the same VM in Openstack by adding its disk image to glance.
1. Copied (ServerA) VM disk image to my openstack server. Image type shows as qcow2.
//image: disk//
//file format: //*qcow2*//
//virtual size: 10G (10737418240 bytes)//
//disk size: 9.8G//
//cluster_size: 2097152//
/var/lib/nova/instances/_base/902ba3cda1883801594b6e1b452790cc53948fda//
/
2. And added disk image to glance,
+--------------------------------------+-------------------------+-------------+------------------+-------------+--------+
| ID | Name | Disk Format |
Container Format | Size | Status |
+--------------------------------------+-------------------------+-------------+------------------+-------------+--------+
| 1214e050-5445-49af-a35f-0f01071ae83f | ubuntu-precise-21012013 |
qcow2 | bare | 250019840 | active |
| 2f9dfb90-6a1f-4226-8cac-d85d4f6b2258 | jenkins-disk-img |
qcow2 | bare | 10546577408 | active |/
3. But While Launching the VM in Openstack, State goes to Error.
Pádraig Brady
2013-02-07 10:21:37 UTC
Permalink
Post by Shyam Goud
Padriag, Thanks for the info
But i see this issue while converting as you suggested.
/qemu-img: Could not open 'disk': No such file or directory//
//qemu-img: Could not open 'disk'/
-rw-r--r-- 1 root root 10546577408 Feb 5 21:48 disk
-Shyam.
Post by Shyam Goud
Hello,
I have a VM Instacne (ServerA) running on KVM hypervisor, I want to Launch the same VM in Openstack by adding its disk image to glance.
1. Copied (ServerA) VM disk image to my openstack server. Image type shows as qcow2.
//image: disk//
//file format: //*qcow2*//
//virtual size: 10G (10737418240 bytes)//
//disk size: 9.8G//
//cluster_size: 2097152//
//backing file: /var/lib/nova/instances/_base/902ba3cda1883801594b6e1b452790cc53948fda//
/
2. And added disk image to glance,
+--------------------------------------+-------------------------+-------------+------------------+-------------+--------+
| ID | Name | Disk Format | Container Format | Size | Status |
+--------------------------------------+-------------------------+-------------+------------------+-------------+--------+
| 1214e050-5445-49af-a35f-0f01071ae83f | ubuntu-precise-21012013 | qcow2 | bare | 250019840 | active |
| 2f9dfb90-6a1f-4226-8cac-d85d4f6b2258 | jenkins-disk-img | qcow2 | bare | 10546577408 | active |/
3. But While Launching the VM in Openstack, State goes to Error.
Shyam Goud
2013-02-08 05:33:03 UTC
Permalink
Hello,

Getting "No bootable device" after launching the VM in openstack.

Note: Copied the KVM VM disk image from different host machine to
openstack-controller machine.

1. Converted the KVM VM image to qcow2
/os-***@oscontroller-desktop:~$ qemu-img info newdisk.qcow2//
//image: newdisk.qcow2//
//file format: qcow2//
//virtual size: 10G (10737418240 bytes)//
//disk size: 9.5G//
//cluster_size: 65536//
//os-***@oscontroller-desktop:~$/

2. Added to glance and Launched the VM. VM state shows as active, but
getting "Boot failed: could not read the boot disk"

3. virsh -c qemu:///session dumpxml instance-0000006b, xml file shows as
type=qcow2 (correct type).

/<devices>//
// <emulator>/usr/bin/kvm</emulator>//
// <disk type='file' device='disk'>//
// <driver name='qemu' type='*qcow2*' cache='none'/>//
// <source file='/var/lib/nova/instances/instance-0000006b/disk'/>//
// <*target dev='vda*' bus='virtio'/>//
// <alias name='virtio-disk0'/>//
// <address type='pci' domain='0x0000' bus='0x00' slot='0x04'
function='0x0'/>//
// </disk>//
/
4. does any other specific conversions required here (adding virtual
driver) ?

/***@oscontroller-desktop:/home/os-controller# df -h//
//Filesystem Size Used Avail Use% Mounted on//
///dev/sda1 411G 144G 246G 37% ///
//udev 63G 4.0K 63G 1% /dev//
//tmpfs 26G 1.1M 26G 1% /run//
//none 5.0M 0 5.0M 0% /run/lock//
//none 63G 144K 63G 1% /run/shm//
//none 100M 40K 100M 1% /run/user//
//cgroup 63G 0 63G 0% /sys/fs/cgroup//
//***@oscontroller-desktop:/home/os-controller# /


Any help is highly appreciated.

Thanks,
Shyam.
How do i get the backing-file ? I am new to all these...
Appreciate your help.
Shyam.
It's listed above as
/var/lib/nova/instances/_base/902ba3cda1883801594b6e1b452790cc53948fda
Was that on a different machine?
Maybe the base image was auto removed because it was no longer in
use?
cheers,
Pádraig.
Yes it was on a different machine.. "did a 'dd' of the original
disk image on the old openstack server and piped it through ssh
onto my local machine"
So, now how do i copy the disk image to make it work on my openstack.
qemu-img rebase ...
qemu-img convert ...
I did a rebase and convert.. but same issue..
qcow2 -u -b diskbacking -F qcow2 disk//
//
//image: disk//
//file format: qcow2//
//virtual size: 10G (10737418240 bytes)//
//disk size: 9.8G//
//cluster_size: 2097152//
//backing file: diskbacking//
//
qcow2 -O qcow2 disk newdisk //
//qemu-img: Could not open 'disk': No such file or directory//
//qemu-img: Could not open 'disk'//
You did rebase -u which should have worked,
but maybe you might want to do without -u
to avoid any sparse issues for example in the transfer.
If it still doesn't work then I suggest you do
the convert on the original machine.
cheers,
Pádraig.
Loading...