[libvirt] [PATCH 0/9] json: Fix leak/double-free, clean up code and privatize virJSONValue
by Peter Krempa
Coverity was not wrong about the usage of 'a'/'A' modifiers for
virJSONValueObjectAddVArgs as noted in [1]. Fix the possible
leak/double-free, and add test to make sure it works as expected.
This series also cleans up direct access to attributes of virJSONValue
and in the end privatizes the implementation so that all users are
forced to use accessors.
Peter Krempa (9):
util: json: Fix freeing of objects appended to virJSONValue
tests: json: Validate that attribute values are properly stolen
qemu: monitor: Use virJSONValueObjectKeysNumber in
qemuMonitorJSONGetCPUModelExpansion
qemu: agent: Avoid unnecessary JSON object type check
json: Replace access to virJSONValue->type by virJSONValueGetType
util: json: Add accessor for geting a VIR_JSON_TYPE_NUMBER as string
util: qemu: Don't access virJSONValue members directly in
virQEMUBuildCommandLineJSONRecurse
qemu: monitor: Don't resist stealing 'actions' in
qemuMonitorJSONTransaction
util: json: Privatize struct _virJSONValue and sub-structs
src/libvirt_private.syms | 1 +
src/qemu/qemu_agent.c | 21 +++++-----------
src/qemu/qemu_block.c | 22 +++++------------
src/qemu/qemu_command.c | 2 +-
src/qemu/qemu_driver.c | 4 +--
src/qemu/qemu_monitor.c | 4 +--
src/qemu/qemu_monitor.h | 2 +-
src/qemu/qemu_monitor_json.c | 59 ++++++++++++++------------------------------
src/qemu/qemu_monitor_json.h | 2 +-
src/util/virjson.c | 59 +++++++++++++++++++++++++++++++++++++++++---
src/util/virjson.h | 39 +----------------------------
src/util/virqemu.c | 13 ++++++----
tests/qemublocktest.c | 4 +--
tests/virjsontest.c | 47 +++++++++++++++++++++++++++++++++++
14 files changed, 152 insertions(+), 127 deletions(-)
--
2.16.2
6 years, 8 months
[libvirt] RFC: Extending UEFI XML specification
by Prerna
Hi Michal,
The <loader>,<nvram> tags of os element in domain XML (
https://libvirt.org/formatdomain.html#elementsOSBIOS) currently expects
absolute path of the local file which would be used to back the the pflash
disk representing the non-volatile RAM:
<loader readonly='yes' secure='no'
type='rom'>/usr/lib/xen/boot/hvmloader</loader>
<nvram
template='/usr/share/OVMF/OVMF_VARS.fd'>/var/lib/libvirt/nvram/guest_VARS.fd</nvram>
However, given that for virtualized environments, it is possible that the
VM could be started on different hosts at various points in time, and so we
need to expose the firmware/nvram tuple over a network device so as to be
accessible from various hosts.
I propose extending of the existing config by adding a new element,
"backing". This could be one of :
- 'file': for local filesystem paths
- 'network': for network-attached storage.
As an example:
<loader readonly='yes' secure='no' type='rom' backing =
'file'>/usr/share/OVMF/OVMF_CODE.fd</loader>
<nvram backing='file'
template='/usr/share/OVMF/OVMF_VARS.fd'>/var/lib/libvirt/nvram/guest_VARS.fd</nvram>
For network-attached storage:
<loader readonly='yes' secure='no' type='rom' backing =
'network'>/usr/share/OVMF/OVMF_CODE.fd</loader>
<nvram backing='network'>
<source protocol='XXX' name='YYY'>
<host name='x.x.x.x' port=xxxx/>
</source>
</nvram>
Note that 'template' attribute in NVRAM should be explicitly disallowed for
backing type "network". This is because libvirtd may not be able to access
the backing store to copy the contents of the template.
I would like to capture thoughts from the community to extend the current
firmware spec.
Regards,
Prerna
6 years, 8 months
[libvirt] [PATCH 0/4] vmx: allow more than 4 NICs (RHBZ#1560917)
by Pino Toscano
Hi,
the VMX parser, used in the esx driver, has currently hardcoded 4 NICs
possible, ignoring extra more than that. The following series removes
this limitation, allowing to parse all the 10 NICs in the VMX of
RHBZ#1560917.
Thanks,
Pino Toscano (4):
vmx: check for present/enabled devices earlier
vmx: allocate space for network interfaces if needed
internal: add STRCASEPREFIX
vmx: convert any amount of NICs
src/internal.h | 1 +
src/vmx/vmx.c | 150 +++++++++++-----------
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.vmx | 163 ++++++++++++++++++++++++
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml | 89 +++++++++++++
tests/vmx2xmltest.c | 1 +
5 files changed, 325 insertions(+), 79 deletions(-)
create mode 100644 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml
--
2.14.3
6 years, 9 months
[libvirt] [PATCH] qemuDomainRemoveDevice: add qemuDomainRemoveWatchdog
by Ján Tomko
qemuDomainDetachWatchdog uses the infrastructure for waiting
for the DEVICE_DELETED event, but the asynchronous delete
was not implemented.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/qemu/qemu_hotplug.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 49af4d4ff..e840c8010 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -4493,12 +4493,15 @@ qemuDomainRemoveDevice(virQEMUDriverPtr driver,
ret = qemuDomainRemoveRedirdevDevice(driver, vm, dev->data.redirdev);
break;
+ case VIR_DOMAIN_DEVICE_WATCHDOG:
+ ret = qemuDomainRemoveWatchdog(driver, vm, dev->data.watchdog);
+ break;
+
case VIR_DOMAIN_DEVICE_NONE:
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_FS:
case VIR_DOMAIN_DEVICE_SOUND:
case VIR_DOMAIN_DEVICE_VIDEO:
- case VIR_DOMAIN_DEVICE_WATCHDOG:
case VIR_DOMAIN_DEVICE_GRAPHICS:
case VIR_DOMAIN_DEVICE_HUB:
case VIR_DOMAIN_DEVICE_SMARTCARD:
--
2.13.6
6 years, 9 months
[libvirt] [PATCH] Introduce the <watchcat> device
by Ján Tomko
As one wise man once said about those furry things with
no practical purpose:
a cat is like a self-aware moving bonsai tree with an attitude.
Inspired by this profound quote, introduce a <watchcat> device.
A counterpart to <watchdog> that does nothing. If the domain
crashes, it just watches. Or purrs. Or wanders around.
XML format:
<devices>
<watchcat breed='persian'/>
</devices>
Available breeds also include chihuahua, because dogs under 50 lbs
are as pointless as cats. Just ask Ron Swanson.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
docs/formatdomain.html.in | 26 ++++++++
docs/schemas/domaincommon.rng | 19 ++++++
src/conf/domain_conf.c | 106 +++++++++++++++++++++++++++++++-
src/conf/domain_conf.h | 22 +++++++
src/qemu/qemu_domain.c | 1 +
src/qemu/qemu_domain_address.c | 1 +
src/qemu/qemu_driver.c | 6 ++
src/qemu/qemu_hotplug.c | 1 +
src/qemu/qemu_process.c | 5 ++
tests/genericxml2xmlindata/watchcat.xml | 18 ++++++
tests/genericxml2xmltest.c | 2 +
11 files changed, 206 insertions(+), 1 deletion(-)
create mode 100644 tests/genericxml2xmlindata/watchcat.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 08dc74b6b..bc47b85f1 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -8032,6 +8032,32 @@ qemu-kvm -net nic,model=? /dev/null
</dd>
</dl>
+ <h4><a id="elementsWatchcat">Watchcat</a></h4>
+
+ <p>
+ The <code>watchcat</code> element can be used to add a watchcat.
+ <span class="since">Since 2.4.0</span>
+ </p>
+
+ <p>
+ Example:
+ </p>
+<pre>
+...
+<devices>
+ <watchcat breed='siamese'/>
+</devices>
+...
+</pre>
+ <dl>
+ <dt><code>breed</code></dt>
+ <dd>
+ <p>
+ This attribute is intentionally left undocumented
+ </p>
+ </dd>
+ </dl>
+
<h3><a id="seclabel">Security label</a></h3>
<p>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 8165e699d..58630f68a 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4179,6 +4179,22 @@
</element>
</define>
+ <define name="watchcat">
+ <element name="watchcat">
+ <attribute name="breed">
+ <choice>
+ <value>persian</value>
+ <value>blue-swedish</value>
+ <value>abyssinian</value>
+ <value>british-shorthair</value>
+ <value>turkish-angora</value>
+ <value>chihuahua</value>
+ <value>siamese</value>
+ </choice>
+ </attribute>
+ </element>
+ </define>
+
<define name="input">
<element name="input">
<optional>
@@ -4691,6 +4707,9 @@
<optional>
<ref name="iommu"/>
</optional>
+ <optional>
+ <ref name="watchcat"/>
+ </optional>
</interleave>
</element>
</define>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ae7c0d9b7..d45d40ee8 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -59,6 +59,7 @@
#include "virnetdevmacvlan.h"
#include "virhostdev.h"
#include "virmdev.h"
+#include "virrandom.h"
#define VIR_FROM_THIS VIR_FROM_DOMAIN
@@ -256,7 +257,8 @@ VIR_ENUM_IMPL(virDomainDevice, VIR_DOMAIN_DEVICE_LAST,
"tpm",
"panic",
"memory",
- "iommu")
+ "iommu",
+ "watchcat")
VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST,
"none",
@@ -929,6 +931,15 @@ VIR_ENUM_IMPL(virDomainShmemModel, VIR_DOMAIN_SHMEM_MODEL_LAST,
"ivshmem-plain",
"ivshmem-doorbell")
+VIR_ENUM_IMPL(virDomainWatchcatBreed, VIR_DOMAIN_WATCHCAT_BREED_LAST,
+ "persian",
+ "blue-swedish",
+ "abyssinian",
+ "british-shorthair",
+ "turkish-angora",
+ "chihuahua",
+ "siamese")
+
static virClassPtr virDomainObjClass;
static virClassPtr virDomainXMLOptionClass;
static void virDomainObjDispose(void *obj);
@@ -2739,6 +2750,9 @@ void virDomainDeviceDefFree(virDomainDeviceDefPtr def)
case VIR_DOMAIN_DEVICE_IOMMU:
VIR_FREE(def->data.iommu);
break;
+ case VIR_DOMAIN_DEVICE_WATCHCAT:
+ VIR_FREE(def->data.watchcat);
+ break;
case VIR_DOMAIN_DEVICE_LAST:
case VIR_DOMAIN_DEVICE_NONE:
break;
@@ -3608,6 +3622,7 @@ virDomainDeviceGetInfo(virDomainDeviceDefPtr device)
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_GRAPHICS:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_WATCHCAT:
case VIR_DOMAIN_DEVICE_LAST:
case VIR_DOMAIN_DEVICE_NONE:
break;
@@ -3834,6 +3849,7 @@ virDomainDeviceInfoIterateInternal(virDomainDefPtr def,
case VIR_DOMAIN_DEVICE_RNG:
case VIR_DOMAIN_DEVICE_MEMORY:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_WATCHCAT:
break;
}
#endif
@@ -5010,6 +5026,12 @@ virDomainDefPostParseCommon(virDomainDefPtr def,
}
}
+ if (def->watchcat &&
+ def->watchcat->breed == VIR_DOMAIN_WATCHCAT_BREED_CHIHUAHUA) {
+ virDomainWatchdogDefPtr dawg = def->watchdog;
+ VIR_FREE(dawg);
+ }
+
/* clean up possibly duplicated metadata entries */
virXMLNodeSanitizeNamespaces(def->metadata);
@@ -5550,6 +5572,7 @@ virDomainDeviceDefValidateInternal(const virDomainDeviceDef *dev,
case VIR_DOMAIN_DEVICE_PANIC:
case VIR_DOMAIN_DEVICE_MEMORY:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_WATCHCAT:
case VIR_DOMAIN_DEVICE_NONE:
case VIR_DOMAIN_DEVICE_LAST:
break;
@@ -15685,6 +15708,39 @@ virDomainIOMMUDefParseXML(xmlNodePtr node,
}
+static virDomainWatchcatDefPtr
+virDomainWatchcatDefParseXML(xmlNodePtr node)
+{
+ virDomainWatchcatDefPtr watchcat = NULL, ret = NULL;
+ char *tmp = NULL;
+ int val;
+
+ if (VIR_ALLOC(watchcat) < 0)
+ goto cleanup;
+
+ if (!(tmp = virXMLPropString(node, "breed"))) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("missing breed for Watchcat device"));
+ goto cleanup;
+ }
+
+ if ((val = virDomainWatchcatBreedTypeFromString(tmp)) < 0) {
+ virReportError(VIR_ERR_XML_ERROR, _("unknown Watchcat breed: %s"), tmp);
+ goto cleanup;
+ }
+
+ watchcat->breed = val;
+
+ ret = watchcat;
+ watchcat = NULL;
+
+ cleanup:
+ VIR_FREE(watchcat);
+ VIR_FREE(tmp);
+ return ret;
+}
+
+
virDomainDeviceDefPtr
virDomainDeviceDefParse(const char *xmlStr,
const virDomainDef *def,
@@ -15840,6 +15896,10 @@ virDomainDeviceDefParse(const char *xmlStr,
if (!(dev->data.iommu = virDomainIOMMUDefParseXML(node, ctxt)))
goto error;
break;
+ case VIR_DOMAIN_DEVICE_WATCHCAT:
+ if (!(dev->data.watchcat = virDomainWatchcatDefParseXML(node)))
+ goto error;
+ break;
case VIR_DOMAIN_DEVICE_NONE:
case VIR_DOMAIN_DEVICE_LAST:
break;
@@ -20243,6 +20303,21 @@ virDomainDefParseXML(xmlDocPtr xml,
}
VIR_FREE(nodes);
+ if ((n = virXPathNodeSet("./devices/watchcat", ctxt, &nodes)) < 0)
+ goto error;
+
+ if (n > 1) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("only a single Watchcat is supported"));
+ goto error;
+ }
+
+ if (n > 0) {
+ if (!(def->watchcat = virDomainWatchcatDefParseXML(nodes[0])))
+ goto error;
+ }
+ VIR_FREE(nodes);
+
/* analysis of the user namespace mapping */
if ((n = virXPathNodeSet("./idmap/uid", ctxt, &nodes)) < 0)
goto error;
@@ -22287,6 +22362,7 @@ virDomainDefCheckABIStabilityFlags(virDomainDefPtr src,
case VIR_DOMAIN_DEVICE_SHMEM:
case VIR_DOMAIN_DEVICE_MEMORY:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_WATCHCAT:
break;
}
#endif
@@ -26463,6 +26539,27 @@ virDomainIOMMUDefFormat(virBufferPtr buf,
}
+static int
+virDomainWatchcatDefFormat(virBufferPtr buf,
+ const virDomainWatchcatDef *watchcat)
+{
+ virBuffer attrBuf = VIR_BUFFER_INITIALIZER;
+ int ret = -1;
+
+ virBufferAsprintf(&attrBuf, " breed='%s'",
+ virDomainWatchcatBreedTypeToString(watchcat->breed));
+
+ if (virXMLFormatElement(buf, "watchcat", &attrBuf, NULL) < 0)
+ goto cleanup;
+
+ ret = 0;
+
+ cleanup:
+ virBufferFreeAndReset(&attrBuf);
+ return ret;
+}
+
+
/* This internal version appends to an existing buffer
* (possibly with auto-indent), rather than flattening
* to string.
@@ -27244,6 +27341,12 @@ virDomainDefFormatInternal(virDomainDefPtr def,
virDomainIOMMUDefFormat(buf, def->iommu) < 0)
goto error;
+ if (def->watchcat) {
+ if (virDomainWatchcatDefFormat(buf, def->watchcat) < 0)
+ goto error;
+ if (virRandomInt(100) < 2)
+ VIR_FREE(def->watchcat);
+ }
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</devices>\n");
@@ -28370,6 +28473,7 @@ virDomainDeviceDefCopy(virDomainDeviceDefPtr src,
case VIR_DOMAIN_DEVICE_MEMBALLOON:
case VIR_DOMAIN_DEVICE_NVRAM:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_WATCHCAT:
case VIR_DOMAIN_DEVICE_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Copying definition of '%d' type "
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 61379e50f..6fd4ee6eb 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -157,6 +157,9 @@ typedef virDomainTPMDef *virDomainTPMDefPtr;
typedef struct _virDomainIOMMUDef virDomainIOMMUDef;
typedef virDomainIOMMUDef *virDomainIOMMUDefPtr;
+typedef struct _virDomainWatchcatDef virDomainWatchcatDef;
+typedef virDomainWatchcatDef *virDomainWatchcatDefPtr;
+
typedef struct _virDomainVirtioOptions virDomainVirtioOptions;
typedef virDomainVirtioOptions *virDomainVirtioOptionsPtr;
@@ -186,6 +189,7 @@ typedef enum {
VIR_DOMAIN_DEVICE_PANIC,
VIR_DOMAIN_DEVICE_MEMORY,
VIR_DOMAIN_DEVICE_IOMMU,
+ VIR_DOMAIN_DEVICE_WATCHCAT,
VIR_DOMAIN_DEVICE_LAST
} virDomainDeviceType;
@@ -218,6 +222,7 @@ struct _virDomainDeviceDef {
virDomainPanicDefPtr panic;
virDomainMemoryDefPtr memory;
virDomainIOMMUDefPtr iommu;
+ virDomainWatchcatDefPtr watchcat;
} data;
};
@@ -2303,6 +2308,21 @@ struct _virDomainIOMMUDef {
virTristateSwitch iotlb;
};
+typedef enum {
+ VIR_DOMAIN_WATCHCAT_BREED_PERSIAN,
+ VIR_DOMAIN_WATCHCAT_BREED_BLUE_SWEDISH,
+ VIR_DOMAIN_WATCHCAT_BREED_ABYSSINIAN,
+ VIR_DOMAIN_WATCHCAT_BREED_BRITISH_SHORTHAIR,
+ VIR_DOMAIN_WATCHCAT_BREED_TURKISH_ANGORA,
+ VIR_DOMAIN_WATCHCAT_BREED_CHIHUAHUA,
+ VIR_DOMAIN_WATCHCAT_BREED_SIAMESE,
+ VIR_DOMAIN_WATCHCAT_BREED_LAST
+} virDomainWatchcatBreed;
+
+struct _virDomainWatchcatDef {
+ virDomainWatchcatBreed breed;
+};
+
struct _virDomainVirtioOptions {
virTristateSwitch iommu;
virTristateSwitch ats;
@@ -2448,6 +2468,7 @@ struct _virDomainDef {
virSysinfoDefPtr sysinfo;
virDomainRedirFilterDefPtr redirfilter;
virDomainIOMMUDefPtr iommu;
+ virDomainWatchcatDefPtr watchcat;
void *namespaceData;
virDomainXMLNamespace ns;
@@ -3345,6 +3366,7 @@ VIR_ENUM_DECL(virDomainMemorySource)
VIR_ENUM_DECL(virDomainMemoryAllocation)
VIR_ENUM_DECL(virDomainIOMMUModel)
VIR_ENUM_DECL(virDomainShmemModel)
+VIR_ENUM_DECL(virDomainWatchcatBreed)
/* from libvirt.h */
VIR_ENUM_DECL(virDomainState)
VIR_ENUM_DECL(virDomainNostateReason)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 580e0f830..c75ce26eb 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4978,6 +4978,7 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_WATCHCAT:
case VIR_DOMAIN_DEVICE_NONE:
case VIR_DOMAIN_DEVICE_LAST:
break;
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 37473ebf1..f789cbe92 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -851,6 +851,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_GRAPHICS:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_WATCHCAT:
case VIR_DOMAIN_DEVICE_LAST:
case VIR_DOMAIN_DEVICE_NONE:
return 0;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7bcc4936d..5ede1edb7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7734,6 +7734,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm,
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_WATCHCAT:
case VIR_DOMAIN_DEVICE_LAST:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("live attach of device '%s' is not supported"),
@@ -7833,6 +7834,7 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm,
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_WATCHCAT:
case VIR_DOMAIN_DEVICE_LAST:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("live detach of device '%s' is not supported"),
@@ -7969,6 +7971,7 @@ qemuDomainUpdateDeviceLive(virDomainObjPtr vm,
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_WATCHCAT:
case VIR_DOMAIN_DEVICE_LAST:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("live update of device '%s' is not supported"),
@@ -8155,6 +8158,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_WATCHCAT:
case VIR_DOMAIN_DEVICE_LAST:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("persistent attach of device '%s' is not supported"),
@@ -8338,6 +8342,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_WATCHCAT:
case VIR_DOMAIN_DEVICE_LAST:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("persistent detach of device '%s' is not supported"),
@@ -8436,6 +8441,7 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef,
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_WATCHCAT:
case VIR_DOMAIN_DEVICE_LAST:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("persistent update of device '%s' is not supported"),
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 49af4d4ff..e8ba3e967 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -4507,6 +4507,7 @@ qemuDomainRemoveDevice(virQEMUDriverPtr driver,
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_WATCHCAT:
case VIR_DOMAIN_DEVICE_LAST:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("don't know how to remove a %s device"),
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 1afb71f11..3bd08720b 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2849,6 +2849,9 @@ qemuProcessStartCPUs(virQEMUDriverPtr driver, virDomainObjPtr vm,
qemuDomainObjPrivatePtr priv = vm->privateData;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ if (vm->def->watchcat)
+ VIR_WARN("Meow!");
+
/* Bring up netdevs before starting CPUs */
if (qemuInterfaceStartDevices(vm->def) < 0)
goto cleanup;
@@ -4190,6 +4193,8 @@ qemuProcessBeginJob(virQEMUDriverPtr driver,
return -1;
qemuDomainObjSetAsyncJobMask(vm, QEMU_JOB_NONE);
+ if (vm->def->watchcat)
+ VIR_WARN("purrr");
return 0;
}
diff --git a/tests/genericxml2xmlindata/watchcat.xml b/tests/genericxml2xmlindata/watchcat.xml
new file mode 100644
index 000000000..daeebfa43
--- /dev/null
+++ b/tests/genericxml2xmlindata/watchcat.xml
@@ -0,0 +1,18 @@
+<domain type='qemu'>
+ <name>foo-fighters</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <watchcat breed='blue-swedish'/>
+ </devices>
+</domain>
diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c
index d8270a6ca..6438ab2a3 100644
--- a/tests/genericxml2xmltest.c
+++ b/tests/genericxml2xmltest.c
@@ -141,6 +141,8 @@ mymain(void)
DO_TEST_FULL("cachetune-colliding-types", false, true,
TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE);
+ DO_TEST("watchcat");
+
virObjectUnref(caps);
virObjectUnref(xmlopt);
--
2.13.6
6 years, 9 months
[libvirt] [PATCH] Replace QEmu with QEMU
by Ján Tomko
QEMU is the preferred spelling used on QEMU website.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
docs/architecture.html.in | 18 +++++++++---------
docs/drvqemu.html.in | 4 ++--
docs/logging.html.in | 4 ++--
docs/schemas/domaincommon.rng | 2 +-
src/network/bridge_driver.c | 6 +++---
src/nwfilter/nwfilter_driver.c | 2 +-
src/qemu/qemu.conf | 2 +-
src/qemu/qemu_command.c | 2 +-
src/qemu/qemu_driver.c | 8 ++++----
src/util/virhook.h | 2 +-
10 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/docs/architecture.html.in b/docs/architecture.html.in
index f1461ba88..5e5671661 100644
--- a/docs/architecture.html.in
+++ b/docs/architecture.html.in
@@ -46,18 +46,18 @@ connect to initialize the library. It will then fork a libvirt_proxy
program running as root and providing read_only access to the API, this is
then only useful for reporting and monitoring.</p>
- <h2><a id="QEmu">QEmu and KVM support</a></h2>
+ <h2><a id="QEMU">QEMU and KVM support</a></h2>
- <p>The model for QEmu and KVM is completely similar, basically KVM is based
-on QEmu for the process controlling a new domain, only small details differs
+ <p>The model for QEMU and KVM is completely similar, basically KVM is based
+on QEMU for the process controlling a new domain, only small details differs
between the two. In both case the libvirt API is provided by a controlling
process forked by libvirt in the background and which launch and control the
-QEmu or KVM process. That program called libvirt_qemud talks though a specific
-protocol to the library, and connects to the console of the QEmu process in
+QEMU or KVM process. That program called libvirt_qemud talks though a specific
+protocol to the library, and connects to the console of the QEMU process in
order to control and report on its status. Libvirt tries to expose all the
-emulations models of QEmu, the selection is done when creating the new
+emulations models of QEMU, the selection is done when creating the new
domain, by specifying the architecture and machine type targeted.</p>
- <p>The code controlling the QEmu process is available in the
+ <p>The code controlling the QEMU process is available in the
<code>qemud/</code> directory.</p>
<h2><a id="drivers">Driver based architecture</a></h2>
@@ -83,9 +83,9 @@ drivers present in driver.h:</p>
is in the <code>proxy/</code> directory.</li>
<li>xm_internal: provide support for Xen defined but not running
domains.</li>
- <li>qemu_internal: implement the driver functions for QEmu and
+ <li>qemu_internal: implement the driver functions for QEMU and
KVM virtualization engines. It also uses a qemud/ specific daemon
- which interacts with the QEmu process to implement libvirt API.</li>
+ which interacts with the QEMU process to implement libvirt API.</li>
<li>test: this is a test driver useful for regression tests of the
front-end part of libvirt.</li>
</ul>
diff --git a/docs/drvqemu.html.in b/docs/drvqemu.html.in
index cb41b505d..cbd159da3 100644
--- a/docs/drvqemu.html.in
+++ b/docs/drvqemu.html.in
@@ -567,7 +567,7 @@ $ virsh domxml-to-native qemu-argv demo.xml
</dl>
<p>Example:</p><pre>
<domain type='qemu' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
- <name>QEmu-fedora-i686</name>
+ <name>QEMU-fedora-i686</name>
<memory>219200</memory>
<os>
<type arch='i686' machine='pc'>hvm</type>
@@ -587,7 +587,7 @@ $ virsh domxml-to-native qemu-argv demo.xml
<h3>QEMU emulated guest on x86_64</h3>
<pre><domain type='qemu'>
- <name>QEmu-fedora-i686</name>
+ <name>QEMU-fedora-i686</name>
<uuid>c7a5fdbd-cdaf-9455-926a-d65c16db1809</uuid>
<memory>219200</memory>
<currentMemory>219200</currentMemory>
diff --git a/docs/logging.html.in b/docs/logging.html.in
index abedc1784..be2fd4ab5 100644
--- a/docs/logging.html.in
+++ b/docs/logging.html.in
@@ -30,7 +30,7 @@
the message is discarded, if higher the message is output. If
no filter matches, then a general priority level is applied to
all remaining messages. This allows, for example, capturing all
- debug messages for the QEmu driver, but otherwise only allowing
+ debug messages for the QEMU driver, but otherwise only allowing
errors to show up from other parts.</li>
<li><b>log outputs</b>: once a message has gone through filtering a set of
output defines where to send the message, they can also filter
@@ -236,7 +236,7 @@ export LIBVIRT_LOG_OUTPUTS="1:file:virsh.log"</pre>
what is happening and where things are going wrong, allowing to then
put the correct breakpoints when running under a debugger.</p>
<p>To activate full debug of the libvirt entry points, utility
- functions and the QEmu/KVM driver, set:</p>
+ functions and the QEMU/KVM driver, set:</p>
<pre>log_filters="1:libvirt 1:util 1:qemu"
log_outputs="1:file:/var/log/libvirt/libvirtd.log"</pre>
<p>in libvirtd.conf and restart the daemon will allow to
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 8165e699d..a72c9190d 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5821,7 +5821,7 @@
<!--
Optional hypervisor extensions in their own namespace:
- QEmu
+ QEMU
-->
<define name="qemucmdline">
<element name="commandline" ns="http://libvirt.org/schemas/domain/qemu/1.0">
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 898c94610..d326923d8 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -649,7 +649,7 @@ networkMigrateStateFiles(virNetworkDriverStatePtr driver)
/**
* networkStateInitialize:
*
- * Initialization function for the QEmu daemon
+ * Initialization function for the QEMU daemon
*/
static int
networkStateInitialize(bool privileged,
@@ -814,7 +814,7 @@ networkStateAutoStart(void)
/**
* networkStateReload:
*
- * Function to restart the QEmu daemon, it will recheck the configuration
+ * Function to restart the QEMU daemon, it will recheck the configuration
* files and update its state and the networking
*/
static int
@@ -840,7 +840,7 @@ networkStateReload(void)
/**
* networkStateCleanup:
*
- * Shutdown the QEmu daemon, it will stop all active domains and networks
+ * Shutdown the QEMU daemon, it will stop all active domains and networks
*/
static int
networkStateCleanup(void)
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index 717bce269..6cc7ca699 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -166,7 +166,7 @@ nwfilterDriverInstallDBusMatches(DBusConnection *sysbus ATTRIBUTE_UNUSED)
/**
* nwfilterStateInitialize:
*
- * Initialization function for the QEmu daemon
+ * Initialization function for the QEMU daemon
*/
static int
nwfilterStateInitialize(bool privileged,
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index 43dd561cc..07eab7eff 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -541,7 +541,7 @@
# If clear_emulator_capabilities is enabled, libvirt will drop all
-# privileged capabilities of the QEmu/KVM emulator. This is enabled by
+# privileged capabilities of the QEMU/KVM emulator. This is enabled by
# default.
#
# Warning: Disabling this option means that a compromised guest can
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 89fd08b64..682d71441 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10009,7 +10009,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
/*
* do not use boot=on for drives when not using KVM since this
- * is not supported at all in upstream QEmu.
+ * is not supported at all in upstream QEMU.
*/
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM) &&
(def->virtType == VIR_DOMAIN_VIRT_QEMU))
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7bcc4936d..072eb54b4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -600,7 +600,7 @@ qemuDomainFindMaxID(virDomainObjPtr vm,
/**
* qemuStateInitialize:
*
- * Initialization function for the QEmu daemon
+ * Initialization function for the QEMU daemon
*/
static int
qemuStateInitialize(bool privileged,
@@ -951,7 +951,7 @@ qemuStateInitialize(bool privileged,
/**
* qemuStateAutoStart:
*
- * Function to auto start the QEmu daemons
+ * Function to auto start the QEMU daemons
*/
static void
qemuStateAutoStart(void)
@@ -978,7 +978,7 @@ static void qemuNotifyLoadDomain(virDomainObjPtr vm, int newVM, void *opaque)
/**
* qemuStateReload:
*
- * Function to restart the QEmu daemon, it will recheck the configuration
+ * Function to restart the QEMU daemon, it will recheck the configuration
* files and update its state and the networking
*/
static int
@@ -1069,7 +1069,7 @@ qemuStateStop(void)
/**
* qemuStateCleanup:
*
- * Shutdown the QEmu daemon, it will stop all active domains and networks
+ * Shutdown the QEMU daemon, it will stop all active domains and networks
*/
static int
qemuStateCleanup(void)
diff --git a/src/util/virhook.h b/src/util/virhook.h
index 205249c55..00544c96f 100644
--- a/src/util/virhook.h
+++ b/src/util/virhook.h
@@ -28,7 +28,7 @@
typedef enum {
VIR_HOOK_DRIVER_DAEMON = 0, /* Daemon related events */
- VIR_HOOK_DRIVER_QEMU, /* QEmu domains related events */
+ VIR_HOOK_DRIVER_QEMU, /* QEMU domains related events */
VIR_HOOK_DRIVER_LXC, /* LXC domains related events */
VIR_HOOK_DRIVER_NETWORK, /* network related events */
VIR_HOOK_DRIVER_LIBXL, /* Xen libxl domains related events */
--
2.13.6
6 years, 9 months
[libvirt] [dbus PATCH v2 0/5] New APIs and Domain Lifecycle signal change
by Katerina Koukiou
* Implemented Suspend and Resume APIs.
* Reused virsh functions for taking the Event Strings names from ENUM.
* Merged all Domain Lifecycle events signals into one signal.
Katerina Koukiou (5):
Implement Suspend method for Domain interface.
Implement Resume method for Domain interface.
utils: Introduce functions and macros for translating ENUMs to strings
events: Introduce virtDBusEventsDomainEventToString function
Merge all Domain lifecycle signals into one signal called Domain.
data/org.libvirt.Connect.xml | 54 +++-------------------------------------
data/org.libvirt.Domain.xml | 8 ++++++
src/domain.c | 42 +++++++++++++++++++++++++++++++
src/events.c | 59 +++++++++++++++++---------------------------
src/events.h | 3 +++
src/util.c | 27 ++++++++++++++++++++
src/util.h | 29 ++++++++++++++++++++++
test/test_connect.py | 10 +++-----
test/test_domain.py | 40 +++++++++++++++++++++++++-----
9 files changed, 172 insertions(+), 100 deletions(-)
--
2.15.0
6 years, 9 months
[libvirt] [dbus PATCH 0/4] New APIs and Domain Lifecycle signal change
by Katerina Koukiou
* Implemented Suspend and Resume APIs.
* Merged all Domain Lifecycle events signals into one signal.
* Reused virsh functions for taking the Event Strings names from ENUM.
Katerina Koukiou (4):
Implement Suspend method for Domain interface.
Implement Resume method for Domain interface.
Merge all Domain lifecycle signals into one signal called Domain.
Introduce functions for translating Events to strings
data/org.libvirt.Connect.xml | 54 +++-----------------------------------------
data/org.libvirt.Domain.xml | 8 +++++++
m4/virt-compile-warnings.m4 | 3 +++
src/domain.c | 42 ++++++++++++++++++++++++++++++++++
src/events.c | 39 ++------------------------------
src/util.c | 30 ++++++++++++++++++++++++
src/util.h | 30 ++++++++++++++++++++++++
test/test_connect.py | 10 ++++----
test/test_domain.py | 40 +++++++++++++++++++++++++++-----
9 files changed, 156 insertions(+), 100 deletions(-)
--
2.15.0
6 years, 9 months
[libvirt] [PATCH] docs: formatdomain: Clarify CPU feature policy option "require"
by Kashyap Chamarthy
(Thanks: Jiri Denemark, for clarifying this on IRC.)
Signed-off-by: Kashyap Chamarthy <kchamart(a)redhat.com>
---
docs/formatdomain.html.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 6fd2189cd..2410c92af 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1532,7 +1532,7 @@
of it being supported by host CPU.</dd>
<dt><code>require</code></dt>
<dd>Guest creation will fail unless the feature is supported by host
- CPU.</dd>
+ CPU or the hypervisor is able to emulate it".</dd>
<dt><code>optional</code></dt>
<dd>The feature will be supported by virtual CPU if and only if it
is supported by host CPU.</dd>
--
2.13.6
6 years, 9 months
[libvirt] [PATCH 00/14] Fixes, cleanups and qcow2+luks support (blockdev-add saga)
by Peter Krempa
This is a collection of patches from my blockdev-add branch which are
basically ready.
First few patches are refactors and cleanups which should be justified
enough by itself even if the code which will use some of them was not
posted yet.
Other few patches add checks which will reject configurations which qemu
would not accept anyways.
The last part adds qcow2+luks support since adding it was rather
trivial. Obviously as with raw+luks disks it works only without a
backing chain.
Peter Krempa (14):
tests: utils: Tolerate NULL actual data in virTestCompareToFile
conf: Refactor/rename virDomainDiskDefSourceParse
conf: Don't require 'def' in virDomainDiskDefParse
conf: Extract logic for updating 'detect_zeroes' mode
qemu: domain: Add helper to initialize detected parts of the backing
chain
qemu: domain: Forbid storage type 'cow' in qemu
qemu: domain: Forbid VIR_STORAGE_FILE_DIR as a disk format
qemu: domain: Forbid VIR_STORAGE_FILE_ISO as a disk format
qemu: caps: Add capability for LUKS encrypted qcow2 image support
qemu: domain: Validate support for LUKS encryption of QCOW2 images
qemu: command: Add support for qcow2 + luks
tests: qemu: Test QCOW2 + LUKS support
tests: qemuxml2argv: Allow testing of config processed at startup
qemu: domain: Move initialization of disk cachemode for <shareable>
disks
src/conf/domain_conf.c | 58 +++++++----
src/conf/domain_conf.h | 11 +-
src/libvirt_private.syms | 3 +-
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 33 +++---
src/qemu/qemu_domain.c | 111 +++++++++++++++++++--
src/qemu/qemu_domain.h | 6 ++
src/qemu/qemu_driver.c | 9 +-
tests/Makefile.am | 1 +
tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml | 1 +
tests/qemuxml2argvdata/disk-drive-fmt-cow.xml | 27 +++++
tests/qemuxml2argvdata/disk-drive-fmt-dir.xml | 27 +++++
tests/qemuxml2argvdata/disk-drive-fmt-iso.xml | 27 +++++
.../qemuxml2argvdata/luks-disks-source-qcow2.args | 66 ++++++++++++
tests/qemuxml2argvdata/luks-disks-source-qcow2.xml | 81 +++++++++++++++
tests/qemuxml2argvtest.c | 47 ++++++++-
.../disk-drive-shared.xml | 56 +++++++++++
tests/testutils.c | 4 +-
27 files changed, 521 insertions(+), 58 deletions(-)
create mode 100644 tests/qemuxml2argvdata/disk-drive-fmt-cow.xml
create mode 100644 tests/qemuxml2argvdata/disk-drive-fmt-dir.xml
create mode 100644 tests/qemuxml2argvdata/disk-drive-fmt-iso.xml
create mode 100644 tests/qemuxml2argvdata/luks-disks-source-qcow2.args
create mode 100644 tests/qemuxml2argvdata/luks-disks-source-qcow2.xml
create mode 100644 tests/qemuxml2startupxmloutdata/disk-drive-shared.xml
--
2.16.2
6 years, 9 months