From nobody Sat Jul 12 10:03:06 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1498788248436526.9859931275198; Thu, 29 Jun 2017 19:04:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2DB8804E9; Fri, 30 Jun 2017 02:04:05 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B5C027DB45; Fri, 30 Jun 2017 02:04:05 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 94EA741F78; Fri, 30 Jun 2017 02:04:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5U23VEV023048 for ; Thu, 29 Jun 2017 22:03:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 59B807DB46; Fri, 30 Jun 2017 02:03:31 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A4D1D17CDE; Fri, 30 Jun 2017 02:03:29 +0000 (UTC) Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B1B28315FB7; Fri, 30 Jun 2017 02:03:25 +0000 (UTC) Received: by mail-pg0-f68.google.com with SMTP id u62so13727937pgb.0; Thu, 29 Jun 2017 19:03:25 -0700 (PDT) Received: from localhost.localdomain.localdomain ([172.56.38.136]) by smtp.gmail.com with ESMTPSA id u194sm12741850pgb.24.2017.06.29.19.03.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Jun 2017 19:03:24 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E2DB8804E9 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E2DB8804E9 Authentication-Results: mx1.redhat.com; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bMkfvEec" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B1B28315FB7 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=ashmit602@gmail.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B1B28315FB7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=LyL2HUoEKM3NMyvTjiXCoO9ZQZbkc5ElQp8ZsyuCk8k=; b=bMkfvEecKEWhMNUVivu9u5RomiPX5UHwDEbSssBMvmOI6h21+jlRP/+HMiMvR/lcDI fT8VrBfMcfSaulGohLp6JFLgu+3g9SVROAWPUW9opZoXfENeMNfqVcRXw8eRZaCfUn/Y I+7QM78vlkKlx/fmor4XEIZfzJbZBfSad5HUkEOuLQ2JdupFakAyCLet9ngRe4IBkoxK NRhg8wH89/f+dQOP+ohmPw5QiBYeDjHWWvT3pg3FAFYHRKXKaqbRtth5K3nWX8zZ40UR LY1KnJrxN8j6tPktJdukZ70cHuEuAxbgL1EAVB4Y2lMfTRGLqpDFfDWffWBFnLkHlzD6 lJZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=LyL2HUoEKM3NMyvTjiXCoO9ZQZbkc5ElQp8ZsyuCk8k=; b=ViXo7A1uqS1z8ubk8DFgUbo9P0KpgZWiFQN/tmUWZVCM18vNgG6tS72+YPA7KmyT1F ohGWkewwOrDEQWnWK+2LKuSSqyWPWm1k9PYFS5IOH78nwLe2jMOvJci5jDtPMFspzxK3 Zu/rx5j8uwg5GviBalc07oP3Wg6YFgDAwsM7lZFsDD4mRwzCWRpmkljM4otgiX8GQeWN JXjTwyN9hAP7Oe3ksmNG1G5Ng6vh8uA0lMaOYHIELl3lMHqo1bC7uPDDuhD5VjmViQO7 jEOKiE8IxDKQvNnRjb0mtFQeEX0mcQJUJg8Iiq6CQ2oYasss8lqqB2XLPLpJrAtAKjkD WtTg== X-Gm-Message-State: AKS2vOyAE1ow+Dy8vTE5Ni9JBKB3oslsVR6izPCUuLR6vITYFiil0ruy WvGNAEUaJCh8Zr84nr4= X-Received: by 10.98.75.156 with SMTP id d28mr19548066pfj.135.1498788204669; Thu, 29 Jun 2017 19:03:24 -0700 (PDT) From: Ashish Mittal X-Google-Original-From: Ashish Mittal To: libvir-list@redhat.com, jferlan@redhat.com, pbonzini@redhat.com, berrange@redhat.com, jcody@redhat.com, ashish.mittal@veritas.com, stefanha@gmail.com, Ketan.Nilangekar@veritas.com, Nitin.Jerath@veritas.com, venkatesha.mg@veritas.com, pkrempa@redhat.com, areis@redhat.com, pchavva@redhat.com, ashmit602@gmail.com Date: Thu, 29 Jun 2017 19:02:39 -0700 Message-Id: <1498788161-46841-2-git-send-email-Ashish.Mittal@veritas.com> In-Reply-To: <1498788161-46841-1-git-send-email-Ashish.Mittal@veritas.com> References: <1498788161-46841-1-git-send-email-Ashish.Mittal@veritas.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 30 Jun 2017 02:03:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 30 Jun 2017 02:03:26 +0000 (UTC) for IP:'74.125.83.68' DOMAIN:'mail-pg0-f68.google.com' HELO:'mail-pg0-f68.google.com' FROM:'ashmit602@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.42 * (BAYES_50, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, SPF_PASS) 74.125.83.68 mail-pg0-f68.google.com 74.125.83.68 mail-pg0-f68.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 1/3] Add support for Veritas HyperScale (VxHS) block device protocol X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 30 Jun 2017 02:04:07 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Ashish Mittal Sample XML for a VxHS disk: eb90327c-8302-4725-9e1b-4e85ed4dc251
Signed-off-by: Ashish Mittal --- v2 changelog: (1) Added code for JSON parsing of a VxHS vdisk. (2) Added test case to verify JSON parsing. (3) Added missing switch-case checks for VIR_STORAGE_NET_PROTOCOL_VXHS. (4) Fixed line wrap in qemuxml2argv-disk-drive-network-vxhs.args. v3 changelog: (1) Implemented the modern syntax for VxHS disk specification. (2) Changed qemuxml2argvdata VxHS test case to verify the new syntax. (3) Added a negative test case to check failure when multiple hosts are specified for a VxHS disk. v4 changelog: (1) Fixes per review comments from v3. (2) Had to remove a test from the previous version that checked for error when multiple hosts are specified for VxHS device. This started failing virschematest with the error "XML document failed to validate against schema" as the docs/schemas/domain.rng specifies only a single host. docs/formatdomain.html.in | 15 ++++- docs/schemas/domaincommon.rng | 13 ++++ src/libxl/libxl_conf.c | 1 + src/qemu/qemu_command.c | 70 ++++++++++++++++++= ++++ src/qemu/qemu_driver.c | 3 + src/qemu/qemu_parse_command.c | 25 ++++++++ src/util/virstoragefile.c | 64 ++++++++++++++++++= +- src/util/virstoragefile.h | 1 + src/xenconfig/xen_xl.c | 1 + .../qemuargv2xml-disk-drive-network-vxhs-fail.args | 24 ++++++++ tests/qemuargv2xmltest.c | 17 +++++- .../qemuxml2argv-disk-drive-network-vxhs.args | 25 ++++++++ .../qemuxml2argv-disk-drive-network-vxhs.xml | 34 +++++++++++ tests/qemuxml2argvtest.c | 1 + tests/virstoragetest.c | 19 ++++++ 15 files changed, 308 insertions(+), 5 deletions(-) create mode 100644 tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-= vxhs-fail.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-= vxhs.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-= vxhs.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 36bea67..62d67f4 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2501,9 +2501,9 @@
The protocol attribute specifies the protocol to access to the requested image. Possible values are "nbd", - "iscsi", "rbd", "sheepdog" or "gluster". If the - protocol attribute is "rbd", "sheepdog" or - "gluster", an additional attribute name is + "iscsi", "rbd", "sheepdog", "gluster" or "vxhs". If the + protocol attribute is "rbd", "sheepdog", "glust= er" + or "vxhs", an additional attribute name is mandatory to specify which volume/image will be used. For "n= bd", the name attribute is optional. For "iscsi" (since 1.0.4), the name @@ -2511,6 +2511,9 @@ target's name by a slash (e.g., iqn.2013-07.com.example:iscsi-pool/1). If not specified, the default LUN is zero. + For "vxhs" (since 3.3.0), the + name is the UUID of the volume, assigned by the + HyperScale sever. Since 0.8.7
volume
@@ -2613,6 +2616,12 @@ one or more (Since 2.1.0= ), just one prior to that 24007 + + vxhs + a server running Veritas HyperScale daemon + only one + 9999 +

