[libvirt] [PATCH 2/3] Add test for persistent domain snapshot management

Eric Blake eblake at redhat.com
Fri Aug 26 15:26:38 UTC 2011


On 08/26/2011 08:16 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange"<berrange at redhat.com>
>
> The test case validates the core lifecycle operations on
> persistent domains with snapshots. A persistent domain
> should allow snapshots to be created&  deleted while both
> running and shutoff.

This test is good, but could use more coverage - you need to test the 
following 9 transitions, to be sure we covered everything (because my 
series proved we had bugs in multiple of these transitions):

current -> snapshot state
------------------
shutoff -> shutoff
shutoff -> paused   (0.9.4 buggy - it temporarily ran the vcpus, rather 
than restoring to the exact state where the paused snapshot was created)
shutoff -> running
paused  -> shutoff  (0.9.4 buggy with newer qemu, because it tried to 
use qemu -loadvm with no vm state)
paused  -> paused
paused  -> running  (0.9.4 buggy - it left the restored domain paused)
running -> shutoff  (0.9.4 buggy with newer qemu, because it tried to 
use qemu -loadvm with no vm state)
running -> paused
running -> running

It becomes 12 transitions when you add disk snapshots into the series, 
and once I implement VIR_DOMAIN_SNAPSHOT_REVERT_{START,PAUSED,FORCE}, we 
have even more combinations.

> It should forbid undefine of the
> domain when it has snapshots present.
> ---
>   scripts/domain-snapshot/080-persistent-snapshot.t |  112 +++++++++++++++++++++
>   1 files changed, 112 insertions(+), 0 deletions(-)
>   create mode 100644 scripts/domain-snapshot/080-persistent-snapshot.t
>
> +my $domss1;
> +my $domss2;
> +diag "Taking a snapshot while inactive";
> +ok_domain_snapshot(sub { $domss2 = $dom->create_snapshot($ss1xml)}, "created domain snapshot ss1");
> +
> +diag "Starting domain";
> +lives_ok(sub { $dom->create }, "started domain");
> +
> +diag "Taking a snapshot while active";
> +ok_domain_snapshot(sub { $domss2 = $dom->create_snapshot($ss2xml)}, "created domain snapshot ss2");

This only creates 2 of the 3 needed snapshots to fully exercise the 
possible 9 transitions.

Also, I don't see any tests of reverting to a snapshot state - you 
appear to be testing the management of creation and deletion of 
snapshots, but not reversion.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvir-list mailing list