Francois Gouget : testbot/VMs: Work around the lack of Domain:: get_snapshot_by_name() in older libsys-virt-perl versions.
Alexandre Julliard
julliard at winehq.org
Thu Dec 6 16:24:24 CST 2012
Module: tools
Branch: master
Commit: 804dbf8b1ce6e6b1fe2088e4950a66579d6f5aba
URL: http://source.winehq.org/git/tools.git/?a=commit;h=804dbf8b1ce6e6b1fe2088e4950a66579d6f5aba
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Thu Dec 6 20:57:48 2012 +0100
testbot/VMs: Work around the lack of Domain::get_snapshot_by_name() in older libsys-virt-perl versions.
---
testbot/lib/WineTestBot/VMs.pm | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm
index 4be607a..82ad379 100644
--- a/testbot/lib/WineTestBot/VMs.pm
+++ b/testbot/lib/WineTestBot/VMs.pm
@@ -277,7 +277,18 @@ sub _GetSnapshot($$)
return $ErrMessage if (defined $ErrMessage);
my $Snapshot;
- eval { $Snapshot = $Domain->get_snapshot_by_name($SnapshotName) };
+ eval {
+ # Work around the lack of get_snapshot_by_name() in older libvirt versions.
+ foreach my $Snap ($Domain->list_snapshots())
+ {
+ if ($Snap->get_name() eq $SnapshotName)
+ {
+ $Snapshot = $Snap;
+ last;
+ }
+ }
+ $@ = "Snapshot '$SnapshotName' not found" if (!$Snapshot);
+ };
return ($@->message(), undef, undef) if ($@);
return (undef, $Domain, $Snapshot);
}
More information about the wine-cvs
mailing list