@@ -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 () {
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@citrix.com> --- ts-guests-nbd-mirror | 47 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-)