693 lines
27 KiB
Diff
693 lines
27 KiB
Diff
|
commit c97d7f2bfb7798f0d68bdba2646245dcfb940efa
|
||
|
Author: Vitaliy Filippov <vitalif@yourcmc.ru>
|
||
|
Date: Mon Jun 28 01:20:19 2021 +0300
|
||
|
|
||
|
Add Vitastor support
|
||
|
|
||
|
Index: libvirt-7.6.0/docs/schemas/domaincommon.rng
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/docs/schemas/domaincommon.rng
|
||
|
+++ libvirt-7.6.0/docs/schemas/domaincommon.rng
|
||
|
@@ -1877,6 +1877,35 @@
|
||
|
</element>
|
||
|
</define>
|
||
|
|
||
|
+ <define name="diskSourceNetworkProtocolVitastor">
|
||
|
+ <element name="source">
|
||
|
+ <interleave>
|
||
|
+ <attribute name="protocol">
|
||
|
+ <value>vitastor</value>
|
||
|
+ </attribute>
|
||
|
+ <ref name="diskSourceCommon"/>
|
||
|
+ <optional>
|
||
|
+ <attribute name="name"/>
|
||
|
+ </optional>
|
||
|
+ <optional>
|
||
|
+ <attribute name="query"/>
|
||
|
+ </optional>
|
||
|
+ <zeroOrMore>
|
||
|
+ <ref name="diskSourceNetworkHost"/>
|
||
|
+ </zeroOrMore>
|
||
|
+ <optional>
|
||
|
+ <element name="config">
|
||
|
+ <attribute name="file">
|
||
|
+ <ref name="absFilePath"/>
|
||
|
+ </attribute>
|
||
|
+ <empty/>
|
||
|
+ </element>
|
||
|
+ </optional>
|
||
|
+ <empty/>
|
||
|
+ </interleave>
|
||
|
+ </element>
|
||
|
+ </define>
|
||
|
+
|
||
|
<define name="diskSourceNetworkProtocolISCSI">
|
||
|
<element name="source">
|
||
|
<attribute name="protocol">
|
||
|
@@ -2133,6 +2162,7 @@
|
||
|
<ref name="diskSourceNetworkProtocolSimple"/>
|
||
|
<ref name="diskSourceNetworkProtocolVxHS"/>
|
||
|
<ref name="diskSourceNetworkProtocolNFS"/>
|
||
|
+ <ref name="diskSourceNetworkProtocolVitastor"/>
|
||
|
</choice>
|
||
|
</define>
|
||
|
|
||
|
Index: libvirt-7.6.0/include/libvirt/libvirt-storage.h
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/include/libvirt/libvirt-storage.h
|
||
|
+++ libvirt-7.6.0/include/libvirt/libvirt-storage.h
|
||
|
@@ -245,6 +245,7 @@ typedef enum {
|
||
|
VIR_CONNECT_LIST_STORAGE_POOLS_ZFS = 1 << 17,
|
||
|
VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE = 1 << 18,
|
||
|
VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI_DIRECT = 1 << 19,
|
||
|
+ VIR_CONNECT_LIST_STORAGE_POOLS_VITASTOR = 1 << 20,
|
||
|
} virConnectListAllStoragePoolsFlags;
|
||
|
|
||
|
int virConnectListAllStoragePools(virConnectPtr conn,
|
||
|
Index: libvirt-7.6.0/src/conf/domain_conf.c
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/src/conf/domain_conf.c
|
||
|
+++ libvirt-7.6.0/src/conf/domain_conf.c
|
||
|
@@ -8268,7 +8268,8 @@ virDomainDiskSourceNetworkParse(xmlNodeP
|
||
|
src->configFile = virXPathString("string(./config/@file)", ctxt);
|
||
|
|
||
|
if (src->protocol == VIR_STORAGE_NET_PROTOCOL_HTTP ||
|
||
|
- src->protocol == VIR_STORAGE_NET_PROTOCOL_HTTPS)
|
||
|
+ src->protocol == VIR_STORAGE_NET_PROTOCOL_HTTPS ||
|
||
|
+ src->protocol == VIR_STORAGE_NET_PROTOCOL_VITASTOR)
|
||
|
src->query = virXMLPropString(node, "query");
|
||
|
|
||
|
if (virDomainStorageNetworkParseHosts(node, ctxt, &src->hosts, &src->nhosts) < 0)
|
||
|
@@ -30831,6 +30832,7 @@ virDomainStorageSourceTranslateSourcePoo
|
||
|
|
||
|
case VIR_STORAGE_POOL_MPATH:
|
||
|
case VIR_STORAGE_POOL_RBD:
|
||
|
+ case VIR_STORAGE_POOL_VITASTOR:
|
||
|
case VIR_STORAGE_POOL_SHEEPDOG:
|
||
|
case VIR_STORAGE_POOL_GLUSTER:
|
||
|
case VIR_STORAGE_POOL_LAST:
|
||
|
Index: libvirt-7.6.0/src/conf/domain_validate.c
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/src/conf/domain_validate.c
|
||
|
+++ libvirt-7.6.0/src/conf/domain_validate.c
|
||
|
@@ -470,7 +470,7 @@ virDomainDiskDefValidateSourceChainOne(c
|
||
|
}
|
||
|
}
|
||
|
|
||
|
- /* internal snapshots and config files are currently supported only with rbd: */
|
||
|
+ /* internal snapshots are currently supported only with rbd: */
|
||
|
if (virStorageSourceGetActualType(src) != VIR_STORAGE_TYPE_NETWORK &&
|
||
|
src->protocol != VIR_STORAGE_NET_PROTOCOL_RBD) {
|
||
|
if (src->snapshot) {
|
||
|
@@ -479,11 +479,15 @@ virDomainDiskDefValidateSourceChainOne(c
|
||
|
"only with 'rbd' disks"));
|
||
|
return -1;
|
||
|
}
|
||
|
-
|
||
|
+ }
|
||
|
+ /* config files are currently supported only with rbd and vitastor: */
|
||
|
+ if (virStorageSourceGetActualType(src) != VIR_STORAGE_TYPE_NETWORK &&
|
||
|
+ src->protocol != VIR_STORAGE_NET_PROTOCOL_RBD &&
|
||
|
+ src->protocol != VIR_STORAGE_NET_PROTOCOL_VITASTOR) {
|
||
|
if (src->configFile) {
|
||
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||
|
_("<config> element is currently supported "
|
||
|
- "only with 'rbd' disks"));
|
||
|
+ "only with 'rbd' and 'vitastor' disks"));
|
||
|
return -1;
|
||
|
}
|
||
|
}
|
||
|
Index: libvirt-7.6.0/src/conf/storage_conf.c
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/src/conf/storage_conf.c
|
||
|
+++ libvirt-7.6.0/src/conf/storage_conf.c
|
||
|
@@ -60,7 +60,7 @@ VIR_ENUM_IMPL(virStoragePool,
|
||
|
"logical", "disk", "iscsi",
|
||
|
"iscsi-direct", "scsi", "mpath",
|
||
|
"rbd", "sheepdog", "gluster",
|
||
|
- "zfs", "vstorage",
|
||
|
+ "zfs", "vstorage", "vitastor",
|
||
|
);
|
||
|
|
||
|
VIR_ENUM_IMPL(virStoragePoolFormatFileSystem,
|
||
|
@@ -246,6 +246,18 @@ static virStoragePoolTypeInfo poolTypeIn
|
||
|
.formatToString = virStorageFileFormatTypeToString,
|
||
|
}
|
||
|
},
|
||
|
+ {.poolType = VIR_STORAGE_POOL_VITASTOR,
|
||
|
+ .poolOptions = {
|
||
|
+ .flags = (VIR_STORAGE_POOL_SOURCE_HOST |
|
||
|
+ VIR_STORAGE_POOL_SOURCE_NETWORK |
|
||
|
+ VIR_STORAGE_POOL_SOURCE_NAME),
|
||
|
+ },
|
||
|
+ .volOptions = {
|
||
|
+ .defaultFormat = VIR_STORAGE_FILE_RAW,
|
||
|
+ .formatFromString = virStorageVolumeFormatFromString,
|
||
|
+ .formatToString = virStorageFileFormatTypeToString,
|
||
|
+ }
|
||
|
+ },
|
||
|
{.poolType = VIR_STORAGE_POOL_SHEEPDOG,
|
||
|
.poolOptions = {
|
||
|
.flags = (VIR_STORAGE_POOL_SOURCE_HOST |
|
||
|
@@ -546,6 +558,11 @@ virStoragePoolDefParseSource(xmlXPathCon
|
||
|
_("element 'name' is mandatory for RBD pool"));
|
||
|
return -1;
|
||
|
}
|
||
|
+ if (pool_type == VIR_STORAGE_POOL_VITASTOR && source->name == NULL) {
|
||
|
+ virReportError(VIR_ERR_XML_ERROR, "%s",
|
||
|
+ _("element 'name' is mandatory for Vitastor pool"));
|
||
|
+ return -1;
|
||
|
+ }
|
||
|
|
||
|
if (options->formatFromString) {
|
||
|
g_autofree char *format = NULL;
|
||
|
@@ -1182,6 +1199,7 @@ virStoragePoolDefFormatBuf(virBuffer *bu
|
||
|
/* RBD, Sheepdog, Gluster and Iscsi-direct devices are not local block devs nor
|
||
|
* files, so they don't have a target */
|
||
|
if (def->type != VIR_STORAGE_POOL_RBD &&
|
||
|
+ def->type != VIR_STORAGE_POOL_VITASTOR &&
|
||
|
def->type != VIR_STORAGE_POOL_SHEEPDOG &&
|
||
|
def->type != VIR_STORAGE_POOL_GLUSTER &&
|
||
|
def->type != VIR_STORAGE_POOL_ISCSI_DIRECT) {
|
||
|
Index: libvirt-7.6.0/src/conf/storage_conf.h
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/src/conf/storage_conf.h
|
||
|
+++ libvirt-7.6.0/src/conf/storage_conf.h
|
||
|
@@ -106,6 +106,7 @@ typedef enum {
|
||
|
VIR_STORAGE_POOL_GLUSTER, /* Gluster device */
|
||
|
VIR_STORAGE_POOL_ZFS, /* ZFS */
|
||
|
VIR_STORAGE_POOL_VSTORAGE, /* Virtuozzo Storage */
|
||
|
+ VIR_STORAGE_POOL_VITASTOR, /* Vitastor */
|
||
|
|
||
|
VIR_STORAGE_POOL_LAST,
|
||
|
} virStoragePoolType;
|
||
|
@@ -465,6 +466,7 @@ VIR_ENUM_DECL(virStoragePartedFs);
|
||
|
VIR_CONNECT_LIST_STORAGE_POOLS_SCSI | \
|
||
|
VIR_CONNECT_LIST_STORAGE_POOLS_MPATH | \
|
||
|
VIR_CONNECT_LIST_STORAGE_POOLS_RBD | \
|
||
|
+ VIR_CONNECT_LIST_STORAGE_POOLS_VITASTOR | \
|
||
|
VIR_CONNECT_LIST_STORAGE_POOLS_SHEEPDOG | \
|
||
|
VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER | \
|
||
|
VIR_CONNECT_LIST_STORAGE_POOLS_ZFS | \
|
||
|
Index: libvirt-7.6.0/src/conf/storage_source_conf.c
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/src/conf/storage_source_conf.c
|
||
|
+++ libvirt-7.6.0/src/conf/storage_source_conf.c
|
||
|
@@ -85,6 +85,7 @@ VIR_ENUM_IMPL(virStorageNetProtocol,
|
||
|
"ssh",
|
||
|
"vxhs",
|
||
|
"nfs",
|
||
|
+ "vitastor",
|
||
|
);
|
||
|
|
||
|
|
||
|
@@ -1262,6 +1263,7 @@ virStorageSourceNetworkDefaultPort(virSt
|
||
|
case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
|
||
|
return 24007;
|
||
|
|
||
|
+ case VIR_STORAGE_NET_PROTOCOL_VITASTOR:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_RBD:
|
||
|
/* we don't provide a default for RBD */
|
||
|
return 0;
|
||
|
Index: libvirt-7.6.0/src/conf/storage_source_conf.h
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/src/conf/storage_source_conf.h
|
||
|
+++ libvirt-7.6.0/src/conf/storage_source_conf.h
|
||
|
@@ -127,6 +127,7 @@ typedef enum {
|
||
|
VIR_STORAGE_NET_PROTOCOL_SSH,
|
||
|
VIR_STORAGE_NET_PROTOCOL_VXHS,
|
||
|
VIR_STORAGE_NET_PROTOCOL_NFS,
|
||
|
+ VIR_STORAGE_NET_PROTOCOL_VITASTOR,
|
||
|
|
||
|
VIR_STORAGE_NET_PROTOCOL_LAST
|
||
|
} virStorageNetProtocol;
|
||
|
Index: libvirt-7.6.0/src/conf/virstorageobj.c
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/src/conf/virstorageobj.c
|
||
|
+++ libvirt-7.6.0/src/conf/virstorageobj.c
|
||
|
@@ -1481,6 +1481,7 @@ virStoragePoolObjSourceFindDuplicateCb(c
|
||
|
return 1;
|
||
|
break;
|
||
|
|
||
|
+ case VIR_STORAGE_POOL_VITASTOR:
|
||
|
case VIR_STORAGE_POOL_RBD:
|
||
|
case VIR_STORAGE_POOL_LAST:
|
||
|
break;
|
||
|
@@ -1980,6 +1981,8 @@ virStoragePoolObjMatch(virStoragePoolObj
|
||
|
(obj->def->type == VIR_STORAGE_POOL_MPATH)) ||
|
||
|
(MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_RBD) &&
|
||
|
(obj->def->type == VIR_STORAGE_POOL_RBD)) ||
|
||
|
+ (MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_VITASTOR) &&
|
||
|
+ (obj->def->type == VIR_STORAGE_POOL_VITASTOR)) ||
|
||
|
(MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_SHEEPDOG) &&
|
||
|
(obj->def->type == VIR_STORAGE_POOL_SHEEPDOG)) ||
|
||
|
(MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER) &&
|
||
|
Index: libvirt-7.6.0/src/libvirt-storage.c
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/src/libvirt-storage.c
|
||
|
+++ libvirt-7.6.0/src/libvirt-storage.c
|
||
|
@@ -92,6 +92,7 @@ virStoragePoolGetConnect(virStoragePoolP
|
||
|
* VIR_CONNECT_LIST_STORAGE_POOLS_SCSI
|
||
|
* VIR_CONNECT_LIST_STORAGE_POOLS_MPATH
|
||
|
* VIR_CONNECT_LIST_STORAGE_POOLS_RBD
|
||
|
+ * VIR_CONNECT_LIST_STORAGE_POOLS_VITASTOR
|
||
|
* VIR_CONNECT_LIST_STORAGE_POOLS_SHEEPDOG
|
||
|
* VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER
|
||
|
* VIR_CONNECT_LIST_STORAGE_POOLS_ZFS
|
||
|
Index: libvirt-7.6.0/src/libxl/libxl_conf.c
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/src/libxl/libxl_conf.c
|
||
|
+++ libvirt-7.6.0/src/libxl/libxl_conf.c
|
||
|
@@ -972,6 +972,7 @@ libxlMakeNetworkDiskSrcStr(virStorageSou
|
||
|
case VIR_STORAGE_NET_PROTOCOL_SSH:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_VXHS:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_NFS:
|
||
|
+ case VIR_STORAGE_NET_PROTOCOL_VITASTOR:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_LAST:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_NONE:
|
||
|
virReportError(VIR_ERR_NO_SUPPORT,
|
||
|
Index: libvirt-7.6.0/src/libxl/xen_xl.c
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/src/libxl/xen_xl.c
|
||
|
+++ libvirt-7.6.0/src/libxl/xen_xl.c
|
||
|
@@ -1540,6 +1540,7 @@ xenFormatXLDiskSrcNet(virStorageSource *
|
||
|
case VIR_STORAGE_NET_PROTOCOL_SSH:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_VXHS:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_NFS:
|
||
|
+ case VIR_STORAGE_NET_PROTOCOL_VITASTOR:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_LAST:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_NONE:
|
||
|
virReportError(VIR_ERR_NO_SUPPORT,
|
||
|
Index: libvirt-7.6.0/src/qemu/qemu_block.c
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/src/qemu/qemu_block.c
|
||
|
+++ libvirt-7.6.0/src/qemu/qemu_block.c
|
||
|
@@ -916,6 +916,38 @@ qemuBlockStorageSourceGetRBDProps(virSto
|
||
|
|
||
|
|
||
|
static virJSONValue *
|
||
|
+qemuBlockStorageSourceGetVitastorProps(virStorageSource *src)
|
||
|
+{
|
||
|
+ virJSONValue *ret = NULL;
|
||
|
+ virStorageNetHostDef *host;
|
||
|
+ size_t i;
|
||
|
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||
|
+ g_autofree char *etcd = NULL;
|
||
|
+
|
||
|
+ for (i = 0; i < src->nhosts; i++) {
|
||
|
+ host = src->hosts + i;
|
||
|
+ if ((virStorageNetHostTransport)host->transport != VIR_STORAGE_NET_HOST_TRANS_TCP) {
|
||
|
+ return NULL;
|
||
|
+ }
|
||
|
+ virBufferAsprintf(&buf, i > 0 ? ",%s:%u" : "%s:%u", host->name, host->port);
|
||
|
+ }
|
||
|
+ if (src->nhosts > 0) {
|
||
|
+ etcd = virBufferContentAndReset(&buf);
|
||
|
+ }
|
||
|
+
|
||
|
+ if (virJSONValueObjectCreate(&ret,
|
||
|
+ "S:etcd-host", etcd,
|
||
|
+ "S:etcd-prefix", src->query,
|
||
|
+ "S:config-path", src->configFile,
|
||
|
+ "s:image", src->path,
|
||
|
+ NULL) < 0)
|
||
|
+ return NULL;
|
||
|
+
|
||
|
+ return ret;
|
||
|
+}
|
||
|
+
|
||
|
+
|
||
|
+static virJSONValue *
|
||
|
qemuBlockStorageSourceGetSheepdogProps(virStorageSource *src)
|
||
|
{
|
||
|
g_autoptr(virJSONValue) serverprops = NULL;
|
||
|
@@ -1205,6 +1237,12 @@ qemuBlockStorageSourceGetBackendProps(vi
|
||
|
return NULL;
|
||
|
break;
|
||
|
|
||
|
+ case VIR_STORAGE_NET_PROTOCOL_VITASTOR:
|
||
|
+ driver = "vitastor";
|
||
|
+ if (!(fileprops = qemuBlockStorageSourceGetVitastorProps(src)))
|
||
|
+ return NULL;
|
||
|
+ break;
|
||
|
+
|
||
|
case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
|
||
|
driver = "sheepdog";
|
||
|
if (!(fileprops = qemuBlockStorageSourceGetSheepdogProps(src)))
|
||
|
@@ -2219,6 +2257,7 @@ qemuBlockGetBackingStoreString(virStorag
|
||
|
|
||
|
case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_RBD:
|
||
|
+ case VIR_STORAGE_NET_PROTOCOL_VITASTOR:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_VXHS:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_NFS:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_SSH:
|
||
|
@@ -2596,6 +2635,12 @@ qemuBlockStorageSourceCreateGetStoragePr
|
||
|
return -1;
|
||
|
break;
|
||
|
|
||
|
+ case VIR_STORAGE_NET_PROTOCOL_VITASTOR:
|
||
|
+ driver = "vitastor";
|
||
|
+ if (!(location = qemuBlockStorageSourceGetVitastorProps(src)))
|
||
|
+ return -1;
|
||
|
+ break;
|
||
|
+
|
||
|
case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
|
||
|
driver = "sheepdog";
|
||
|
if (!(location = qemuBlockStorageSourceGetSheepdogProps(src)))
|
||
|
Index: libvirt-7.6.0/src/qemu/qemu_command.c
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/src/qemu/qemu_command.c
|
||
|
+++ libvirt-7.6.0/src/qemu/qemu_command.c
|
||
|
@@ -1074,6 +1074,43 @@ qemuBuildNetworkDriveStr(virStorageSourc
|
||
|
ret = virBufferContentAndReset(&buf);
|
||
|
break;
|
||
|
|
||
|
+ case VIR_STORAGE_NET_PROTOCOL_VITASTOR:
|
||
|
+ if (strchr(src->path, ':')) {
|
||
|
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||
|
+ _("':' not allowed in Vitastor source volume name '%s'"),
|
||
|
+ src->path);
|
||
|
+ return NULL;
|
||
|
+ }
|
||
|
+
|
||
|
+ virBufferStrcat(&buf, "vitastor:image=", src->path, NULL);
|
||
|
+
|
||
|
+ if (src->nhosts > 0) {
|
||
|
+ virBufferAddLit(&buf, ":etcd-host=");
|
||
|
+ for (i = 0; i < src->nhosts; i++) {
|
||
|
+ if (i)
|
||
|
+ virBufferAddLit(&buf, ",");
|
||
|
+
|
||
|
+ /* assume host containing : is ipv6 */
|
||
|
+ if (strchr(src->hosts[i].name, ':'))
|
||
|
+ virBufferEscape(&buf, '\\', ":", "[%s]",
|
||
|
+ src->hosts[i].name);
|
||
|
+ else
|
||
|
+ virBufferAsprintf(&buf, "%s", src->hosts[i].name);
|
||
|
+
|
||
|
+ if (src->hosts[i].port)
|
||
|
+ virBufferAsprintf(&buf, "\\:%u", src->hosts[i].port);
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
+ if (src->configFile)
|
||
|
+ virBufferEscape(&buf, '\\', ":", ":config-path=%s", src->configFile);
|
||
|
+
|
||
|
+ if (src->query)
|
||
|
+ virBufferEscape(&buf, '\\', ":", ":etcd-prefix=%s", src->query);
|
||
|
+
|
||
|
+ ret = virBufferContentAndReset(&buf);
|
||
|
+ break;
|
||
|
+
|
||
|
case VIR_STORAGE_NET_PROTOCOL_VXHS:
|
||
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||
|
_("VxHS protocol does not support URI syntax"));
|
||
|
Index: libvirt-7.6.0/src/qemu/qemu_domain.c
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/src/qemu/qemu_domain.c
|
||
|
+++ libvirt-7.6.0/src/qemu/qemu_domain.c
|
||
|
@@ -4900,7 +4900,8 @@ qemuDomainValidateStorageSource(virStora
|
||
|
if (src->query &&
|
||
|
(actualType != VIR_STORAGE_TYPE_NETWORK ||
|
||
|
(src->protocol != VIR_STORAGE_NET_PROTOCOL_HTTPS &&
|
||
|
- src->protocol != VIR_STORAGE_NET_PROTOCOL_HTTP))) {
|
||
|
+ src->protocol != VIR_STORAGE_NET_PROTOCOL_HTTP &&
|
||
|
+ src->protocol != VIR_STORAGE_NET_PROTOCOL_VITASTOR))) {
|
||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||
|
_("query is supported only with HTTP(S) protocols"));
|
||
|
return -1;
|
||
|
@@ -10102,6 +10103,7 @@ qemuDomainPrepareStorageSourceTLS(virSto
|
||
|
break;
|
||
|
|
||
|
case VIR_STORAGE_NET_PROTOCOL_RBD:
|
||
|
+ case VIR_STORAGE_NET_PROTOCOL_VITASTOR:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_ISCSI:
|
||
|
Index: libvirt-7.6.0/src/qemu/qemu_snapshot.c
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/src/qemu/qemu_snapshot.c
|
||
|
+++ libvirt-7.6.0/src/qemu/qemu_snapshot.c
|
||
|
@@ -402,6 +402,7 @@ qemuSnapshotPrepareDiskExternalInactive(
|
||
|
case VIR_STORAGE_NET_PROTOCOL_NONE:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_NBD:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_RBD:
|
||
|
+ case VIR_STORAGE_NET_PROTOCOL_VITASTOR:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_ISCSI:
|
||
|
@@ -494,6 +495,7 @@ qemuSnapshotPrepareDiskExternalActive(vi
|
||
|
case VIR_STORAGE_NET_PROTOCOL_NONE:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_NBD:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_RBD:
|
||
|
+ case VIR_STORAGE_NET_PROTOCOL_VITASTOR:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_ISCSI:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_HTTP:
|
||
|
@@ -647,6 +649,7 @@ qemuSnapshotPrepareDiskInternal(virDomai
|
||
|
case VIR_STORAGE_NET_PROTOCOL_NONE:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_NBD:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_RBD:
|
||
|
+ case VIR_STORAGE_NET_PROTOCOL_VITASTOR:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_ISCSI:
|
||
|
Index: libvirt-7.6.0/src/storage/storage_driver.c
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/src/storage/storage_driver.c
|
||
|
+++ libvirt-7.6.0/src/storage/storage_driver.c
|
||
|
@@ -1644,6 +1644,7 @@ storageVolLookupByPathCallback(virStorag
|
||
|
|
||
|
case VIR_STORAGE_POOL_GLUSTER:
|
||
|
case VIR_STORAGE_POOL_RBD:
|
||
|
+ case VIR_STORAGE_POOL_VITASTOR:
|
||
|
case VIR_STORAGE_POOL_SHEEPDOG:
|
||
|
case VIR_STORAGE_POOL_ZFS:
|
||
|
case VIR_STORAGE_POOL_LAST:
|
||
|
Index: libvirt-7.6.0/src/storage_file/storage_source_backingstore.c
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/src/storage_file/storage_source_backingstore.c
|
||
|
+++ libvirt-7.6.0/src/storage_file/storage_source_backingstore.c
|
||
|
@@ -285,6 +285,75 @@ virStorageSourceParseRBDColonString(cons
|
||
|
|
||
|
|
||
|
static int
|
||
|
+virStorageSourceParseVitastorColonString(const char *colonstr,
|
||
|
+ virStorageSource *src)
|
||
|
+{
|
||
|
+ char *p, *e, *next;
|
||
|
+ g_autofree char *options = NULL;
|
||
|
+
|
||
|
+ /* optionally skip the "vitastor:" prefix if provided */
|
||
|
+ if (STRPREFIX(colonstr, "vitastor:"))
|
||
|
+ colonstr += strlen("vitastor:");
|
||
|
+
|
||
|
+ options = g_strdup(colonstr);
|
||
|
+
|
||
|
+ p = options;
|
||
|
+ while (*p) {
|
||
|
+ /* find : delimiter or end of string */
|
||
|
+ for (e = p; *e && *e != ':'; ++e) {
|
||
|
+ if (*e == '\\') {
|
||
|
+ e++;
|
||
|
+ if (*e == '\0')
|
||
|
+ break;
|
||
|
+ }
|
||
|
+ }
|
||
|
+ if (*e == '\0') {
|
||
|
+ next = e; /* last kv pair */
|
||
|
+ } else {
|
||
|
+ next = e + 1;
|
||
|
+ *e = '\0';
|
||
|
+ }
|
||
|
+
|
||
|
+ if (STRPREFIX(p, "image=")) {
|
||
|
+ src->path = g_strdup(p + strlen("image="));
|
||
|
+ } else if (STRPREFIX(p, "etcd-prefix=")) {
|
||
|
+ src->query = g_strdup(p + strlen("etcd-prefix="));
|
||
|
+ } else if (STRPREFIX(p, "config-path=")) {
|
||
|
+ src->configFile = g_strdup(p + strlen("config-path="));
|
||
|
+ } else if (STRPREFIX(p, "etcd-host=")) {
|
||
|
+ char *h, *sep;
|
||
|
+
|
||
|
+ h = p + strlen("etcd-host=");
|
||
|
+ while (h < e) {
|
||
|
+ for (sep = h; sep < e; ++sep) {
|
||
|
+ if (*sep == '\\' && (sep[1] == ',' ||
|
||
|
+ sep[1] == ';' ||
|
||
|
+ sep[1] == ' ')) {
|
||
|
+ *sep = '\0';
|
||
|
+ sep += 2;
|
||
|
+ break;
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
+ if (virStorageSourceRBDAddHost(src, h) < 0)
|
||
|
+ return -1;
|
||
|
+
|
||
|
+ h = sep;
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
+ p = next;
|
||
|
+ }
|
||
|
+
|
||
|
+ if (!src->path) {
|
||
|
+ return -1;
|
||
|
+ }
|
||
|
+
|
||
|
+ return 0;
|
||
|
+}
|
||
|
+
|
||
|
+
|
||
|
+static int
|
||
|
virStorageSourceParseNBDColonString(const char *nbdstr,
|
||
|
virStorageSource *src)
|
||
|
{
|
||
|
@@ -396,6 +465,11 @@ virStorageSourceParseBackingColon(virSto
|
||
|
return -1;
|
||
|
break;
|
||
|
|
||
|
+ case VIR_STORAGE_NET_PROTOCOL_VITASTOR:
|
||
|
+ if (virStorageSourceParseVitastorColonString(path, src) < 0)
|
||
|
+ return -1;
|
||
|
+ break;
|
||
|
+
|
||
|
case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_LAST:
|
||
|
case VIR_STORAGE_NET_PROTOCOL_NONE:
|
||
|
@@ -985,6 +1059,54 @@ virStorageSourceParseBackingJSONRBD(virS
|
||
|
}
|
||
|
|
||
|
static int
|
||
|
+virStorageSourceParseBackingJSONVitastor(virStorageSource *src,
|
||
|
+ virJSONValue *json,
|
||
|
+ const char *jsonstr G_GNUC_UNUSED,
|
||
|
+ int opaque G_GNUC_UNUSED)
|
||
|
+{
|
||
|
+ const char *filename;
|
||
|
+ const char *image = virJSONValueObjectGetString(json, "image");
|
||
|
+ const char *conf = virJSONValueObjectGetString(json, "config-path");
|
||
|
+ const char *etcd_prefix = virJSONValueObjectGetString(json, "etcd-prefix");
|
||
|
+ virJSONValue *servers = virJSONValueObjectGetArray(json, "server");
|
||
|
+ size_t nservers;
|
||
|
+ size_t i;
|
||
|
+
|
||
|
+ src->type = VIR_STORAGE_TYPE_NETWORK;
|
||
|
+ src->protocol = VIR_STORAGE_NET_PROTOCOL_VITASTOR;
|
||
|
+
|
||
|
+ /* legacy syntax passed via 'filename' option */
|
||
|
+ if ((filename = virJSONValueObjectGetString(json, "filename")))
|
||
|
+ return virStorageSourceParseVitastorColonString(filename, src);
|
||
|
+
|
||
|
+ if (!image) {
|
||
|
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||
|
+ _("missing image name in Vitastor backing volume "
|
||
|
+ "JSON specification"));
|
||
|
+ return -1;
|
||
|
+ }
|
||
|
+
|
||
|
+ src->path = g_strdup(image);
|
||
|
+ src->configFile = g_strdup(conf);
|
||
|
+ src->query = g_strdup(etcd_prefix);
|
||
|
+
|
||
|
+ if (servers) {
|
||
|
+ nservers = virJSONValueArraySize(servers);
|
||
|
+
|
||
|
+ src->hosts = g_new0(virStorageNetHostDef, nservers);
|
||
|
+ src->nhosts = nservers;
|
||
|
+
|
||
|
+ for (i = 0; i < nservers; i++) {
|
||
|
+ if (virStorageSourceParseBackingJSONInetSocketAddress(src->hosts + i,
|
||
|
+ virJSONValueArrayGet(servers, i)) < 0)
|
||
|
+ return -1;
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
+ return 0;
|
||
|
+}
|
||
|
+
|
||
|
+static int
|
||
|
virStorageSourceParseBackingJSONRaw(virStorageSource *src,
|
||
|
virJSONValue *json,
|
||
|
const char *jsonstr,
|
||
|
@@ -1162,6 +1284,7 @@ static const struct virStorageSourceJSON
|
||
|
{"sheepdog", false, virStorageSourceParseBackingJSONSheepdog, 0},
|
||
|
{"ssh", false, virStorageSourceParseBackingJSONSSH, 0},
|
||
|
{"rbd", false, virStorageSourceParseBackingJSONRBD, 0},
|
||
|
+ {"vitastor", false, virStorageSourceParseBackingJSONVitastor, 0},
|
||
|
{"raw", true, virStorageSourceParseBackingJSONRaw, 0},
|
||
|
{"nfs", false, virStorageSourceParseBackingJSONNFS, 0},
|
||
|
{"vxhs", false, virStorageSourceParseBackingJSONVxHS, 0},
|
||
|
Index: libvirt-7.6.0/src/test/test_driver.c
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/src/test/test_driver.c
|
||
|
+++ libvirt-7.6.0/src/test/test_driver.c
|
||
|
@@ -7193,6 +7193,7 @@ testStorageVolumeTypeForPool(int pooltyp
|
||
|
case VIR_STORAGE_POOL_ISCSI_DIRECT:
|
||
|
case VIR_STORAGE_POOL_GLUSTER:
|
||
|
case VIR_STORAGE_POOL_RBD:
|
||
|
+ case VIR_STORAGE_POOL_VITASTOR:
|
||
|
return VIR_STORAGE_VOL_NETWORK;
|
||
|
case VIR_STORAGE_POOL_LOGICAL:
|
||
|
case VIR_STORAGE_POOL_DISK:
|
||
|
Index: libvirt-7.6.0/tests/storagepoolcapsschemadata/poolcaps-fs.xml
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/tests/storagepoolcapsschemadata/poolcaps-fs.xml
|
||
|
+++ libvirt-7.6.0/tests/storagepoolcapsschemadata/poolcaps-fs.xml
|
||
|
@@ -204,4 +204,11 @@
|
||
|
</enum>
|
||
|
</volOptions>
|
||
|
</pool>
|
||
|
+ <pool type='vitastor' supported='no'>
|
||
|
+ <volOptions>
|
||
|
+ <defaultFormat type='raw'/>
|
||
|
+ <enum name='targetFormatType'>
|
||
|
+ </enum>
|
||
|
+ </volOptions>
|
||
|
+ </pool>
|
||
|
</storagepoolCapabilities>
|
||
|
Index: libvirt-7.6.0/tests/storagepoolcapsschemadata/poolcaps-full.xml
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/tests/storagepoolcapsschemadata/poolcaps-full.xml
|
||
|
+++ libvirt-7.6.0/tests/storagepoolcapsschemadata/poolcaps-full.xml
|
||
|
@@ -204,4 +204,11 @@
|
||
|
</enum>
|
||
|
</volOptions>
|
||
|
</pool>
|
||
|
+ <pool type='vitastor' supported='yes'>
|
||
|
+ <volOptions>
|
||
|
+ <defaultFormat type='raw'/>
|
||
|
+ <enum name='targetFormatType'>
|
||
|
+ </enum>
|
||
|
+ </volOptions>
|
||
|
+ </pool>
|
||
|
</storagepoolCapabilities>
|
||
|
Index: libvirt-7.6.0/tests/storagepoolxml2argvtest.c
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/tests/storagepoolxml2argvtest.c
|
||
|
+++ libvirt-7.6.0/tests/storagepoolxml2argvtest.c
|
||
|
@@ -68,6 +68,7 @@ testCompareXMLToArgvFiles(bool shouldFai
|
||
|
case VIR_STORAGE_POOL_GLUSTER:
|
||
|
case VIR_STORAGE_POOL_ZFS:
|
||
|
case VIR_STORAGE_POOL_VSTORAGE:
|
||
|
+ case VIR_STORAGE_POOL_VITASTOR:
|
||
|
case VIR_STORAGE_POOL_LAST:
|
||
|
default:
|
||
|
VIR_TEST_DEBUG("pool type '%s' has no xml2argv test", defTypeStr);
|
||
|
Index: libvirt-7.6.0/tools/virsh-pool.c
|
||
|
===================================================================
|
||
|
--- libvirt-7.6.0.orig/tools/virsh-pool.c
|
||
|
+++ libvirt-7.6.0/tools/virsh-pool.c
|
||
|
@@ -1231,6 +1231,9 @@ cmdPoolList(vshControl *ctl, const vshCm
|
||
|
case VIR_STORAGE_POOL_VSTORAGE:
|
||
|
flags |= VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE;
|
||
|
break;
|
||
|
+ case VIR_STORAGE_POOL_VITASTOR:
|
||
|
+ flags |= VIR_CONNECT_LIST_STORAGE_POOLS_VITASTOR;
|
||
|
+ break;
|
||
|
case VIR_STORAGE_POOL_LAST:
|
||
|
break;
|
||
|
}
|