[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH v2 14/19] ts-guests-nbd-mirror: make it work with stretch



On the server side, only add oldstyle= and port= on Wheezy and Jessie.
Stretch doesn't support or need those anymore.

On the client side, generate new style configuration file.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 ts-guests-nbd-mirror | 47 +++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 43 insertions(+), 4 deletions(-)

diff --git a/ts-guests-nbd-mirror b/ts-guests-nbd-mirror
index 3032204..7bcc02c 100755
--- a/ts-guests-nbd-mirror
+++ b/ts-guests-nbd-mirror
@@ -60,15 +60,19 @@ sub configserver () {
 [generic]
     user = root
 END
-    $scfg .= <<END unless $sho->{Suite} =~ m/sarge|lenny|squeeze/;
+
+    $scfg .= <<END if $sho->{Suite} =~ m/wheezy|jessie/;
     oldstyle = true
 END
+
     foreach my $v (@vols) {
        $v->{Port}= unique_incrementing_runvar("${srvhost}_nextport",4000);
        $v->{Path}= "/dev/$v->{Gho}{Vg}/$v->{Lv}";
        $scfg.=<<END;
 [export$v->{Ix}]
     exportname = $v->{Path}
+END
+       $scfg.=<<END if $sho->{Suite} =~ m/wheezy|jessie/;
     port = $v->{Port}
 END
     }
@@ -79,9 +83,7 @@ END
     target_install_packages($sho, qw(nbd-server));
 }
 
-sub configclient () {
-    target_cmd_root($cho, "dpkg --purge nbd-client ||:");
-
+sub configclient_pre_stretch () {
     my $mydaemon= '/root/nbd-client-async';
     target_putfilecontents_root_stash($cho,10,<<'END',$mydaemon);
 #!/bin/sh
@@ -107,7 +109,44 @@ NBD_PORT[$v->{Ix}]=$v->{Port}
 END
     }
     target_putfilecontents_root_stash($cho,10,$ccfg,"/etc/nbd-client");
+}
+
+sub configclient_stretch () {
+    my $ccfg = <<END;
+# generated by $0
+END
+
+    foreach my $v (@vols) {
+       my $nbddev = "nbd$v->{Ix}";
+       $ccfg .= <<END;
+$nbddev $sho->{Name} export$v->{Ix}
+END
+    }
+
+    target_putfilecontents_root_stash($cho,10,$ccfg,"/etc/nbdtab");
+}
+
+sub configclient () {
+    target_cmd_root($cho, "dpkg --purge nbd-client ||:");
+
+    if ($cho->{Suite} !~ m/stretch/) {
+        configclient_pre_stretch();
+    } else {
+        configclient_stretch();
+    }
+
     target_install_packages($cho, qw(nbd-client));
+
+    if ($cho->{Suite} !~ m/squeeze|wheezy|jessie/) {
+       foreach my $v (@vols) {
+           my $nbddev = "nbd$v->{Ix}";
+           target_cmd_root($cho, <<END);
+mkdir -p /dev/$v->{Gho}{Vg}
+if ! test -L $v->{Path}; then ln -s /dev/$nbddev $v->{Path}; fi
+END
+       }
+       target_cmd_root($cho, "/etc/init.d/nbd-client start");
+    }
 }
 
 sub shuffleconfigs () {
-- 
2.11.0


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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.