Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
docs/formatdomain.rst | 13 +++++++++++++
docs/schemas/domaincommon.rng | 11 +++++++++++
src/conf/domain_conf.c | 5 +++++
src/conf/domain_conf.h | 2 ++
src/conf/domain_validate.c | 19 +++++++++++++++++++
tests/genericxml2xmlindata/vmid.xml | 19 +++++++++++++++++++
tests/genericxml2xmltest.c | 2 ++
7 files changed, 71 insertions(+)
create mode 100644 tests/genericxml2xmlindata/vmid.xml
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index 61ccd8895a..f6a1885acf 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -2232,6 +2232,19 @@ event name Description
``emulation_faults`` the count of emulation faults, that is when the kernel traps
on unimplemented instrucions and emulates them for user space, by applications running on
the platform ``perf.emulation_faults``
===========================
=======================================================================================================================================================================================
================================
+Fibre Channel VMID
+-------------------
+
+The FC SAN can provide various QOS levels, access control depending on the
+VMID. Also it can collect telemetry data at per-VM level which can be used
+to enhance the IO performance of the VM. This can be configured by using
+the ``vmid`` element. The element contains single string (max 128 bytes).
+
+Using this feature requires Fibre Channel capable HW, kernel compiled with
+option ``CONFIG_BLK_CGROUP_FC_APPID`` and ``nvme_fc`` kernel module loaded.
+:since:`Since 7.7.0`
+
+
:anchor:`<a id="elementsDevices"/>`
Devices
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 2442078969..d2e6039c76 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -62,6 +62,9 @@
<optional>
<ref name="perf"/>
</optional>
+ <optional>
+ <ref name="vmid"/>
+ </optional>
<optional>
<ref name="idmap"/>
</optional>
@@ -576,6 +579,14 @@
</element>
</define>
+ <define name="vmid">
+ <element name="vmid">
+ <data type="string">
+ <param name="pattern">.{1,128}</param>
+ </data>
+ </element>
+ </define>
+
<!--
The Identifiers can be:
- an optional id attribute with a number on the domain element
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 09da4ab952..426ea03049 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19646,6 +19646,8 @@ virDomainDefParseXML(xmlDocPtr xml,
if (virDomainDefParseBootOptions(def, ctxt) < 0)
goto error;
+ def->vmid = virXPathString("string(./vmid[1])", ctxt);
+
/* analysis of the disk devices */
if ((n = virXPathNodeSet("./devices/disk", ctxt, &nodes)) < 0)
goto error;
@@ -28161,6 +28163,9 @@ virDomainDefFormatInternalSetRootName(virDomainDef *def,
virBufferAddLit(buf, "</clock>\n");
}
+ if (def->vmid)
+ virBufferAsprintf(buf, "<vmid>%s</vmid>\n", def->vmid);
+
if (virDomainEventActionDefFormat(buf, def->onPoweroff,
"on_poweroff",
virDomainLifecycleActionTypeToString) < 0)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 9f32bcf9cf..4e5e2259c0 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2803,6 +2803,8 @@ struct _virDomainDef {
virDomainClockDef clock;
+ char *vmid;
+
size_t ngraphics;
virDomainGraphicsDef **graphics;
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index a9e4519b1a..9d599e4bd6 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -55,6 +55,22 @@ virDomainDefBootValidate(const virDomainDef *def)
}
+static int
+virDomainDefVMIDValidate(const virDomainDef *def)
+{
+ if (!def->vmid)
+ return 0;
+
+ if (strlen(def->vmid) > 128) {
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("VMID cannot be longer then 128 characters"));
+ return -1;
+ }
+
+ return 0;
+}
+
+
static int
virDomainDefVideoValidate(const virDomainDef *def)
{
@@ -1538,6 +1554,9 @@ static int
virDomainDefValidateInternal(const virDomainDef *def,
virDomainXMLOption *xmlopt)
{
+ if (virDomainDefVMIDValidate(def) < 0)
+ return -1;
+
if (virDomainDefDuplicateDiskInfoValidate(def) < 0)
return -1;
diff --git a/tests/genericxml2xmlindata/vmid.xml b/tests/genericxml2xmlindata/vmid.xml
new file mode 100644
index 0000000000..df984df3f5
--- /dev/null
+++ b/tests/genericxml2xmlindata/vmid.xml
@@ -0,0 +1,19 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>4</vcpu>
+ <os>
+ <type arch='x86_64' machine='q35'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <vmid>someapp:c7a5fdbd-edaf-9455-926a-d65c16db1809</vmid>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ </devices>
+</domain>
diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c
index ef51ed91a6..e77f4ff386 100644
--- a/tests/genericxml2xmltest.c
+++ b/tests/genericxml2xmltest.c
@@ -225,6 +225,8 @@ mymain(void)
DO_TEST_DIFFERENT("cputune");
DO_TEST("device-backenddomain");
+ DO_TEST("vmid");
+
#define DO_TEST_BACKUP_FULL(name, intrnl) \
do { \
const struct testCompareBackupXMLData data = { .testname = name, \
--
2.31.1