Skip to contentSkip to conversation

:make libxl uses config file compatible with xm config file

PATCH In review Jun Zhu (Intern) 2 participants 2 messages Sep 21, 2010 – Sep 22, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 :make libxl uses config file compatible with xm config file

disk = [ 'phy:sdb1,xvdb,w',] or disk = ['phy:va/*'] can be parsed by xm, but cannot be used by xl. This patch makes libxl uses config file compatible with xm's config file.

tools/libxl/xl_cmdimpl.c +4 -1
diff -r f8f4221267a2 tools/libxl/xl_cmdimpl.c
@@ -781,7 +781,10 @@ static void parse_config_data(const char
             p = strtok(NULL, ",");
             while (*p == ' ')
                 p++;
-            disk->physpath= strdup(p);
+            if (disk->phystype == PHYSTYPE_PHY && strncmp(p, "/dev", strlen("/dev")))
+                asprintf(&disk->physpath, "/dev/%s", p);
+            else
+                disk->physpath= strdup(p);
             p = strtok(NULL, ",");
             while (*p == ' ')
                 p++;

Jun Zhu
Citrix Systems UK

#1 lore raw
Quoted 9 lines · Jun Zhu (Intern)

disk = [ 'phy:sdb1,xvdb,w',] or disk = ['phy:va/*'] can be parsed by xm, but cannot be used by xl. This patch makes libxl uses config file compatible with xm's config file.

diff -r f8f4221267a2 tools/libxl/xl_cmdimpl.c

tools/libxl/xl_cmdimpl.c +0 -0
@@ -781,7 +781,10 @@ static void parse_config_data(const char
             p = strtok(NULL, ",");

tools/libxl/xl_cmdimpl.c static void parse_config_data(const char · line 790

Quoted 10 lines
tools/libxl/xl_cmdimpl.c +4 -1
             while (*p == ' ')
                 p++;
-            disk->physpath= strdup(p);
+            if (disk->phystype == PHYSTYPE_PHY && strncmp(p, "/dev", strlen("/dev")))
+                asprintf(&disk->physpath, "/dev/%s", p);
+            else
+                disk->physpath= strdup(p);
             p = strtok(NULL, ",");
             while (*p == ' ')
                 p++;

strncmp is not enough here: you need to check for the existence of the device and if it is not present than you can try prepending "/dev" and see if the new device is present.