Don't use 'test-live' as a base because we cannot assume that rebooting it will not break its configuration. But do use snapshots such as 'test-adm' as a base. This allows automating the creation of live snapshots for Windows versions where a given option is not supported.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- Such as the adm option on Windows 7. --- testbot/bin/LibvirtTool.pl | 41 ++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 17 deletions(-)
diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl index df7859dea..a9622de7d 100755 --- a/testbot/bin/LibvirtTool.pl +++ b/testbot/bin/LibvirtTool.pl @@ -613,27 +613,34 @@ sub PrepareVM($) } }
-sub GetSnapshotConfig($) +sub GetSnapshotConfig($$) { - my ($Config) = @_; - - # Don't stack snapshots. For instance assume the snapshot name is - # 'test-live-fr-FR-tsign' and that 'test-live-fr-FR' already exists - # (typically because it is used by another VM): - # - It's probably better if snapshots are independent from each other. - # - Applying the 'tsign' flag on top of the existing snapshot requires a - # Windows reboot. But format locale changes may not stick across reboots. - # - Stopping the snapshot name parsing when finding an existing snapshot name - # would lose the 'live' flag resulting in an error (or the wrong type of - # snapshot. Avoiding this issue would result in more complexity. - # - Finally snapshot stacking does not seem that useful. - # - A consequence is that the base snapshot should be called 'test' and not - # 'test-live'. + my ($Domain, $Config) = @_; + + # Notes: + # - Don't use a live snapshot as a base snapshot: + # - It's probably better if snapshots are independent from each other. + # - Applying extra options on top of a live snapshot may require a reboot. + # But some locales changes may not survive that. So using, for instance, + # test-fr-FR-live as a base may break the locale. + # - However some options are not supported on all Windows versions. For + # instance 'adm' snapshots cannot be created on Windows 7 so in that case + # it is useful to be able to use a preconfigured test-adm as a base + # snapshot for test-adm-live. + # - Finally, although base snapshots, such as 'test', are presumably powered + # off, 'off' snapshots still create a new snapshot. The difference is that + # the 'test-off' snapshot will have an up-to-date TestAgentd server, the + # right desktop background, etc. while (1) { + if ($Config->{base} !~ /-live\b/ and + $Domain->HasSnapshot($Config->{base})) + { + last; + } if ($Config->{base} =~ s/-([a-z]{2}-[A-Z]{2})$//) { - $Config->{locale} ||= $1; # take only the last match + $Config->{locale} ||= $1; # use the last locale in the snapshot name } elsif ($Config->{base} =~ s/-(adm|live|off|tsign|u8)$//) { @@ -837,7 +844,7 @@ sub Revert() if (!$Domain->HasSnapshot($Config->{base})) { $Config->{create} = 1; - GetSnapshotConfig($Config); + GetSnapshotConfig($Domain, $Config); Debug(join(" ", Elapsed($Start), "Config:", map { "$_=$Config->{$_}" } sort keys %$Config), "\n"); if ($Config->{locale} and $VM->Type !~ /^win(?:32|64)$/) {