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.jack...@eu.citrix.com>
---
 ts-rumpuserxen-demo-xenstorels |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ts-rumpuserxen-demo-xenstorels b/ts-rumpuserxen-demo-xenstorels
index ed46843..a54fbf4 100755
--- a/ts-rumpuserxen-demo-xenstorels
+++ b/ts-rumpuserxen-demo-xenstorels
@@ -32,7 +32,11 @@ our $gn = $gho->{Guest};
 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 $!;
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to