testbot/VMs: Work around the lack of Domain::get_snapshot_by_name() in older libsys-virt-perl versions.
Francois Gouget
fgouget at codeweavers.com
Thu Dec 6 13:57:48 CST 2012
---
testbot/lib/WineTestBot/VMs.pm | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm
index ef1828b..251c300 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);
}
--
1.7.10.4
More information about the wine-patches
mailing list