If the guest config is already set up to preserve, cancel the edit.
We are going to repeat this test, and this avoids creating many
identical copies of the same file in the log output.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbelL@citrix.com>
sub arrangepreserve () {
target_editfile_root($ho,$r{"$gho->{Guest}_cfgpath"}, sub {
while (<EI>) {
- next if m/^\s*on_poweroff\s*=/;
+ if (m/^\s*on_poweroff\s*=/) {
+ target_editfile_cancel("already configured to preserve")
+ if m/\bpreserve\b/;
+ next;
+ }
print EO or die $!;
}
print EO "\n","on_poweroff='preserve'\n" or die $!;