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

[Xen-devel] [PATCH RFC 5/6] COLO-Proxy: Add secondary userspace colo-proxy start args



Qemu need this args to start userspace colo-proxy.

Signed-off-by: Zhang Chen <zhangchen.fnst@xxxxxxxxxxxxxx>
---
 tools/libxl/libxl_dm.c      | 45 +++++++++++++++++++++++++++++++
 tools/libxl/libxl_nic.c     | 66 +++++++++++++++++++++++++++++++++++++++++++++
 tools/libxl/libxl_types.idl | 15 ++++++++++-
 tools/libxl/xl_cmdimpl.c    | 26 ++++++++++++++++++
 4 files changed, 151 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index b3484df..3641044 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -1248,6 +1248,51 @@ static int libxl__build_device_model_args_new(libxl__gc 
*gc,
                 /* Userspace COLO Proxy need this */
                 if (state->saved_state) {
                     /* secondary colo run */
+                    if (nics[i].sock_sec_redirector0_id &&
+                        nics[i].sock_sec_redirector0_ip &&
+                        nics[i].sock_sec_redirector0_port) {
+                        flexarray_append(dm_args, "-chardev");
+                        flexarray_append(dm_args,
+                           
GCSPRINTF("socket,id=%s,host=%s,port=%s,reconnect=1",
+                                     nics[i].sock_sec_redirector0_id,
+                                     nics[i].sock_sec_redirector0_ip,
+                                     nics[i].sock_sec_redirector0_port));
+                    }
+                    if (nics[i].sock_sec_redirector1_id &&
+                        nics[i].sock_sec_redirector1_ip &&
+                        nics[i].sock_sec_redirector1_port) {
+                        flexarray_append(dm_args, "-chardev");
+                        flexarray_append(dm_args,
+                           
GCSPRINTF("socket,id=%s,host=%s,port=%s,reconnect=1",
+                                     nics[i].sock_sec_redirector1_id,
+                                     nics[i].sock_sec_redirector1_ip,
+                                     nics[i].sock_sec_redirector1_port));
+                    }
+                    if (nics[i].filter_sec_redirector0_queue &&
+                        nics[i].filter_sec_redirector0_indev) {
+                        flexarray_append(dm_args, "-object");
+                        flexarray_append(dm_args,
+                           
GCSPRINTF("filter-redirector,id=rs1,netdev=net%d,queue=%s,indev=%s",
+                                     nics[i].devid,
+                                     nics[i].filter_sec_redirector0_queue,
+                                     nics[i].filter_sec_redirector0_indev));
+                    }
+                    if (nics[i].filter_sec_redirector1_queue &&
+                        nics[i].filter_sec_redirector1_indev) {
+                        flexarray_append(dm_args, "-object");
+                        flexarray_append(dm_args,
+                           
GCSPRINTF("filter-redirector,id=rs2,netdev=net%d,queue=%s,outdev=%s",
+                                     nics[i].devid,
+                                     nics[i].filter_sec_redirector1_queue,
+                                     nics[i].filter_sec_redirector1_outdev));
+                    }
+                    if (nics[i].filter_sec_rewriter0_queue) {
+                        flexarray_append(dm_args, "-object");
+                        flexarray_append(dm_args,
+                           
GCSPRINTF("filter-rewriter,id=rs3,netdev=net%d,queue=%s",
+                                     nics[i].devid,
+                                     nics[i].filter_sec_rewriter0_queue));
+                    }
                 } else {
                     /* primary colo run */
                     if (nics[i].sock_mirror_id &&
diff --git a/tools/libxl/libxl_nic.c b/tools/libxl/libxl_nic.c
index b7a3596..08e749f 100644
--- a/tools/libxl/libxl_nic.c
+++ b/tools/libxl/libxl_nic.c
@@ -313,6 +313,19 @@ static void libxl__device_nic_add(libxl__egc *egc, 
uint32_t domid,
         flexarray_append(back, nic->colo_compare_out);
     }
 
+    if (nic->sock_sec_redirector0_id) {
+        flexarray_append(back, "sock_redirector0_id");
+        flexarray_append(back, nic->sock_redirector0_id);
+    }
+    if (nic->sock_sec_redirector0_ip) {
+        flexarray_append(back, "sock_redirector0_ip");
+        flexarray_append(back, nic->sock_redirector0_ip);
+    }
+    if (nic->sock_sec_redirector0_port) {
+        flexarray_append(back, "sock_redirector0_port");
+        flexarray_append(back, nic->sock_redirector0_port);
+    }
+
     flexarray_append(back, "mac");
     flexarray_append(back,GCSPRINTF(LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nic->mac)));
     if (nic->ip) {
@@ -580,6 +593,59 @@ static int libxl__device_nic_from_xenstore(libxl__gc *gc,
     rc = libxl__xs_read_checked(NOGC, XBT_NULL,
                                 GCSPRINTF("%s/colo_compare_out", libxl_path),
                                 (const char **)(&nic->colo_compare_out));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_sec_redirector0_id", 
libxl_path),
+                                (const char 
**)(&nic->sock_sec_redirector0_id));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_sec_redirector0_ip", 
libxl_path),
+                                (const char 
**)(&nic->sock_sec_redirector0_ip));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_sec_redirector0_port", 
libxl_path),
+                                (const char 
**)(&nic->sock_sec_redirector0_port));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_sec_redirector1_id", 
libxl_path),
+                                (const char 
**)(&nic->sock_sec_redirector0_id));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_sec_redirector1_ip", 
libxl_path),
+                                (const char 
**)(&nic->sock_sec_redirector0_ip));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/sock_sec_redirector1_port", 
libxl_path),
+                                (const char 
**)(&nic->sock_sec_redirector0_port));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_sec_redirector0_queue", 
libxl_path),
+                                (const char 
**)(&nic->filter_sec_redirector0_queue));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_sec_redirector0_indev", 
libxl_path),
+                                (const char 
**)(&nic->filter_sec_redirector0_indev));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_sec_redirector0_outdev", 
libxl_path),
+                                (const char 
**)(&nic->filter_sec_redirector0_outdev));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_sec_redirector1_queue", 
libxl_path),
+                                (const char 
**)(&nic->filter_sec_redirector1_queue));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_sec_redirector1_indev", 
libxl_path),
+                                (const char 
**)(&nic->filter_sec_redirector1_indev));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_sec_redirector1_outdev", 
libxl_path),
+                                (const char 
**)(&nic->filter_sec_redirector1_outdev));
+    if (rc) goto out;
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+                                GCSPRINTF("%s/filter_sec_rewriter0_queue", 
libxl_path),
+                                (const char 
**)(&nic->filter_sec_rewriter0_queue));
+    if (rc) goto out;
 
     /* vif_ioemu nics use the same xenstore entries as vif interfaces */
     rc = libxl__xs_read_checked(gc, XBT_NULL,
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 1deb11b..9063ca9 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -658,7 +658,20 @@ libxl_device_nic = Struct("device_nic", [
     ("filter_redirector1_outdev", string),
     ("colo_compare_pri_in", string),
     ("colo_compare_sec_in", string),
-    ("colo_compare_out", string)
+    ("colo_compare_out", string),
+    ("sock_sec_redirector0_id", string),
+    ("sock_sec_redirector0_ip", string),
+    ("sock_sec_redirector0_port", string),
+    ("sock_sec_redirector1_id", string),
+    ("sock_sec_redirector1_ip", string),
+    ("sock_sec_redirector1_port", string),
+    ("filter_sec_redirector0_queue", string),
+    ("filter_sec_redirector0_indev", string),
+    ("filter_sec_redirector0_outdev", string),
+    ("filter_sec_redirector1_queue", string),
+    ("filter_sec_redirector1_indev", string),
+    ("filter_sec_redirector1_outdev", string),
+    ("filter_sec_rewriter0_queue", string)
     ])
 
 libxl_device_pci = Struct("device_pci", [
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 996316e..e587ab3 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1118,6 +1118,32 @@ static int parse_nic_config(libxl_device_nic *nic, 
XLU_Config **config, char *to
         replace_string(&nic->colo_compare_sec_in, oparg);
     } else if (MATCH_OPTION("colo_compare_out", token, oparg)) {
         replace_string(&nic->colo_compare_out, oparg);
+    } else if (MATCH_OPTION("sock_sec_redirector0_id", token, oparg)) {
+        replace_string(&nic->sock_sec_redirector0_id, oparg);
+    } else if (MATCH_OPTION("sock_sec_redirector0_ip", token, oparg)) {
+        replace_string(&nic->sock_sec_redirector0_ip, oparg);
+    } else if (MATCH_OPTION("sock_sec_redirector0_port", token, oparg)) {
+        replace_string(&nic->sock_sec_redirector0_port, oparg);
+    } else if (MATCH_OPTION("sock_sec_redirector1_id", token, oparg)) {
+        replace_string(&nic->sock_sec_redirector1_id, oparg);
+    } else if (MATCH_OPTION("sock_sec_redirector1_ip", token, oparg)) {
+        replace_string(&nic->sock_sec_redirector1_ip, oparg);
+    } else if (MATCH_OPTION("sock_sec_redirector1_port", token, oparg)) {
+        replace_string(&nic->sock_sec_redirector1_port, oparg);
+    } else if (MATCH_OPTION("filter_sec_redirector0_queue", token, oparg)) {
+        replace_string(&nic->filter_sec_redirector0_queue, oparg);
+    } else if (MATCH_OPTION("filter_sec_redirector0_indev", token, oparg)) {
+        replace_string(&nic->filter_sec_redirector0_indev, oparg);
+    } else if (MATCH_OPTION("filter_sec_redirector0_outdev", token, oparg)) {
+        replace_string(&nic->filter_sec_redirector0_outdev, oparg);
+    } else if (MATCH_OPTION("filter_sec_redirector1_queue", token, oparg)) {
+        replace_string(&nic->filter_sec_redirector1_queue, oparg);
+    } else if (MATCH_OPTION("filter_sec_redirector1_indev", token, oparg)) {
+        replace_string(&nic->filter_sec_redirector1_indev, oparg);
+    } else if (MATCH_OPTION("filter_sec_redirector1_outdev", token, oparg)) {
+        replace_string(&nic->filter_sec_redirector1_outdev, oparg);
+    } else if (MATCH_OPTION("filter_sec_rewriter0_queue", token, oparg)) {
+        replace_string(&nic->filter_sec_rewriter0_queue, oparg);
     } else if (MATCH_OPTION("accel", token, oparg)) {
         fprintf(stderr, "the accel parameter for vifs is currently not 
supported\n");
     } else {
-- 
2.7.4




_______________________________________________
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®.