libxl: QED disks support
authorCédric Bosdonnat <cbosdonnat@suse.com>
Tue, 13 Dec 2016 16:31:52 +0000 (17:31 +0100)
committerWei Liu <wei.liu2@citrix.com>
Tue, 13 Dec 2016 20:25:25 +0000 (20:25 +0000)
Qdisk supports qcow and qcow2, extend it to also support qed disk
format.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
[ wei: regenerate libxlu_disk_l.{c,h} ]
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
docs/misc/qemu-xen-security
docs/misc/xl-disk-configuration.txt
tools/libxl/libxl.h
tools/libxl/libxl_device.c
tools/libxl/libxl_dm.c
tools/libxl/libxl_types.idl
tools/libxl/libxl_utils.c
tools/libxl/libxlu_disk_l.c
tools/libxl/libxlu_disk_l.h
tools/libxl/libxlu_disk_l.l

index 4ab0b4dd2631b059125d0976373b235fef6f0d5b..496f7eee7ac4e4db81512bcd785c4965458f2cc9 100644 (file)
@@ -4,6 +4,7 @@ a subset of all the possible QEMU emulators. Specifically:
 
 - network: e1000, rtl8139, virtio-net
 - storage: piix3 ide, ahci, xen_disk
+- backing storage image format: raw, qcow, qcow2, vhd
 - graphics: cirris-vga, stdvga and xenfb
 - audio: sb16, es1370, ac97
 - input: Xen PV keyboard and mouse (part of xenfb), USB and PS/2
index b3402bc33adf5979ca70881903980bb004f418fa..926889b23d499d0bc7144050fb0830a70fba14e0 100644 (file)
@@ -87,7 +87,7 @@ format
 ------
 
 Description:           Specifies the format of image file.
-Supported values:      raw, qcow, qcow2, vhd
+Supported values:      raw, qcow, qcow2, vhd, qed
 Deprecated values:     None
 Default value:         raw
 
index acbf47690e85b6f80465d885c995b8b9b126a366..392446458857f30268555d816e44cef9796cd2ed 100644 (file)
@@ -1012,6 +1012,13 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, const libxl_mac *src);
  */
 #define LIBXL_HAVE_MEMKB_64BITS 1
 
+/*
+ * LIBXL_HAVE_QED
+ *
+ * If this is defined QED disk formats can be used for both HVM and PV guests.
+ */
+#define LIBXL_HAVE_QED 1
+
 typedef char **libxl_string_list;
 void libxl_string_list_dispose(libxl_string_list *sl);
 int libxl_string_list_length(const libxl_string_list *sl);
index 5e22866951bc5580863405d30452a7de267676b1..b2aeefc3ed47e30dd361fe281e5ae9654b96cd2b 100644 (file)
@@ -411,6 +411,7 @@ char *libxl__device_disk_string_of_format(libxl_disk_format format)
         case LIBXL_DISK_FORMAT_VHD: return "vhd";
         case LIBXL_DISK_FORMAT_RAW:
         case LIBXL_DISK_FORMAT_EMPTY: return "aio";
+        case LIBXL_DISK_FORMAT_QED: return "qed";
         default: return NULL;
     }
 }
index 52e6dfec34d11ae7c84475a2b66c9ebca291c688..281058de45f137d9f53c9ecc4f3a3b96e20ed8a7 100644 (file)
@@ -677,6 +677,7 @@ static const char *qemu_disk_format_string(libxl_disk_format format)
     case LIBXL_DISK_FORMAT_VHD: return "vpc";
     case LIBXL_DISK_FORMAT_RAW: return "raw";
     case LIBXL_DISK_FORMAT_EMPTY: return NULL;
+    case LIBXL_DISK_FORMAT_QED: return "qed";
     default: return NULL;
     }
 }
