xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: ian.jackson@eu.citrix.com, Wei Liu <wei.liu2@citrix.com>
Subject: [OSSTEST PATCH 16/16] ts-guests-nbd-mirror: make it work with stretch
Date: Fri, 20 Oct 2017 11:38:40 +0100	[thread overview]
Message-ID: <20171020103840.32762-17-wei.liu2@citrix.com> (raw)
In-Reply-To: <20171020103840.32762-1-wei.liu2@citrix.com>

On the server side, only add oldstyle= and port= on jessie. Stretch
doesn't support or need those anymore.  Prune check for older versions
of Debian.

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(-)

diff --git a/ts-guests-nbd-mirror b/ts-guests-nbd-mirror
index ca8300d..d7b07e2 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/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/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/stretch/) {
+	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@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2017-10-20 10:58 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-20 10:38 [OSSTEST PATCH 00/16] Upgrade to Stretch Wei Liu
2017-10-20 10:38 ` [OSSTEST PATCH 01/16] XXX add a stretch config based on production-config Wei Liu
2017-10-20 10:54   ` Ian Jackson
2017-10-20 11:17     ` Wei Liu
2017-10-20 10:38 ` [OSSTEST PATCH 02/16] gitignore: ignore vim swap file Wei Liu
2017-10-20 10:53   ` Ian Jackson
2017-10-20 10:38 ` [OSSTEST PATCH 03/16] ts-xen-build-prep: don't install w3c-dtd-xhtml for Stretch onward Wei Liu
2017-10-20 10:50   ` Ian Jackson
2017-10-20 11:37     ` Wei Liu
2017-10-20 10:38 ` [OSSTEST PATCH 04/16] ts-xen-build-prep: install packages for stretch Wei Liu
2017-10-20 10:50   ` Ian Jackson
2017-10-20 10:38 ` [OSSTEST PATCH 05/16] mg-debian-installer-update-all: put quotes around arguments Wei Liu
2017-10-20 10:56   ` Ian Jackson
2017-10-20 10:38 ` [OSSTEST PATCH 06/16] ts-xen-install: install some packages on stretch Wei Liu
2017-10-20 10:38 ` [OSSTEST PATCH 07/16] Debian.pm: use sysvinit-core " Wei Liu
2017-10-20 10:57   ` Ian Jackson
2017-10-20 10:38 ` [OSSTEST PATCH 08/16] ts-leak-check: suppress systemd-shim, which leaks in stretch Wei Liu
2017-10-20 10:58   ` Ian Jackson
2017-10-20 10:38 ` [OSSTEST PATCH 09/16] ts-host-install: don't use the new nic naming scheme Wei Liu
2017-10-20 10:58   ` Ian Jackson
2017-10-20 10:38 ` [OSSTEST PATCH 10/16] ts-debian-fixup: remove extra= before appending our own Wei Liu
2017-10-20 11:03   ` Ian Jackson
2017-10-20 11:15     ` Wei Liu
2017-10-20 12:52       ` Ian Jackson
2017-10-20 13:09         ` Wei Liu
2017-10-20 10:38 ` [OSSTEST PATCH 11/16] ts-debian-fixup: use correct resume device Wei Liu
2017-10-20 11:05   ` Ian Jackson
2017-10-20 11:14     ` Wei Liu
2017-10-20 12:35       ` Ian Jackson
2017-10-20 13:17         ` Wei Liu
2017-10-20 13:20           ` Ian Jackson
2017-10-20 13:36             ` Wei Liu
2017-10-20 13:42               ` Ian Jackson
2017-10-20 14:56                 ` Wei Liu
2017-10-20 15:10                   ` Ian Jackson
2017-10-20 15:36                     ` Wei Liu
2017-10-20 10:38 ` [OSSTEST PATCH 12/16] make-flight: don't test pvgrub for Xen XXX Wei Liu
2017-10-20 10:38 ` [OSSTEST PATCH 13/16] ts-debian-hvm-install: disable new nic naming scheme Wei Liu
2017-10-20 11:01   ` Ian Jackson
2017-10-20 10:38 ` [OSSTEST PATCH 14/16] ts-xen-build-prep: install e2fslibs-dev Wei Liu
2017-10-20 10:38 ` [OSSTEST PATCH 15/16] TestSupport: add dpkg option when installing packages Wei Liu
2017-10-20 10:38 ` Wei Liu [this message]
2017-10-20 11:09   ` [OSSTEST PATCH 16/16] ts-guests-nbd-mirror: make it work with stretch Ian Jackson
2017-10-20 11:24     ` Wei Liu
2017-10-20 11:31       ` Wei Liu
2017-10-25 13:41 ` [OSSTEST PATCH 00/16] Upgrade to Stretch Wei Liu
2017-10-25 16:36 ` Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171020103840.32762-17-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).