How do I migrate virtual guests running in RHEV-M out to RHEL KVM?

Latest response

I used the virt-v2v tool to migrate my RHEL KVM guest images into RHEV-M and now I would like to move one of them out to a standalone RHEL KVM hypervisor. Is there a simple way to reverse what I did using the virt-v2v tool? Or is there another way.

Responses

Hi Ed,

Afraid I can't help you out with an answer to this one myself, but I've reached out to someone who may be able to assist, so stay tuned.

Hello Ed, I have not actually done the tasks that you are asking about but I have a few ideas of how I think it would work.

*** RHEV Migration ***

- Using RHEV

Create an export storage domain (NFS would probably be simplest)

Shutdown the VM and right-click the VM and select export

*** LVM Migration ***

- Using LVM (from the Hypervisor) - I have no clue whether this would work, but it seems like something you could try.  Hopefully someone will chime in if this suggestion is not advisable.

  • Create an NFS share somewhere and mount that from a Hypervisor.  I would not use any of the RHEV managed filesystems for this activity.
  • From what I have deduced each Disk assigned created for a VM is a Volume.  You would need to determine which Volumes were associated with the VM that you wish to export.  ENGINE:images(image_guid) appears to be the volume name.
  • dd the Volume out to a file on your NFS share
  • be sure to unmount that NFS share once you are done
I have 2 hosts and 1 VM with a single disk in this example:
vrhvmgr01 - My RHEV Manager system (RHEV 3.1)
prhvsrv01 - My RHEV Hypervisor (RHEL 6.4 as a RHEV Hypervisor)
A1-RHEL6 - a Test VM I created for doing activities such as this

[jradtke@vrhvmgr01 ~]$ sudo su -
[sudo] password for jradtke:
[root@vrhvmgr01 ~]# su - postgres
-bash-4.1$ psql -U engine
Password for user engine:
psql (8.4.13)
Type "help" for help.

engine=> select * from vms_for_disk_view where array_vm_names='{A1-RHEL6}';
 array_vm_names |              device_id               | entity_type
----------------+--------------------------------------+-------------
 {A1-RHEL6}     | 3099dda5-c0d3-44dc-a6aa-1651b797b9dd | VM
(1 row)

engine=> select * from images where image_group_id='3099dda5-c0d3-44dc-a6aa-1651b797b9dd';
              image_guid              |     creation_date      |    size     | 
             it_guid                |               parentid               | ima
gestatus |      lastmodified      |            vm_snapshot_id            | volum
e_type | volume_format |            image_group_id            |         _create_
date          |         _update_date          |               quota_id         
     | active
--------------------------------------+------------------------+-------------+--
------------------------------------+--------------------------------------+----
---------+------------------------+--------------------------------------+------
-------+---------------+--------------------------------------+-----------------
--------------+-------------------------------+---------------------------------
-----+--------
 6f3be885-0fe1-41d5-9aab-335dfa7b0824 | 2013-04-22 16:01:57-04 | 53687091200 | 0
0000000-0000-0000-0000-000000000000 | 00000000-0000-0000-0000-000000000000 |   
       1 | 2013-04-22 16:01:57-04 | 7a43dcb7-5358-4e5d-9b07-d56aba7760e2 |     
     2 |             4 | 3099dda5-c0d3-44dc-a6aa-1651b797b9dd | 2013-04-22 16:01
:55.477168-04 | 2013-04-22 16:02:02.429076-04 | 00000000-0000-0000-0000-00000000
0000 | t
(1 row)

[root@prhvsrv01 ~]# vgs
  VG                                   #PV #LV #SN Attr   VSize   VFree 
  156c4043-c2f5-4d63-818a-0d9e6017a641   6  61   0 wz--n-   1.17t 841.88g
  VolGroup00                             1   2   0 wz--n- 134.09g   

-- Now.. this is where things get a little ugly.  The /dev/mapper path will insert an additional '-' 
where there is currently a hypen in the volume group and volume name.
So,
VG: 156c4043-c2f5-4d63-818a-0d9e6017a641
Volume: 6f3be885-0fe1-41d5-9aab-335dfa7b0824
            |               VG                  |            Volume                 |
/dev/mapper/156c4043-c2f5-4d63-818a-0d9e6017a641-6f3be885-0fe1-41d5-9aab-335dfa7b0824
            |                   VG                  |                Volume                 |
/dev/mapper/156c4043--c2f5--4d63--818a--0d9e6017a641-6f3be885--0fe1--41d5--9aab--335dfa7b0824


# dd if=/dev/mapper/156c4043--c2f5--4d63--818a--0d9e6017a641-6f3be885--0fe1--41d5--9aab--335dfa7b0824 of=/mnt/nfs_path/A1-RHEL6.img

Thank you James! Your steps worked for me.

Once I got the image I followed the following steps to start it up on RHEL KVM using virt-manager.

1) Create a new temporary VM, but stopped it before installing the new operating system(I just shutdown the VM).

2) Select VM and "View Machine Details"

3) Remove the existing disk. The disk you started when creating the temporary VM in virt-manager.

4) select "Add Hardware" and select "Managed or other existing storage"

5) Browse for where you put your ported image and add.

6) Then start the VM from the virt-manager console.