Skip to contentSkip to conversation

libxl and docs: small improvements in qdisk support

PATCH Applied Jim Fehlig 4 participants 8 messages Feb 17, 2016 – Feb 19, 2016

lore
Share & tools
lore

Jim Fehlig

author
#0 lore raw

v2 cover libxl and docs: small improvements in qdisk support

This series contains a few improvments related to libxl's support for the various qdisk types. Patch1 is a small fix for libxlu_cfg to error when encountering unknown backslash- escaped characters instead of silently dropping them. Patch2 is actually unrelated and fixes a typo noticed while reviewing xl-disk-configuration.txt, which is improved a bit in patch3 wrt target= syntax.

V2:
Add forgotten SOB in all patches

Improve patch3 doc text

Jim Fehlig (3):
libxlu_cfg: reject unknown characters following '\'
docs: fix typo in xl-disk-configuration.txt
docs: add more info about target= in disk config

 docs/misc/xl-disk-configuration.txt | 12 ++++++++++--
 tools/libxl/libxlu_cfg.c            |  5 +++++
 2 files changed, 15 insertions(+), 2 deletions(-)
Signature · 1 line
2.1.4
author
#1 lore raw

PATCH v2 1/3 libxlu_cfg: reject unknown characters following '\'

When dequoting config strings in xlu__cfgl_dequote(), unknown characters following a '\', and the '\' itself, are discarded. E.g. a disk configuration string containing

rbd:pool/image:mon_host=192.168.0.100\:6789

would be dequoted as

rbd:pool/image:mon_host=192.168.0.1006789

Instead of discarding the '\' and unknown character, reject the string and set error to EINVAL.

---
 tools/libxl/libxlu_cfg.c | 5 +++++
 1 file changed, 5 insertions(+)
tools/libxl/libxlu_cfg.c +5 -0
index 1d70909..5838f68 100644
@@ -533,6 +533,11 @@ char *xlu__cfgl_dequote(CfgParseContext *ctx, const char *src) {
                 NUMERIC_CHAR(2,2,16,"hex");
             } else if (nc>='0' && nc<='7') {
                 NUMERIC_CHAR(1,3,10,"octal");
+            } else {
+                xlu__cfgl_lexicalerror(ctx,
+                           "invalid character after backlash in quoted string");
+                ctx->err= EINVAL;
+                goto x;
             }
             assert(p <= src+len-1);
         } else {
Signature · 1 line
2.1.4
author
#3 lore raw

PATCH v2 2/3 docs: fix typo in xl-disk-configuration.txt

In reply to Jim Fehlig
---
 docs/misc/xl-disk-configuration.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
docs/misc/xl-disk-configuration.txt +1 -1
index 6a2118d..29f6ddb 100644
@@ -160,7 +160,7 @@ Mandatory:             No
 Default value:         Automatically determine which backend to use.
 
 This does not affect the guest's view of the device.  It controls
-which software implementation of the Xen backend driver us used.
+which software implementation of the Xen backend driver is used.
 
 Not all backend drivers support all combinations of other options.
 For example, "phy" does not support formats other than "raw".
Signature · 1 line
2.1.4
author
#5 lore raw

PATCH v2 3/3 docs: add more info about target= in disk config

In reply to Jim Fehlig

target= in disk config can be used to convey arbitrary configuration information to backends. Add a bit more info to xl-disk-configuration.txt to clarify this, including some simple nbd and rbd qdisk configurations.

---
 docs/misc/xl-disk-configuration.txt | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
docs/misc/xl-disk-configuration.txt +9 -1
index 29f6ddb..79f1e4a 100644
@@ -75,7 +75,15 @@ Special syntax:
    the target was already specified as a positional parameter.  This
    is the only way to specify a target string containing metacharacters
    such as commas and (in some cases) colons, which would otherwise be
-   misinterpreted.
+   misinterpreted. Meta-information in a target string can be used to
+   specify configuration information for a qdisk block backend. For
+   example the nbd and rbd qdisk block backends can be configured with
+
+     target=nbd:192.168.0.1:5555
+     target=rbd:pool/image:mon_host=192.186.0.1\\:6789
+
+   Note that '\' is used to escape metacharacters. Literal backslashes
+   in target= strings must use '\\'.
 
    Future parameter and flag names will start with an ascii letter and
    contain only ascii alphanumerics, hyphens and underscores, and will
Signature · 1 line
2.1.4
#2 lore raw

Re: [PATCH V2 1/3] libxlu_cfg: reject unknown characters following '\'

In reply to Jim Fehlig
Quoted 8 lines · Jim Fehlig

When dequoting config strings in xlu__cfgl_dequote(), unknown characters following a '\', and the '\' itself, are discarded. E.g. a disk configuration string containing

rbd:pool/image:mon_host=192.168.0.100\:6789

would be dequoted as

Quoted 7 lines

rbd:pool/image:mon_host=192.168.0.1006789

Instead of discarding the '\' and unknown character, reject the string and set error to EINVAL.

applied

Quoted 28 lines
---
 tools/libxl/libxlu_cfg.c | 5 +++++
 1 file changed, 5 insertions(+)
tools/libxl/libxlu_cfg.c +5 -0
index 1d70909..5838f68 100644
@@ -533,6 +533,11 @@ char *xlu__cfgl_dequote(CfgParseContext *ctx, const char *src) {
                 NUMERIC_CHAR(2,2,16,"hex");
             } else if (nc>='0' && nc<='7') {
                 NUMERIC_CHAR(1,3,10,"octal");
+            } else {
+                xlu__cfgl_lexicalerror(ctx,
+                           "invalid character after backlash in quoted string");
+                ctx->err= EINVAL;
+                goto x;
             }
             assert(p <= src+len-1);
         } else {
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#4 lore raw

Re: [PATCH V2 2/3] docs: fix typo in xl-disk-configuration.txt

In reply to Jim Fehlig
Quoted 2 lines · Jim Fehlig

applied

Quoted 25 lines
---
 docs/misc/xl-disk-configuration.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
docs/misc/xl-disk-configuration.txt +1 -1
index 6a2118d..29f6ddb 100644
@@ -160,7 +160,7 @@ Mandatory:             No
 Default value:         Automatically determine which backend to use.
 
 This does not affect the guest's view of the device.  It controls
-which software implementation of the Xen backend driver us used.
+which software implementation of the Xen backend driver is used.
 
 Not all backend drivers support all combinations of other options.
 For example, "phy" does not support formats other than "raw".
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#7 lore raw

Re: [PATCH V2 3/3] docs: add more info about target= in disk config

Ian Campbell writes ("Re: [PATCH V2 3/3] docs: add more info about target= in disk config"):

Quoted 9 lines · Jim Fehlig
Quoted 6 lines

target= in disk config can be used to convey arbitrary configuration information to backends. Add a bit more info to xl-disk-configuration.txt to clarify this, including some simple nbd and rbd qdisk configurations.

I see you've addressed Ian Campbell's comments but please see my reply to v1.

Thanks,
Ian.