QA:Testcase Virtualization Live Backup

From FedoraProject

(Difference between revisions)
Jump to: navigation, search
(Create page)
 
(Use an unordered list, since making numbers work with multiline pre sucks)
 
(3 intermediate revisions by one user not shown)
Line 2: Line 2:
  
 
|description=
 
|description=
Suspend and Hibernate a VM. Verify it resumes as expected. For more details, see:
+
Backup a VM's disk image while it is running, with zero downtime. For more details, see:
  
http://fedoraproject.org/wiki/Features/Virt_Guest_Suspend_Hibernate
+
http://fedoraproject.org/wiki/Features/Virt_Live_Snapshots
  
 
|setup=
 
|setup=
 
Nothing beyond the initial test day setup (basically a function F18 VM).
 
Nothing beyond the initial test day setup (basically a function F18 VM).
 +
 +
{{admon/warning|Disk space requirements|This test requires enough storage to hold 2 VM disk images. Beware if you're doing your testing in a nested VM!}}
 +
{{admon/warning|You disk image will be converted to qcow2|After following these steps, the VMs disk image will be in qcow2 format, regardless of the existing format!}}
  
 
|actions=
 
|actions=
 +
* Start your VM, connect to the graphical console with virt-manager. Log in to your guest.
 +
* On the host, create a live snapshot of the guest:
 +
      # virsh snapshot-create-as f18 snapshot1 "snapshot for backup" --disk-only --atomic --no-metadata
 +
* Your guest is now running off a sparse qcow2 image. Merge the original disk info into the sparse snapshot:
 +
      # virsh blockpull --domain f18 --path /var/lib/libvirt/images/f18.snapshot1
 +
* Watch the progress of this operation:
 +
      # virsh blockjob --info f18 /mnt/data/devel/images/f18.snapshot1
 +
      Block Pull: [ 35 %]
 +
      # virsh blockjob --info f18 /mnt/data/devel/images/f18.snapshot1
 +
      Block Pull: [ 39 %]
 +
* While this operation is taking place, connect to the guest and touch a create a few files in $HOME
 +
* When the job has finished, the above blockjob command will return empty output
 +
* Move the original disk image to your backup location
 +
      # mv /var/lib/libvirt/images/f18.img /my/backup/dir
 +
* Verify that the guest is still accessible, and all files can be read ('find /' should be sufficient)
  
== Initiating suspend/hibernate from inside the guest ==
+
If you want to get back to your original VM image name, you can now do:
 
+
       # virsh snapshot-create-as f18 snapshot2 "snapshot for backup" --disk-only --atomic --no-metadata --diskspec vda,file=/var/lib/libvirt/images/f18.img
# Start a VM, connect to the graphical console with virt-manager
+
Then continue with the above steps to merge your changes in the original image, and delete the intermediate f18.snapshot. Your disk f18.img will still be converted to qcow2 however (but that's a good thing!)
# From inside the guest, as root, run:
+
       # pm-suspend
+
# Verify the state changes to 'suspended' in the main virt-manager window
+
# Click inside the black VM guest console, and press any key on the keyboard
+
# Verify the VM resumes right where it left off.
+
# From inside the guest, as root, run:
+
      # pm-hibernate
+
# Verify the guest appears to shutdown in the main virt-manager window
+
# Start the guest again
+
# Verify that the VM resumes right where it left off
+
 
+
 
+
== Initiating suspend/hibernate from the host ==
+
  
# Start a VM, connect to the graphical console with virt-manager
+
Optionally, you can shutdown the VM, and edit the XML using 'virsh edit' like usual
# From the host machine, as root, suspend the guest with virsh:
+
      # virsh dompmsuspend --target mem
+
# Watch virsh until the VM is listed as 'suspended':
+
      # virsh list --all
+
# Wake the guest up with virsh:
+
      # virsh dompmwakeup
+
# Using the graphical console, verify the guest appeared to resume correctly
+
# From the host machine, as root, hibernate the guest with virsh:
+
      # virsh dompmsuspend --target disk
+
# Watch virsh until the VM is listed as shutoff:
+
      # virsh list --all
+
# Wake the guest up with virsh:
+
      # virsh dompmwakeup
+
# Verify that the VM resumes right where it left off
+
  
 
|results=
 
|results=
No obvious errors encountered, guests seem to be functioning as normal after resuming.
+
No obvious errors, guest appears to be functioning correctly after all the steps.
 
}}
 
}}
  
 
[[Category:Virtualization Test Cases]]
 
[[Category:Virtualization Test Cases]]

Latest revision as of 02:01, 30 October 2012

Contents

Description

Backup a VM's disk image while it is running, with zero downtime. For more details, see:

http://fedoraproject.org/wiki/Features/Virt_Live_Snapshots

Setup

Nothing beyond the initial test day setup (basically a function F18 VM).

Warning (medium size).png
Disk space requirements
This test requires enough storage to hold 2 VM disk images. Beware if you're doing your testing in a nested VM!
Warning (medium size).png
You disk image will be converted to qcow2
After following these steps, the VMs disk image will be in qcow2 format, regardless of the existing format!

How to test

  • Start your VM, connect to the graphical console with virt-manager. Log in to your guest.
  • On the host, create a live snapshot of the guest:
     # virsh snapshot-create-as f18 snapshot1 "snapshot for backup" --disk-only --atomic --no-metadata
  • Your guest is now running off a sparse qcow2 image. Merge the original disk info into the sparse snapshot:
     # virsh blockpull --domain f18 --path /var/lib/libvirt/images/f18.snapshot1
  • Watch the progress of this operation:
     # virsh blockjob --info f18 /mnt/data/devel/images/f18.snapshot1
     Block Pull: [ 35 %]
     # virsh blockjob --info f18 /mnt/data/devel/images/f18.snapshot1
     Block Pull: [ 39 %]
  • While this operation is taking place, connect to the guest and touch a create a few files in $HOME
  • When the job has finished, the above blockjob command will return empty output
  • Move the original disk image to your backup location
     # mv /var/lib/libvirt/images/f18.img /my/backup/dir
  • Verify that the guest is still accessible, and all files can be read ('find /' should be sufficient)

If you want to get back to your original VM image name, you can now do:

     # virsh snapshot-create-as f18 snapshot2 "snapshot for backup" --disk-only --atomic --no-metadata --diskspec vda,file=/var/lib/libvirt/images/f18.img

Then continue with the above steps to merge your changes in the original image, and delete the intermediate f18.snapshot. Your disk f18.img will still be converted to qcow2 however (but that's a good thing!)

Optionally, you can shutdown the VM, and edit the XML using 'virsh edit' like usual

Expected Results

No obvious errors, guest appears to be functioning correctly after all the steps.