index a32c751b0e7a39e4c32f479fcd15987f2c760d16..a612d1f4ff549c25eacc1a1597806c66bf02980e 100644 (file)
@@ -114,6 +114,7 @@ libxl_disk_format = Enumeration("disk_format", [
     (3, "VHD"),
     (4, "RAW"),
     (5, "EMPTY"),
+    (6, "QED"),
     ])
 
 libxl_disk_backend = Enumeration("disk_backend", [
index 49cbaa5b70d5313c46b428d27503f9ca759155e3..507ee56c7c2c5112b38376e19440e517351c2236 100644 (file)
@@ -317,6 +317,8 @@ int libxl_string_to_backend(libxl_ctx *ctx, char *s, libxl_disk_backend *backend
             *backend = LIBXL_DISK_BACKEND_QDISK;
         } else if (!strcmp(p, "qcow2")) {
             *backend = LIBXL_DISK_BACKEND_QDISK;
+        } else if (!strcmp(p, "qed")) {
+            *backend = LIBXL_DISK_BACKEND_QDISK;
         }
     }
 out:
index 54160caa667ac189a13d03f177d1a54defc2d5d0..944990732b0b594354c20a986722dda51352543d 100644 (file)
@@ -953,6 +953,7 @@ static void setformat(DiskParseContext *dpc, const char *str) {
     else if (!strcmp(str,"qcow2"))  DSET(dpc,format,FORMAT,str,QCOW2);
     else if (!strcmp(str,"vhd"))    DSET(dpc,format,FORMAT,str,VHD);
     else if (!strcmp(str,"empty"))  DSET(dpc,format,FORMAT,str,EMPTY);
+    else if (!strcmp(str,"qed"))    DSET(dpc,format,FORMAT,str,QED);
     else xlu__disk_err(dpc,str,"unknown value for format");
 }
 
@@ -1001,7 +1002,7 @@ static int vdev_and_devtype(DiskParseContext *dpc, char *str) {
 #define DPC ((DiskParseContext*)yyextra)
 
 
-#line 1005 "libxlu_disk_l.c"
+#line 1006 "libxlu_disk_l.c"
 
 #define INITIAL 0
 #define LEXERR 1
@@ -1274,12 +1275,12 @@ YY_DECL
                }
 
        {
-#line 165 "libxlu_disk_l.l"
+#line 166 "libxlu_disk_l.l"
 
 
  /*----- the scanner rules which do the parsing -----*/
 
-#line 1283 "libxlu_disk_l.c"
+#line 1284 "libxlu_disk_l.c"
 
        while ( 1 )             /* loops until end-of-file is reached */
                {
@@ -1368,135 +1369,135 @@ do_action:    /* This label is used only to access EOF actions. */
 case 1:
 /* rule 1 can match eol */
 YY_RULE_SETUP
-#line 169 "libxlu_disk_l.l"
+#line 170 "libxlu_disk_l.l"
 { /* ignore whitespace before parameters */ }
        YY_BREAK
 /* ordinary parameters setting enums or strings */
 case 2:
 /* rule 2 can match eol */
 YY_RULE_SETUP
-#line 173 "libxlu_disk_l.l"
+#line 174 "libxlu_disk_l.l"
 { STRIP(','); setformat(DPC, FROMEQUALS); }
        YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 175 "libxlu_disk_l.l"
+#line 176 "libxlu_disk_l.l"
 { DPC->disk->is_cdrom = 1; }
        YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 176 "libxlu_disk_l.l"
+#line 177 "libxlu_disk_l.l"
 { DPC->disk->is_cdrom = 1; }
        YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 177 "libxlu_disk_l.l"
+#line 178 "libxlu_disk_l.l"
 { DPC->disk->is_cdrom = 0; }
        YY_BREAK
 case 6:
 /* rule 6 can match eol */
 YY_RULE_SETUP
-#line 178 "libxlu_disk_l.l"
+#line 179 "libxlu_disk_l.l"
 { xlu__disk_err(DPC,yytext,"unknown value for type"); }
        YY_BREAK
 case 7:
 /* rule 7 can match eol */
 YY_RULE_SETUP
-#line 180 "libxlu_disk_l.l"
+#line 181 "libxlu_disk_l.l"
 { STRIP(','); setaccess(DPC, FROMEQUALS); }
        YY_BREAK
 case 8:
 /* rule 8 can match eol */
 YY_RULE_SETUP
-#line 181 "libxlu_disk_l.l"
+#line 182 "libxlu_disk_l.l"
 { STRIP(','); SAVESTRING("backend", backend_domname, FROMEQUALS); }
        YY_BREAK
 case 9:
 /* rule 9 can match eol */
 YY_RULE_SETUP
-#line 182 "libxlu_disk_l.l"
+#line 183 "libxlu_disk_l.l"
 { STRIP(','); setbackendtype(DPC,FROMEQUALS); }
        YY_BREAK
 case 10:
 /* rule 10 can match eol */
 YY_RULE_SETUP
-#line 184 "libxlu_disk_l.l"
+#line 185 "libxlu_disk_l.l"
 { STRIP(','); SAVESTRING("vdev", vdev, FROMEQUALS); }
        YY_BREAK
 case 11:
 /* rule 11 can match eol */
 YY_RULE_SETUP
-#line 185 "libxlu_disk_l.l"
+#line 186 "libxlu_disk_l.l"
 { STRIP(','); SAVESTRING("script", script, FROMEQUALS); }
        YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 186 "libxlu_disk_l.l"
+#line 187 "libxlu_disk_l.l"
 { DPC->disk->direct_io_safe = 1; }
        YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 187 "libxlu_disk_l.l"
+#line 188 "libxlu_disk_l.l"
 { libxl_defbool_set(&DPC->disk->discard_enable, true); }
        YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 188 "libxlu_disk_l.l"
+#line 189 "libxlu_disk_l.l"
 { libxl_defbool_set(&DPC->disk->discard_enable, false); }
        YY_BREAK
 /* Note that the COLO configuration settings should be considered unstable.
   * They may change incompatibly in future versions of Xen. */
 case 15:
 YY_RULE_SETUP
-#line 191 "libxlu_disk_l.l"
+#line 192 "libxlu_disk_l.l"
 { libxl_defbool_set(&DPC->disk->colo_enable, true); }
        YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 192 "libxlu_disk_l.l"
+#line 193 "libxlu_disk_l.l"
 { libxl_defbool_set(&DPC->disk->colo_enable, false); }
        YY_BREAK
 case 17:
 /* rule 17 can match eol */
 YY_RULE_SETUP
-#line 193 "libxlu_disk_l.l"
+#line 194 "libxlu_disk_l.l"
 { STRIP(','); SAVESTRING("colo-host", colo_host, FROMEQUALS); }
        YY_BREAK
 case 18:
 /* rule 18 can match eol */
 YY_RULE_SETUP
-#line 194 "libxlu_disk_l.l"
+#line 195 "libxlu_disk_l.l"
 { STRIP(','); setcoloport(DPC, FROMEQUALS); }
        YY_BREAK
 case 19:
 /* rule 19 can match eol */
 YY_RULE_SETUP
-#line 195 "libxlu_disk_l.l"
+#line 196 "libxlu_disk_l.l"
 { STRIP(','); SAVESTRING("colo-export", colo_export, FROMEQUALS); }
        YY_BREAK
 case 20:
 /* rule 20 can match eol */
 YY_RULE_SETUP
-#line 196 "libxlu_disk_l.l"
+#line 197 "libxlu_disk_l.l"
 { STRIP(','); SAVESTRING("active-disk", active_disk, FROMEQUALS); }
        YY_BREAK
 case 21:
 /* rule 21 can match eol */
 YY_RULE_SETUP
-#line 197 "libxlu_disk_l.l"
+#line 198 "libxlu_disk_l.l"
 { STRIP(','); SAVESTRING("hidden-disk", hidden_disk, FROMEQUALS); }
        YY_BREAK
 /* the target magic parameter, eats the rest of the string */
 case 22:
 YY_RULE_SETUP
-#line 201 "libxlu_disk_l.l"
+#line 202 "libxlu_disk_l.l"
 { STRIP(','); SAVESTRING("target", pdev_path, FROMEQUALS); }
        YY_BREAK
 /* unknown parameters */
 case 23:
 /* rule 23 can match eol */
 YY_RULE_SETUP
-#line 205 "libxlu_disk_l.l"
+#line 206 "libxlu_disk_l.l"
 { xlu__disk_err(DPC,yytext,"unknown parameter"); }
        YY_BREAK
 /* deprecated prefixes */
@@ -1504,7 +1505,7 @@ YY_RULE_SETUP
    * matched the whole string, so these patterns take precedence */
 case 24:
 YY_RULE_SETUP
-#line 212 "libxlu_disk_l.l"
+#line 213 "libxlu_disk_l.l"
 {
                     STRIP(':');
                     DPC->had_depr_prefix=1; DEPRECATE("use `[format=]...,'");
@@ -1513,7 +1514,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 218 "libxlu_disk_l.l"
+#line 219 "libxlu_disk_l.l"
 {
                     char *newscript;
                     STRIP(':');
@@ -1532,12 +1533,12 @@ case 26:
 yyg->yy_c_buf_p = yy_cp = yy_bp + 8;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 231 "libxlu_disk_l.l"
+#line 232 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
        YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 232 "libxlu_disk_l.l"
+#line 233 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
        YY_BREAK
 case 28:
@@ -1545,7 +1546,7 @@ case 28:
 yyg->yy_c_buf_p = yy_cp = yy_bp + 4;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 233 "libxlu_disk_l.l"
+#line 234 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
        YY_BREAK
 case 29:
@@ -1553,7 +1554,7 @@ case 29:
 yyg->yy_c_buf_p = yy_cp = yy_bp + 6;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 234 "libxlu_disk_l.l"
+#line 235 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
        YY_BREAK
 case 30:
@@ -1561,7 +1562,7 @@ case 30:
 yyg->yy_c_buf_p = yy_cp = yy_bp + 5;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 235 "libxlu_disk_l.l"
+#line 236 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
        YY_BREAK
 case 31:
@@ -1569,13 +1570,13 @@ case 31:
 yyg->yy_c_buf_p = yy_cp = yy_bp + 4;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 236 "libxlu_disk_l.l"
+#line 237 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
        YY_BREAK
 case 32:
 /* rule 32 can match eol */
 YY_RULE_SETUP
-#line 238 "libxlu_disk_l.l"
+#line 239 "libxlu_disk_l.l"
 {
                  xlu__disk_err(DPC,yytext,"unknown deprecated disk prefix");
                  return 0;
@@ -1585,7 +1586,7 @@ YY_RULE_SETUP
 case 33:
 /* rule 33 can match eol */
 YY_RULE_SETUP
-#line 245 "libxlu_disk_l.l"
+#line 246 "libxlu_disk_l.l"
 {
     STRIP(',');
 
@@ -1614,7 +1615,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 34:
 YY_RULE_SETUP
-#line 271 "libxlu_disk_l.l"
+#line 272 "libxlu_disk_l.l"
 {
     BEGIN(LEXERR);
     yymore();
@@ -1622,17 +1623,17 @@ YY_RULE_SETUP
        YY_BREAK
 case 35:
 YY_RULE_SETUP
-#line 275 "libxlu_disk_l.l"
+#line 276 "libxlu_disk_l.l"
 {
     xlu__disk_err(DPC,yytext,"bad disk syntax"); return 0;
 }
        YY_BREAK
 case 36:
 YY_RULE_SETUP
-#line 278 "libxlu_disk_l.l"
+#line 279 "libxlu_disk_l.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
        YY_BREAK
-#line 1636 "libxlu_disk_l.c"
+#line 1637 "libxlu_disk_l.c"
                        case YY_STATE_EOF(INITIAL):
                        case YY_STATE_EOF(LEXERR):
                                yyterminate();
@@ -2722,4 +2723,4 @@ void xlu__disk_yyfree (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 277 "libxlu_disk_l.l"
+#line 278 "libxlu_disk_l.l"
index 794274f552e7436d73b1d1ce6649490f07b94123..4d60d5c563b581ab38a1fa85336245781da55626 100644 (file)
@@ -348,7 +348,7 @@ extern int xlu__disk_yylex (yyscan_t yyscanner);
 #undef YY_DECL
 #endif
 
-#line 277 "libxlu_disk_l.l"
+#line 278 "libxlu_disk_l.l"
 
 #line 354 "libxlu_disk_l.h"
 #undef xlu__disk_yyIN_HEADER
index 5b6db221e416e21cee79947148db1899c12fd377..97039a280096e4455fc3e2ff195cf1ee03e8f5b0 100644 (file)
@@ -102,6 +102,7 @@ static void setformat(DiskParseContext *dpc, const char *str) {
     else if (!strcmp(str,"qcow2"))  DSET(dpc,format,FORMAT,str,QCOW2);
     else if (!strcmp(str,"vhd"))    DSET(dpc,format,FORMAT,str,VHD);
     else if (!strcmp(str,"empty"))  DSET(dpc,format,FORMAT,str,EMPTY);
+    else if (!strcmp(str,"qed"))    DSET(dpc,format,FORMAT,str,QED);
     else xlu__disk_err(dpc,str,"unknown value for format");
 }