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

[Xen-devel] [PATCH v18 09/11] xl/remus: add a cmdline switch to disable disk replication



Disk replication is enabled by default. This patch adds a cmdline
switch to 'xl remus' command to explicitly disable disk replication.
A new boolean field 'diskbuf' is added to the libxl_domain_remus_info
structure to represent this configuration option inside libxl.

Note: Disabling disk replication requires enabling unsafe mode.

Signed-off-by: Yang Hongyang <yanghy@xxxxxxxxxxxxxx>
Signed-off-by: Shriram Rajagopalan <rshriram@xxxxxxxxx>
---
 docs/man/xl.pod.1           |  6 +++++-
 tools/libxl/libxl.c         |  9 +++++----
 tools/libxl/libxl_types.idl |  1 +
 tools/libxl/xl_cmdimpl.c    | 13 +++++++++----
 tools/libxl/xl_cmdtable.c   |  5 +++--
 5 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/docs/man/xl.pod.1 b/docs/man/xl.pod.1
index 2e5c36a..f544945 100644
--- a/docs/man/xl.pod.1
+++ b/docs/man/xl.pod.1
@@ -431,7 +431,7 @@ Enable Remus HA for domain. By default B<xl> relies on ssh 
as a transport
 mechanism between the two hosts.
 
 N.B: Remus support in xl is still in experimental (proof-of-concept) phase.
-     There is no support for disk buffering at the moment.
+     Disk replication support is limited to DRBD disks.
 
 B<OPTIONS>
 
@@ -474,6 +474,10 @@ Generally useful for debugging. Requires enabling unsafe 
mode.
 
 Disable network output buffering. Requires enabling unsafe mode.
 
+=item B<-d>
+
+Disable disk replication. Requires enabling unsafe mode.
+
 =back
 
 =item B<pause> I<domain-id>
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index b329a04..8182966 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -797,9 +797,9 @@ int libxl_domain_remus_start(libxl_ctx *ctx, 
libxl_domain_remus_info *info,
     libxl__domain_suspend_state *dss;
     int rc;
 
-    if (!info->unsafe && (info->blackhole || !info->netbuf)) {
-        LOG(ERROR, "Unsafe mode must be enabled to replicate to /dev/null and "
-                   "disable network buffering");
+    if (!info->unsafe && (info->blackhole || !info->netbuf || !info->diskbuf)) 
{
+        LOG(ERROR, "Unsafe mode must be enabled to replicate to /dev/null,"
+                   "disable network buffering and disk replication");
         goto out;
     }
 
@@ -833,7 +833,8 @@ int libxl_domain_remus_start(libxl_ctx *ctx, 
libxl_domain_remus_info *info,
         rds->device_kind_flags |= LIBXL__REMUS_DEVICE_NIC;
     }
 
-    rds->device_kind_flags |= LIBXL__REMUS_DEVICE_DISK;
+    if (info->diskbuf)
+        rds->device_kind_flags |= LIBXL__REMUS_DEVICE_DISK;
 
     rds->ao = ao;
     rds->egc = egc;
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 78dcee6..542dad3 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -593,6 +593,7 @@ libxl_domain_remus_info = Struct("domain_remus_info",[
     ("compression",  bool),
     ("netbuf",       bool),
     ("netbufscript", string),
+    ("diskbuf",      bool),
     ])
 
 libxl_event_type = Enumeration("event_type", [
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index ea77116..6ea7894 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -7179,8 +7179,9 @@ int main_remus(int argc, char **argv)
     r_info.blackhole = 0;
     r_info.compression = 1;
     r_info.netbuf = 1;
+    r_info.diskbuf = 1;
 
-    SWITCH_FOREACH_OPT(opt, "Fbuni:s:N:e", NULL, "remus", 2) {
+    SWITCH_FOREACH_OPT(opt, "Fbundi:s:N:e", NULL, "remus", 2) {
     case 'i':
         r_info.interval = atoi(optarg);
         break;
@@ -7199,6 +7200,9 @@ int main_remus(int argc, char **argv)
     case 'N':
         r_info.netbufscript = optarg;
         break;
+    case 'd':
+        r_info.diskbuf = 0;
+        break;
     case 's':
         ssh_command = optarg;
         break;
@@ -7207,9 +7211,10 @@ int main_remus(int argc, char **argv)
         break;
     }
 
-    if (!r_info.unsafe && (r_info.blackhole || !r_info.netbuf)) {
-        perror("Unsafe mode must be enabled to replicate to /dev/null and "
-               "disable network buffering");
+    if (!r_info.unsafe &&
+        (r_info.blackhole || !r_info.netbuf || !r_info.diskbuf)) {
+        perror("Unsafe mode must be enabled to replicate to /dev/null,"
+               "disable network buffering and disk replication");
         exit(-1);
     }
 
diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c
index 808f400..3b33b05 100644
--- a/tools/libxl/xl_cmdtable.c
+++ b/tools/libxl/xl_cmdtable.c
@@ -493,11 +493,12 @@ struct cmd_spec cmd_table[] = {
       "                        of the domain.\n"
       "-N <netbufscript>       Use netbufscript to setup network buffering 
instead of the\n"
       "                        default script 
(/etc/xen/scripts/remus-netbuf-setup).\n"
-      "-F                      Enable unsafe configurations [-b|-n flags]. Use 
this option\n"
+      "-F                      Enable unsafe configurations [-b|-n|-d flags]. 
Use this option\n"
       "                        with caution as failover may not work as 
intended.\n"
       "-b                      Replicate memory checkpoints to /dev/null 
(blackhole).\n"
       "                        Works only in unsafe mode.\n"
-      "-n                      Disable network output buffering. Works only in 
unsafe mode."
+      "-n                      Disable network output buffering. Works only in 
unsafe mode.\n"
+      "-d                      Disable disk replication. Works only in unsafe 
mode."
     },
 #endif
     { "devd",
-- 
1.9.1


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


 


Rackspace

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