gluster supports "tcp", "rdma", "unix" as valid values for the diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index bdf7103..7525a2a 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1613,6 +1613,18 @@ =20 + + + + + vxhs + + + + + + + network @@ -1623,6 +1635,7 @@ + =20 diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 938e09d..f12c796 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -665,6 +665,7 @@ libxlMakeNetworkDiskSrcStr(virStorageSourcePtr src, case VIR_STORAGE_NET_PROTOCOL_GLUSTER: case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG: case VIR_STORAGE_NET_PROTOCOL_SSH: + case VIR_STORAGE_NET_PROTOCOL_VXHS: case VIR_STORAGE_NET_PROTOCOL_LAST: case VIR_STORAGE_NET_PROTOCOL_NONE: virReportError(VIR_ERR_NO_SUPPORT, diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c53ab97..8e00782 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -524,6 +524,7 @@ qemuNetworkDriveGetPort(int protocol, return 0; =20 case VIR_STORAGE_NET_PROTOCOL_RBD: + case VIR_STORAGE_NET_PROTOCOL_VXHS: case VIR_STORAGE_NET_PROTOCOL_LAST: case VIR_STORAGE_NET_PROTOCOL_NONE: /* not applicable */ @@ -931,6 +932,65 @@ qemuBuildGlusterDriveJSON(virStorageSourcePtr src) } =20 =20 +#define QEMU_DEFAULT_VXHS_PORT "9999" + +/* Build the VxHS host object */ +static virJSONValuePtr +qemuBuildVxHSDriveJSONHost(virStorageSourcePtr src) +{ + virJSONValuePtr server =3D NULL; + virStorageNetHostDefPtr host; + const char *portstr; + + if (src->nhosts !=3D 1) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("protocol VxHS accepts only one host")); + goto cleanup; + } + + host =3D src->hosts; + portstr =3D host->port; + + if (!portstr) + portstr =3D QEMU_DEFAULT_VXHS_PORT; + + if (virJSONValueObjectCreate(&server, + "s:host", host->name, + "s:port", portstr, + NULL) < 0) + server =3D NULL; + + cleanup: + return server; +} + + +static virJSONValuePtr +qemuBuildVxHSDriveJSON(virStorageSourcePtr src) +{ + const char *protocol =3D virStorageNetProtocolTypeToString(src->protoc= ol); + virJSONValuePtr server =3D NULL; + virJSONValuePtr ret =3D NULL; + + if (!(server =3D qemuBuildVxHSDriveJSONHost(src))) + return NULL; + + /* VxHS disk specification example: + * { driver:"vxhs", + * vdisk-id:"eb90327c-8302-4725-4e85ed4dc251", + * server.host:"1.2.3.4", + * server.port:1234} + */ + if (virJSONValueObjectCreate(&ret, + "s:driver", protocol, + "s:vdisk-id", src->path, + "a:server", server, NULL) < 0) + virJSONValueFree(server); + + return ret; +} + + static char * qemuBuildNetworkDriveURI(virStorageSourcePtr src, qemuDomainSecretInfoPtr secinfo) @@ -1136,6 +1196,11 @@ qemuBuildNetworkDriveStr(virStorageSourcePtr src, ret =3D virBufferContentAndReset(&buf); break; =20 + case VIR_STORAGE_NET_PROTOCOL_VXHS: + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("'VxHS' protocol does not support URI syntax"= )); + goto cleanup; + case VIR_STORAGE_NET_PROTOCOL_SSH: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("'ssh' protocol is not yet supported")); @@ -1180,6 +1245,11 @@ qemuGetDriveSourceProps(virStorageSourcePtr src, if (!(fileprops =3D qemuBuildGlusterDriveJSON(src))) return -1; } + + if (src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_VXHS) { + if (!(fileprops =3D qemuBuildVxHSDriveJSON(src))) + return -1; + } break; } =20 diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index cdb727b..d43de69 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -13683,6 +13683,7 @@ qemuDomainSnapshotPrepareDiskExternalBackingInactiv= e(virDomainDiskDefPtr disk) case VIR_STORAGE_NET_PROTOCOL_FTPS: case VIR_STORAGE_NET_PROTOCOL_TFTP: case VIR_STORAGE_NET_PROTOCOL_SSH: + case VIR_STORAGE_NET_PROTOCOL_VXHS: case VIR_STORAGE_NET_PROTOCOL_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, _("external inactive snapshots are not supporte= d on " @@ -13746,6 +13747,7 @@ qemuDomainSnapshotPrepareDiskExternalOverlayActive(= virDomainSnapshotDiskDefPtr d case VIR_STORAGE_NET_PROTOCOL_FTPS: case VIR_STORAGE_NET_PROTOCOL_TFTP: case VIR_STORAGE_NET_PROTOCOL_SSH: + case VIR_STORAGE_NET_PROTOCOL_VXHS: case VIR_STORAGE_NET_PROTOCOL_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, _("external active snapshots are not supported = on " @@ -13891,6 +13893,7 @@ qemuDomainSnapshotPrepareDiskInternal(virConnectPtr= conn, case VIR_STORAGE_NET_PROTOCOL_FTPS: case VIR_STORAGE_NET_PROTOCOL_TFTP: case VIR_STORAGE_NET_PROTOCOL_SSH: + case VIR_STORAGE_NET_PROTOCOL_VXHS: case VIR_STORAGE_NET_PROTOCOL_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, _("internal inactive snapshots are not supporte= d on " diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c index af9063c..aa15225 100644 --- a/src/qemu/qemu_parse_command.c +++ b/src/qemu/qemu_parse_command.c @@ -263,6 +263,17 @@ qemuParseNBDString(virDomainDiskDefPtr disk) return -1; } =20 +static int +qemuParseVxHSString(virDomainDiskDefPtr def) +{ + virURIPtr uri =3D NULL; + + if (!(uri =3D virURIParse(def->src->path))) + return -1; + + return qemuParseDriveURIString(def, uri, "vxhs"); +} + =20 /* * This method takes a string representing a QEMU command line ARGV set @@ -737,6 +748,11 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt, if (VIR_STRDUP(def->src->path, vdi) < 0) goto error; } + } else if (STRPREFIX(def->src->path, "vxhs:")) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("VxHS protocol does not support URI s= yntax '%s'"), + def->src->path); + goto error; } else { def->src->type =3D VIR_STORAGE_TYPE_FILE; } @@ -1945,6 +1961,10 @@ qemuParseCommandLine(virCapsPtr caps, disk->src->type =3D VIR_STORAGE_TYPE_NETWORK; disk->src->protocol =3D VIR_STORAGE_NET_PROTOCOL_SHEEPDOG; val +=3D strlen("sheepdog:"); + } else if (STRPREFIX(val, "vxhs:")) { + disk->src->type =3D VIR_STORAGE_TYPE_NETWORK; + disk->src->protocol =3D VIR_STORAGE_NET_PROTOCOL_VXHS; + val +=3D strlen("vxhs:"); } else { disk->src->type =3D VIR_STORAGE_TYPE_FILE; } @@ -2021,6 +2041,11 @@ qemuParseCommandLine(virCapsPtr caps, goto error; =20 break; + case VIR_STORAGE_NET_PROTOCOL_VXHS: + if (qemuParseVxHSString(disk) < 0) + goto error; + + break; case VIR_STORAGE_NET_PROTOCOL_HTTP: case VIR_STORAGE_NET_PROTOCOL_HTTPS: case VIR_STORAGE_NET_PROTOCOL_FTP: diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index f0ed5c6..eb36694 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -85,7 +85,8 @@ VIR_ENUM_IMPL(virStorageNetProtocol, VIR_STORAGE_NET_PROT= OCOL_LAST, "ftp", "ftps", "tftp", - "ssh") + "ssh", + "vxhs") =20 VIR_ENUM_IMPL(virStorageNetHostTransport, VIR_STORAGE_NET_HOST_TRANS_LAST, "tcp", @@ -2719,6 +2720,7 @@ virStorageSourceParseBackingColon(virStorageSourcePtr= src, case VIR_STORAGE_NET_PROTOCOL_ISCSI: case VIR_STORAGE_NET_PROTOCOL_GLUSTER: case VIR_STORAGE_NET_PROTOCOL_SSH: + case VIR_STORAGE_NET_PROTOCOL_VXHS: virReportError(VIR_ERR_INTERNAL_ERROR, _("malformed backing store path for protocol %s"), protocol); @@ -3219,6 +3221,65 @@ virStorageSourceParseBackingJSONRaw(virStorageSource= Ptr src, return virStorageSourceParseBackingJSONInternal(src, json); } =20 +#define QEMU_DEFAULT_VXHS_PORT "9999" + +static int +virStorageSourceParseBackingJSONVxHS(virStorageSourcePtr src, + virJSONValuePtr json, + int opaque ATTRIBUTE_UNUSED) +{ + const char *uri =3D virJSONValueObjectGetString(json, "filename"); + const char *vdisk_id =3D virJSONValueObjectGetString(json, "vdisk-id"); + virJSONValuePtr server =3D virJSONValueObjectGetObject(json, "server"); + const char *hostname; + const char *port; + + /* Check for legacy URI based syntax passed via 'filename' option */ + if (uri) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("'VxHS' protocol does not support URI syntax")); + return -1; + } + + if (!vdisk_id || !server) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("missing 'vdisk-id' or 'server' attribute in " + "JSON backing definition for VxHS volume")); + return -1; + } + + hostname =3D virJSONValueObjectGetString(server, "host"); + port =3D virJSONValueObjectGetString(server, "port"); + + if (!hostname) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("missing hostname for tcp backing server in " + "JSON backing definition for VxHS volume")); + return -1; + } + + if (!port) + port =3D QEMU_DEFAULT_VXHS_PORT; + + src->type =3D VIR_STORAGE_TYPE_NETWORK; + src->protocol =3D VIR_STORAGE_NET_PROTOCOL_VXHS; + + if (VIR_STRDUP(src->path, vdisk_id) < 0) + return -1; + + if (VIR_ALLOC_N(src->hosts, 1) < 0) + return -1; + src->nhosts =3D 1; + + src->hosts[0].transport =3D VIR_STORAGE_NET_HOST_TRANS_TCP; + + if (VIR_STRDUP(src->hosts[0].name, hostname) < 0 || + VIR_STRDUP(src->hosts[0].port, port) < 0) + return -1; + + return 0; +} + struct virStorageSourceJSONDriverParser { const char *drvname; int (*func)(virStorageSourcePtr src, virJSONValuePtr json, int opaque); @@ -3241,6 +3302,7 @@ static const struct virStorageSourceJSONDriverParser = jsonParsers[] =3D { {"ssh", virStorageSourceParseBackingJSONSSH, 0}, {"rbd", virStorageSourceParseBackingJSONRBD, 0}, {"raw", virStorageSourceParseBackingJSONRaw, 0}, + {"vxhs", virStorageSourceParseBackingJSONVxHS, 0}, }; =20 =20 diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 0bff867..0b6e409 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -134,6 +134,7 @@ typedef enum { VIR_STORAGE_NET_PROTOCOL_FTPS, VIR_STORAGE_NET_PROTOCOL_TFTP, VIR_STORAGE_NET_PROTOCOL_SSH, + VIR_STORAGE_NET_PROTOCOL_VXHS, =20 VIR_STORAGE_NET_PROTOCOL_LAST } virStorageNetProtocol; diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index cac440c..8bd6f3e 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -1024,6 +1024,7 @@ xenFormatXLDiskSrcNet(virStorageSourcePtr src) case VIR_STORAGE_NET_PROTOCOL_GLUSTER: case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG: case VIR_STORAGE_NET_PROTOCOL_SSH: + case VIR_STORAGE_NET_PROTOCOL_VXHS: case VIR_STORAGE_NET_PROTOCOL_LAST: case VIR_STORAGE_NET_PROTOCOL_NONE: virReportError(VIR_ERR_NO_SUPPORT, diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-vxhs-fa= il.args b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-vxhs-fail.= args new file mode 100644 index 0000000..f6e3e37 --- /dev/null +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-vxhs-fail.args @@ -0,0 +1,24 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/libexec/qemu-kvm \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-cpu qemu32 \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-drive file=3Dvxhs://192.168.0.1:9999/eb90327c-8302-4725-9e1b-4e85ed4dc251= ,\ +format=3Draw,if=3Dnone,id=3Ddrive-virtio-disk0,cache=3Dnone \ +-device virtio-blk-pci,bus=3Dpci.0,addr=3D0x4,drive=3Ddrive-virtio-disk0,\ +id=3Dvirtio-disk0 diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c index 1adbcfe..fc15714 100644 --- a/tests/qemuargv2xmltest.c +++ b/tests/qemuargv2xmltest.c @@ -50,6 +50,7 @@ static int testSanitizeDef(virDomainDefPtr vmdef) =20 typedef enum { FLAG_EXPECT_WARNING =3D 1 << 0, + FLAG_EXPECT_FAIL =3D 1 << 1, } virQemuXML2ArgvTestFlags; =20 static int testCompareXMLToArgvFiles(const char *xmlfile, @@ -67,7 +68,16 @@ static int testCompareXMLToArgvFiles(const char *xmlfile, =20 if (!(vmdef =3D qemuParseCommandLineString(driver.caps, driver.xmlopt, cmd, NULL, NULL, NULL))) - goto fail; + { + if (flags & FLAG_EXPECT_FAIL) { + if (virTestLogContentAndReset() =3D=3D NULL) + goto fail; + + VIR_TEST_DEBUG("Got expected error from " + "qemuParseCommandLineString:\n"); + goto out; + } + } =20 if (!virTestOOMActive()) { if ((log =3D virTestLogContentAndReset()) =3D=3D NULL) @@ -106,6 +116,7 @@ static int testCompareXMLToArgvFiles(const char *xmlfil= e, if (virTestCompareToFile(actualxml, xmlfile) < 0) goto fail; =20 + out: ret =3D 0; =20 fail: @@ -166,6 +177,9 @@ mymain(void) # define DO_TEST(name) \ DO_TEST_FULL(name, 0) =20 +# define DO_TEST_FAIL(name) \ + DO_TEST_FULL(name, FLAG_EXPECT_FAIL) + setenv("PATH", "/bin", 1); setenv("USER", "test", 1); setenv("LOGNAME", "test", 1); @@ -220,6 +234,7 @@ mymain(void) /* older format using CEPH_ARGS env var */ DO_TEST("disk-drive-network-rbd-ceph-env"); DO_TEST("disk-drive-network-sheepdog"); + DO_TEST_FAIL("disk-drive-network-vxhs-fail"); DO_TEST("disk-usb"); DO_TEST("graphics-vnc"); DO_TEST("graphics-vnc-socket"); diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.ar= gs b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.args new file mode 100644 index 0000000..41dffff --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.args @@ -0,0 +1,25 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-cpu qemu32 \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-drive file.driver=3Dvxhs,file.vdisk-id=3Deb90327c-8302-4725-9e1b-4e85ed4d= c251,\ +file.server.host=3D192.168.0.1,file.server.port=3D9999,format=3Draw,if=3Dn= one,\ +id=3Ddrive-virtio-disk0,cache=3Dnone \ +-device virtio-blk-pci,bus=3Dpci.0,addr=3D0x4,drive=3Ddrive-virtio-disk0,\ +id=3Dvirtio-disk0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.xm= l b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.xml new file mode 100644 index 0000000..a488770 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.xml @@ -0,0 +1,34 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + + + + + eb90327c-8302-4725-9e1b-4e85ed4dc251 + +

+ + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 27eea70..0a1ef01 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -903,6 +903,7 @@ mymain(void) # endif DO_TEST("disk-drive-network-rbd-ipv6", NONE); DO_TEST_FAILURE("disk-drive-network-rbd-no-colon", NONE); + DO_TEST("disk-drive-network-vxhs", NONE); DO_TEST("disk-drive-no-boot", QEMU_CAPS_BOOTINDEX); DO_TEST_PARSE_ERROR("disk-device-lun-type-invalid", diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index f344083..3a4e03b 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -1575,6 +1575,25 @@ mymain(void) "\n" " \n" "\n"); + TEST_BACKING_PARSE("json:{ \"file\": { " + "\"driver\": \"raw\"," + "\"file\": {" + "\"driver\": \"file\"," + "\"filename\": \"/path/to/file\" } } }= ", + "\n"); + TEST_BACKING_PARSE("json:{\"file\":{\"driver\":\"vxhs\"," + "\"vdisk-id\":\"c6718f6b-0401-441d-= a8c3-1f0064d75ee0\"," + "\"server\": { \"host\":\"example.c= om\"," + "\"port\":\"1234\"" + "}" + "}" + "}", + "\n" + " \n" + "\n"); + TEST_BACKING_PARSE("json:{\"file.driver\":\"vxhs\"," + "\"file.filename\":\"vxhs://192.168.0.1:9999/= c6718f6b-0401-441d-a8c3-1f0064d75ee0\"" + "}", NULL); #endif /* WITH_YAJL */ =20 cleanup: --=20 2.5.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list