[libvirt PATCH] docs: virtiofs: remove extra slash
by Ján Tomko
Reported-by: Richard W.M. Jones <rjones(a)redhat.com>
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
Pushed as trivial.
docs/kbase/virtiofs.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/kbase/virtiofs.rst b/docs/kbase/virtiofs.rst
index b89de0c57a..9123fc2316 100644
--- a/docs/kbase/virtiofs.rst
+++ b/docs/kbase/virtiofs.rst
@@ -81,7 +81,7 @@ control and need to be set by the application running virtiofsd.
::
- <filesystem type='mount'/>
+ <filesystem type='mount'>
<driver type='virtiofs' queue='1024'/>
<source socket='/var/virtiofsd.sock'/>
<target dir='tag'/>
--
2.31.1
3 years, 2 months
[libvirt PATCH] docs: virtiofs: provide more context for elements
by Ján Tomko
Suggested-by: Richard W.M. Jones <rjones(a)redhat.com>
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
Pushed as trivial.
docs/kbase/virtiofs.rst | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/docs/kbase/virtiofs.rst b/docs/kbase/virtiofs.rst
index d728a1358c..b89de0c57a 100644
--- a/docs/kbase/virtiofs.rst
+++ b/docs/kbase/virtiofs.rst
@@ -62,11 +62,14 @@ More optional elements can be specified
::
- <driver type='virtiofs' queue='1024'/>
- <binary path='/usr/libexec/virtiofsd' xattr='on'>
- <cache mode='always'/>
- <lock posix='on' flock='on'/>
- </binary>
+ <filesystem type='mount' accessmode='passthrough'>
+ <driver type='virtiofs' queue='1024'/>
+ ...
+ <binary path='/usr/libexec/virtiofsd' xattr='on'>
+ <cache mode='always'/>
+ <lock posix='on' flock='on'/>
+ </binary>
+ </filesystem>
Externally-launched virtiofsd
=============================
--
2.31.1
3 years, 2 months
[libvirt PATCH 00/24] tests: use g_auto more (glib chronicles)
by Ján Tomko
Ján Tomko (24):
tests: virnetdaemontest: split variable declarations
conf: add cleanup func for virNetworkXMLOption
conf: add cleanup func for virMacMap
tests: use g_autoptr instead of virObjectUnref
tests: qemu: use g_autofree
tests: network: use g_autofree
tests: libxl: use g_autofree
tests: nwfilter: use g_autofree
tests: vmx: use g_autofree
tests: vir: use g_autofree
tests: use g_autofree
tests: use g_autoptr instead of virJSONValueFree
tests: use g_auto for virCPUDataFree
tests: use g_auto instead of VIR_FORCE_FCLOSE
tests: use VIR_AUTOCLOSE
tests: use g_auto instead of vshTableFree
tests: use g_auto instead of virDomainFree
tests: qemu: remove pointless labels
tests: vmx: remove pointless labels
tests: libxl: remove pointless labels
tests: nwfilter: remove pointless labels
tests: vshtabletest: remove pointless labels
tests: vir: remove pointless labels
tests: remove pointless labels
src/conf/network_conf.h | 1 +
src/util/virmacmap.h | 2 +
tests/cputest.c | 51 ++++-------
tests/domaincapstest.c | 60 +++++--------
tests/domainconftest.c | 18 ++--
tests/eventtest.c | 3 +-
tests/fchosttest.c | 70 +++++----------
tests/fdstreamtest.c | 24 ++---
tests/genericxml2xmltest.c | 6 +-
tests/interfacexml2xmltest.c | 9 +-
tests/libxlxml2domconfigtest.c | 18 ++--
tests/lxcconf2xmltest.c | 37 +++-----
tests/lxcxml2xmltest.c | 6 +-
tests/metadatatest.c | 37 +++-----
tests/networkxml2conftest.c | 19 ++--
tests/networkxml2firewalltest.c | 9 +-
tests/networkxml2xmltest.c | 13 +--
tests/networkxml2xmlupdatetest.c | 16 ++--
tests/nodedevxml2xmltest.c | 9 +-
tests/nsstest.c | 4 +-
tests/nwfilterebiptablestest.c | 84 ++++++-----------
tests/nwfilterxml2firewalltest.c | 12 +--
tests/nwfilterxml2xmltest.c | 10 +--
tests/openvzutilstest.c | 23 ++---
tests/qemuagenttest.c | 31 ++-----
tests/qemucapsprobemock.c | 12 +--
tests/qemucommandutiltest.c | 15 ++--
tests/qemumonitorjsontest.c | 116 +++++++++---------------
tests/qemumonitortestutils.c | 45 +++-------
tests/qemuxml2argvtest.c | 24 ++---
tests/scsihosttest.c | 37 +++-----
tests/secretxml2xmltest.c | 7 +-
tests/securityselinuxlabeltest.c | 27 ++----
tests/sockettest.c | 4 +-
tests/testutils.c | 8 +-
tests/testutilslxc.c | 4 +-
tests/vboxsnapshotxmltest.c | 12 +--
tests/vircapstest.c | 20 ++---
tests/vircgrouptest.c | 3 +-
tests/virconftest.c | 44 ++++-----
tests/vircryptotest.c | 35 +++-----
tests/virfilecachetest.c | 3 +-
tests/virfilemock.c | 3 +-
tests/virfiletest.c | 61 +++++--------
tests/virhostcputest.c | 42 +++------
tests/viriscsitest.c | 18 ++--
tests/virkmodtest.c | 39 +++-----
tests/virmacmaptest.c | 49 ++++------
tests/virnetdaemontest.c | 13 ++-
tests/virnetsockettest.c | 6 +-
tests/virnettlshelpers.c | 4 +-
tests/virnetworkportxml2xmltest.c | 23 ++---
tests/virnumamock.c | 14 +--
tests/virnwfilterbindingxml2xmltest.c | 7 +-
tests/virpcimock.c | 4 +-
tests/virpcitest.c | 56 +++++-------
tests/virresctrltest.c | 34 +++----
tests/virrotatingfiletest.c | 4 +-
tests/virscsitest.c | 31 ++-----
tests/virstringtest.c | 44 +++------
tests/virsystemdtest.c | 29 ++----
tests/virtestmock.c | 10 +--
tests/viruritest.c | 3 +-
tests/virusbmock.c | 7 +-
tests/virusbtest.c | 6 +-
tests/vmwarevertest.c | 20 ++---
tests/vmx2xmltest.c | 35 +++-----
tests/vshtabletest.c | 125 ++++++++++----------------
tests/xlconfigtest.c | 85 +++++++-----------
tests/xmconfigtest.c | 62 +++++--------
tests/xml2vmxtest.c | 32 +++----
71 files changed, 628 insertions(+), 1226 deletions(-)
--
2.31.1
3 years, 2 months
[libvirt PATCH v3 0/7] Enable autostarting mediated devices
by Jonathon Jongsma
This first version of this series was reviewed quite a while ago and all
patches were ACKed except the second one. I posted a second series with changes
noted below but it was never ACKed and I dropped the ball for a little while.
Subsequently there were questions about whether physical devices (e.g. pci,
usb, etc) should return 'true' or 'false' for the GetAutostart()/IsPersistent()
calls. I had initially marked them as persistent=true and autostart=true
because they superficially act a bit like persistently-defined devices. But
Boris convinced me that this is not a very accurate classification since if the
physical device is unplugged, there will be no record of it left behind. So
I've switched all non-mdev devices to be persistent=false and autostart=false.
This is also imperfect, but it seems relatively harmless. Comments welcome.
A reminder of what is included in this series:
- new API consistent with existing libvirt objects:
- virNodeDeviceGetAutostart()
- virNodeDeviceSetAutostart()
- virNodeDeviceIsPersistent()
- virNodeDeviceIsActive
- new virsh commands
- nodedev-info
- nodedev-autostart
Changes in version 2:
- Parse the autostart property from mdevctl output.
Changes in version 3:
- switch physical devices to autostart=false, persistent=false
- rebase to upstream
- update version numbers for new API, etc
- fix accidental copy-paste error in virsh command descriptions
Jonathon Jongsma (7):
api: add virNodeDevice(Get|Set)Autostart()
nodedev: implement virNodeDevice(Get|Set)Autostart()
nodedev: Add tests for mdevctl autostart command
virsh: add nodedev-autostart
api: add virNodeDeviceIsPersistent()/IsActive()
nodedev: Implement virNodeDeviceIsPersistent()/IsActive()
virsh: add nodedev-info
docs/manpages/virsh.rst | 27 +++
include/libvirt/libvirt-nodedev.h | 10 +
src/conf/node_device_conf.h | 1 +
src/conf/virnodedeviceobj.c | 16 ++
src/conf/virnodedeviceobj.h | 6 +
src/driver-nodedev.h | 18 ++
src/libvirt-nodedev.c | 141 +++++++++++++
src/libvirt_private.syms | 2 +
src/libvirt_public.syms | 4 +
src/node_device/node_device_driver.c | 189 +++++++++++++++++-
src/node_device/node_device_driver.h | 19 ++
src/node_device/node_device_udev.c | 22 +-
src/remote/remote_driver.c | 6 +-
src/remote/remote_protocol.x | 60 +++++-
src/remote_protocol-structs | 26 +++
.../nodedevmdevctldata/mdevctl-autostart.argv | 8 +
tests/nodedevmdevctltest.c | 55 +++++
tools/virsh-nodedev.c | 139 +++++++++++++
18 files changed, 740 insertions(+), 9 deletions(-)
create mode 100644 tests/nodedevmdevctldata/mdevctl-autostart.argv
--
2.31.1
3 years, 2 months
[PATCH] virsh: Display vhostuser socket path in domblklist
by dinglimin
The domblklist command is designed to show a brief information about the blocks of a domain.
One piece of information that is shows is "Target "and "Source".
Before the modification, the Vhost disk of SPDK is displayed as "-".
After the modification, the socket associated with it can be displayed
Signed-off-by: dinglimin <dinglimin(a)cmss.chinamobile.com>
---
tools/virsh-domain-monitor.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index f7cf82acdf..eb3e0ef11a 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -644,7 +644,8 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd)
"|./source/@dev"
"|./source/@dir"
"|./source/@name"
- "|./source/@volume)", ctxt);
+ "|./source/@volume"
+ "|./source/@path)", ctxt);
}
if (details) {
--
2.18.2
3 years, 2 months
[PATCH] qemu_driver:report guest interface informations
by scuzhanglei
Signed-off-by: scuzhanglei <greatzhanglei(a)gmail.com>
---
NEWS.rst | 5 ++
include/libvirt/libvirt-domain.h | 1 +
src/libvirt-domain.c | 12 +++++
src/qemu/qemu_agent.c | 9 ++--
src/qemu/qemu_agent.h | 3 +-
src/qemu/qemu_driver.c | 88 +++++++++++++++++++++++++++++++-
tests/qemuagenttest.c | 2 +-
tools/virsh-domain.c | 2 +
8 files changed, 115 insertions(+), 7 deletions(-)
diff --git a/NEWS.rst b/NEWS.rst
index 21df0e1602..fde781b320 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -19,6 +19,11 @@ v7.7.0 (unreleased)
* **Improvements**
+ * qemu: Report guest interfaces information in ``virDomainGetGuestInfo``
+
+ Libvirt is now able to report interfaces from the guest's
+ perspective (using guest agent).
+
* **Bug fixes**
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 7ef8ac51e5..b088847725 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -5074,6 +5074,7 @@ typedef enum {
VIR_DOMAIN_GUEST_INFO_HOSTNAME = (1 << 3), /* return hostname information */
VIR_DOMAIN_GUEST_INFO_FILESYSTEM = (1 << 4), /* return filesystem information */
VIR_DOMAIN_GUEST_INFO_DISKS = (1 << 5), /* return disks information */
+ VIR_DOMAIN_GUEST_INFO_INTERFACES = (1 << 6), /* return interfaces information */
} virDomainGuestInfoTypes;
int virDomainGetGuestInfo(virDomainPtr domain,
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index a8a386e839..dfd84b4744 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -12586,6 +12586,18 @@ virDomainSetVcpu(virDomainPtr domain,
* virTypedParamsFree to free memory returned in @params.
*
* Returns 0 on success, -1 on error.
+ * VIR_DOMAIN_GUEST_INFO_INTERFACES:
+ * Returns information about the interfaces within the domain. the typed
+ * parameter keys are in this format:
+ *
+ * "if.count" - the number of interfaces defined on this domain
+ * as an unsigned int
+ * "if.<num>.name" - interface name in the guest
+ * "if.<num>.hwaddr" - hardware address of interface
+ * "if.<num>.addr.count - the number of ip addresses of interface
+ * "if.<num>.addr.<num>.type" - the type of ip address(e.g. ipv4)
+ * "if.<num>.addr.<num>.addr" - the ip address
+ * "if.<num>.addr.<num>.prefix" - the number of bits of ip address prefix
*/
int virDomainGetGuestInfo(virDomainPtr domain,
unsigned int types,
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 5f421be6f6..a7f943e0dc 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -2245,17 +2245,20 @@ qemuAgentGetAllInterfaceAddresses(virDomainInterfacePtr **ifaces_ret,
*/
int
qemuAgentGetInterfaces(qemuAgent *agent,
- virDomainInterfacePtr **ifaces)
+ virDomainInterfacePtr **ifaces,
+ bool report_unsupported)
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
virJSONValue *ret_array = NULL;
+ int rc;
if (!(cmd = qemuAgentMakeCommand("guest-network-get-interfaces", NULL)))
return -1;
- if (qemuAgentCommand(agent, cmd, &reply, agent->timeout) < 0)
- return -1;
+ if ((rc = qemuAgentCommandFull(agent, cmd, &reply, agent->timeout,
+ report_unsupported)) < 0)
+ return rc;
if (!(ret_array = virJSONValueObjectGetArray(reply, "return"))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
diff --git a/src/qemu/qemu_agent.h b/src/qemu/qemu_agent.h
index 81b45b8e5d..94eab9de9f 100644
--- a/src/qemu/qemu_agent.h
+++ b/src/qemu/qemu_agent.h
@@ -151,7 +151,8 @@ int qemuAgentSetTime(qemuAgent *mon,
bool sync);
int qemuAgentGetInterfaces(qemuAgent *mon,
- virDomainInterfacePtr **ifaces);
+ virDomainInterfacePtr **ifaces,
+ bool report_unsupported);
int qemuAgentSetUserPassword(qemuAgent *mon,
const char *user,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f1f961c51c..0b803c392b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18957,7 +18957,7 @@ qemuDomainInterfaceAddresses(virDomainPtr dom,
goto endjob;
agent = qemuDomainObjEnterAgent(vm);
- ret = qemuAgentGetInterfaces(agent, ifaces);
+ ret = qemuAgentGetInterfaces(agent, ifaces, true);
qemuDomainObjExitAgent(vm, agent);
endjob:
@@ -19903,7 +19903,8 @@ static const unsigned int qemuDomainGetGuestInfoSupportedTypes =
VIR_DOMAIN_GUEST_INFO_TIMEZONE |
VIR_DOMAIN_GUEST_INFO_HOSTNAME |
VIR_DOMAIN_GUEST_INFO_FILESYSTEM |
- VIR_DOMAIN_GUEST_INFO_DISKS;
+ VIR_DOMAIN_GUEST_INFO_DISKS |
+ VIR_DOMAIN_GUEST_INFO_INTERFACES;
static int
qemuDomainGetGuestInfoCheckSupport(unsigned int types,
@@ -20102,6 +20103,69 @@ qemuAgentFSInfoFormatParams(qemuAgentFSInfo **fsinfo,
}
}
+static void
+virDomainInterfaceFormatParams(virDomainInterfacePtr *ifaces,
+int nifaces,
+virTypedParameterPtr *params,
+int *nparams, int * maxparams)
+{
+ size_t i, j;
+ const char *type = NULL;
+
+ if (virTypedParamsAddUInt(params, nparams, maxparams,
+ "if.count", nifaces) < 0)
+ return;
+
+ for (i = 0; i < nifaces; i++) {
+ char param_name[VIR_TYPED_PARAM_FIELD_LENGTH];
+ g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
+ "if.%zu.name", i);
+ if (virTypedParamsAddString(params, nparams, maxparams,
+ param_name, ifaces[i]->name) < 0)
+ return;
+
+ g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
+ "if.%zu.hwaddr", i);
+ if (virTypedParamsAddString(params, nparams, maxparams,
+ param_name, ifaces[i]->hwaddr) < 0)
+ return;
+
+ g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
+ "if.%zu.addr.count", i);
+ if (virTypedParamsAddUInt(params, nparams, maxparams,
+ param_name, ifaces[i]->naddrs) < 0)
+ return;
+
+ for (j = 0; j < ifaces[i]->naddrs; j++) {
+ switch (ifaces[i]->addrs[j].type) {
+ case VIR_IP_ADDR_TYPE_IPV4:
+ type = "ipv4";
+ break;
+ case VIR_IP_ADDR_TYPE_IPV6:
+ type = "ipv6";
+ break;
+ }
+
+ g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
+ "if.%zu.addr.%zu.type", i, j);
+ if (virTypedParamsAddString(params, nparams, maxparams,
+ param_name, type) < 0)
+ return;
+
+ g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
+ "if.%zu.addr.%zu.addr", i, j);
+ if (virTypedParamsAddString(params, nparams, maxparams,
+ param_name, ifaces[i]->addrs[j].addr) < 0)
+ return;
+
+ g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
+ "if.%zu.addr.%zu.prefix", i, j);
+ if (virTypedParamsAddUInt(params, nparams, maxparams,
+ param_name, ifaces[i]->addrs[j].prefix) < 0)
+ return;
+ }
+ }
+}
static int
qemuDomainGetGuestInfo(virDomainPtr dom,
@@ -20123,6 +20187,8 @@ qemuDomainGetGuestInfo(virDomainPtr dom,
qemuAgentFSInfo **agentfsinfo = NULL;
size_t ndisks = 0;
qemuAgentDiskInfo **agentdiskinfo = NULL;
+ virDomainInterfacePtr *ifaces = NULL;
+ size_t nifaces = 0;
size_t i;
virCheckFlags(0, -1);
@@ -20188,6 +20254,15 @@ qemuDomainGetGuestInfo(virDomainPtr dom,
}
}
+ if (supportedTypes & VIR_DOMAIN_GUEST_INFO_INTERFACES) {
+ rc = qemuAgentGetInterfaces(agent, &ifaces, report_unsupported);
+ if (rc == -1) {
+ goto exitagent;
+ } else if (rc >= 0) {
+ nifaces = rc;
+ }
+ }
+
qemuDomainObjExitAgent(vm, agent);
qemuDomainObjEndAgentJob(vm);
@@ -20210,6 +20285,10 @@ qemuDomainGetGuestInfo(virDomainPtr dom,
qemuDomainObjEndJob(driver, vm);
}
+ if (nifaces > 0) {
+ virDomainInterfaceFormatParams(ifaces, nifaces, params, nparams, &maxparams);
+ }
+
ret = 0;
cleanup:
@@ -20219,6 +20298,11 @@ qemuDomainGetGuestInfo(virDomainPtr dom,
for (i = 0; i < ndisks; i++)
qemuAgentDiskInfoFree(agentdiskinfo[i]);
g_free(agentdiskinfo);
+ if (ifaces && nifaces > 0) {
+ for (i = 0; i < nifaces; i++)
+ virDomainInterfaceFree(ifaces[i]);
+ }
+ g_free(ifaces);
virDomainObjEndAPI(&vm);
return ret;
diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c
index a447c93494..e0b22c042a 100644
--- a/tests/qemuagenttest.c
+++ b/tests/qemuagenttest.c
@@ -920,7 +920,7 @@ testQemuAgentGetInterfaces(const void *data)
goto cleanup;
if ((ifaces_count = qemuAgentGetInterfaces(qemuMonitorTestGetAgent(test),
- &ifaces)) < 0)
+ &ifaces, true)) < 0)
goto cleanup;
if (ifaces_count != 4) {
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index e5bd1fdd75..ea3ba58616 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -13854,6 +13854,8 @@ cmdGuestInfo(vshControl *ctl, const vshCmd *cmd)
types |= VIR_DOMAIN_GUEST_INFO_FILESYSTEM;
if (vshCommandOptBool(cmd, "disk"))
types |= VIR_DOMAIN_GUEST_INFO_DISKS;
+ if (vshCommandOptBool(cmd, "interface"))
+ types |= VIR_DOMAIN_GUEST_INFO_INTERFACES;
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
return false;
--
2.31.1
3 years, 2 months
[PATCHv4 0/9] ch: Add Console support
by William Douglas
This series enables console support in the cloud-hypervisor driver.
Cloud-hypervisor only supports a single console or serial device at a
time, hence the checks to ensure the domain configuration is only
passing one or the other.
Changes since v3:
* Reset ch monitor's curl handle after a get info request
* Improved PTY validation logic
* Updated deviceValidateCallback to handle PTY validation
* Added error reporting for unexpected PTY json data
* Dropped the parallels scanning for PTY
* Added a fix for handling deviceValidateCallback failures
Changes since v2:
* Squashed an additional patch.
Changes since v1:
* Added missing patch to add the virChrdev device
* Added handling for multiple curl WRITEFUNCTION call backs
* Added missing free for data.content
* Removed redundant console configuration check
* Improved handling of pty JSON data to make use of g_autoptr
* Squashed two patches
William Douglas (9):
ch_domain: Add virChrdevs for console support
ch_monitor: Make unused function static
ch_monitor: Update virCHMonitorGet to handle accept a response
ch_monitor: Use virCHMonitorGet to access cloud-hypervisor API
ch_monitor: Add pty json builder function
ch_process: Handle enabled console devices
ch_domain: Allow controller and chr devices
ch_driver: Add handler for console API
ch_driver: Handle validation failure correctly
src/ch/ch_domain.c | 40 +++++++++++++++++++-
src/ch/ch_domain.h | 3 ++
src/ch/ch_driver.c | 76 ++++++++++++++++++++++++++++++++++++-
src/ch/ch_monitor.c | 91 +++++++++++++++++++++++++++++++++++++++++++--
src/ch/ch_monitor.h | 3 ++
src/ch/ch_process.c | 84 +++++++++++++++++++++++++++++++++++++++++
6 files changed, 290 insertions(+), 7 deletions(-)
--
2.31.1
3 years, 2 months
[PATCH 00/24] virstoragetest: Re-instate testing of images without backing format
by Peter Krempa
Most of the series are refactors to make virstoragetest less archaic,
the last commit then re-introduces testing of images which don't have
backing format recorded in the metadata which can't be formatted using
qemu-img any more but have security implications if we'd mishandle them.
Peter Krempa (24):
virstoragetest: Drop testing of RBD backends via parsing real images
virstoragetest: Drop testing of NBD backends via parsing real images
testutils: Introduce helper for stripping bulilddir/srcdir from test
outputs
virstoragetest: Store output of TEST_CHAIN in output files
virstoragetest: Remove redundant arguments for chain lookup tests
virstoragetest: Rework TEST_LOOKUP* cases to work on fake backing
chain
virstoragetest: Test backing chain loops with hardcoded images
virstoragetest: Use existing directory in the source tree for
'directory' probing tests
virstoragetest: Use a pre-formatted QED file for testing backing store
extraction
virstoragetest: Use pre-formatted file for non-path extraction test
virstoragetest: Use preformatted file for testing missing backing
store
virstoragetest: Use existing file for testing 'raw' image lookup
virstoragetest: Convert symlink and relative image testing use
preformatted images
virstoragetest: Use preformatted qcow2 image for testing relative
paths
virstoragetest: Unify testing of QCOW2 images with absolute backing
virstoragetest: Stop rewriting images in 'mymain'
virstoragetest: Don't rewrite the 'qcow2' image
virstoragetest: Assume that 'qemu-img' supports '-o compat='
virstoragetest: testPrepImages: Don't reuse 'cmd' pointer
virstoragetest: testPrepImages: Use 'qemu-img' to format 'raw' image
virstoragetest: testStorageChain: Skip test if filename is NULL
virstoragetest: Don't skip the whole test when qemu-img fails to
format images
virstoragetest: Remove pointless goto from mymain
virstoragetest: Reinstate testing of images without 'backing_fmt'
build-aux/syntax-check.mk | 2 +-
tests/testutils.c | 30 +
tests/testutils.h | 3 +
tests/virstoragetest.c | 906 ++++++------------
tests/virstoragetestdata/images/loop-1.qcow2 | Bin 0 -> 196616 bytes
tests/virstoragetestdata/images/loop-2.qcow2 | Bin 0 -> 196616 bytes
.../virstoragetestdata/images/loop-self.qcow2 | Bin 0 -> 196616 bytes
tests/virstoragetestdata/images/qcow2 | Bin 0 -> 196616 bytes
.../images/qcow2_nbd-raw.qcow2 | Bin 0 -> 196616 bytes
.../images/qcow2_qcow2-auto.qcow2 | Bin 0 -> 196616 bytes
.../images/qcow2_qcow2-auto_qcow2-auto.qcow2 | Bin 0 -> 196616 bytes
.../images/qcow2_qcow2-missing.qcow2 | Bin 0 -> 196616 bytes
...2_qcow2-qcow2-symlink_raw-raw-reldir.qcow2 | Bin 0 -> 196616 bytes
.../images/qcow2_qcow2-qcow2_qcow2-auto.qcow2 | Bin 0 -> 196616 bytes
.../images/qcow2_qcow2-qcow2_raw-auto.qcow2 | Bin 0 -> 196616 bytes
.../images/qcow2_raw-auto.qcow2 | Bin 0 -> 196616 bytes
.../images/qcow2_raw-raw-relative.qcow2 | Bin 0 -> 196616 bytes
.../images/qcow2_raw-raw-reldir.qcow2 | Bin 0 -> 196616 bytes
.../images/qed_raw-raw-relative | Bin 0 -> 327680 bytes
tests/virstoragetestdata/images/raw | Bin 0 -> 1024 bytes
tests/virstoragetestdata/images/sub/link1 | 1 +
tests/virstoragetestdata/images/sub/link2 | 1 +
tests/virstoragetestdata/lookup/qcow2 | 0
tests/virstoragetestdata/lookup/raw | 0
tests/virstoragetestdata/lookup/sub/link2 | 1 +
tests/virstoragetestdata/lookup/wrap | 0
tests/virstoragetestdata/out/directory-dir | 9 +
tests/virstoragetestdata/out/directory-none | 9 +
tests/virstoragetestdata/out/directory-raw | 9 +
.../out/qcow2-auto_qcow2-qcow2_raw-raw | 9 +
.../out/qcow2-auto_raw-raw-relative | 9 +
.../out/qcow2-qcow2_nbd-raw | 19 +
.../out/qcow2-qcow2_qcow2-auto | 19 +
.../out/qcow2-qcow2_qcow2-qcow2_qcow2-auto | 29 +
.../out/qcow2-qcow2_qcow2-qcow2_raw-auto | 29 +
.../out/qcow2-qcow2_qcow2-qcow2_raw-raw | 29 +
.../out/qcow2-qcow2_raw-raw-relative | 19 +
tests/virstoragetestdata/out/qcow2-symlinks | 29 +
tests/virstoragetestdata/out/qed-auto_raw | 9 +
tests/virstoragetestdata/out/qed-qed_raw | 19 +
tests/virstoragetestdata/out/raw-auto | 9 +
tests/virstoragetestdata/out/raw-raw | 9 +
42 files changed, 580 insertions(+), 628 deletions(-)
create mode 100644 tests/virstoragetestdata/images/loop-1.qcow2
create mode 100644 tests/virstoragetestdata/images/loop-2.qcow2
create mode 100644 tests/virstoragetestdata/images/loop-self.qcow2
create mode 100644 tests/virstoragetestdata/images/qcow2
create mode 100644 tests/virstoragetestdata/images/qcow2_nbd-raw.qcow2
create mode 100644 tests/virstoragetestdata/images/qcow2_qcow2-auto.qcow2
create mode 100644 tests/virstoragetestdata/images/qcow2_qcow2-auto_qcow2-auto.qcow2
create mode 100644 tests/virstoragetestdata/images/qcow2_qcow2-missing.qcow2
create mode 100644 tests/virstoragetestdata/images/qcow2_qcow2-qcow2-symlink_raw-raw-reldir.qcow2
create mode 100644 tests/virstoragetestdata/images/qcow2_qcow2-qcow2_qcow2-auto.qcow2
create mode 100644 tests/virstoragetestdata/images/qcow2_qcow2-qcow2_raw-auto.qcow2
create mode 100644 tests/virstoragetestdata/images/qcow2_raw-auto.qcow2
create mode 100644 tests/virstoragetestdata/images/qcow2_raw-raw-relative.qcow2
create mode 100644 tests/virstoragetestdata/images/qcow2_raw-raw-reldir.qcow2
create mode 100644 tests/virstoragetestdata/images/qed_raw-raw-relative
create mode 100644 tests/virstoragetestdata/images/raw
create mode 120000 tests/virstoragetestdata/images/sub/link1
create mode 120000 tests/virstoragetestdata/images/sub/link2
create mode 100644 tests/virstoragetestdata/lookup/qcow2
create mode 100644 tests/virstoragetestdata/lookup/raw
create mode 120000 tests/virstoragetestdata/lookup/sub/link2
create mode 100644 tests/virstoragetestdata/lookup/wrap
create mode 100644 tests/virstoragetestdata/out/directory-dir
create mode 100644 tests/virstoragetestdata/out/directory-none
create mode 100644 tests/virstoragetestdata/out/directory-raw
create mode 100644 tests/virstoragetestdata/out/qcow2-auto_qcow2-qcow2_raw-raw
create mode 100644 tests/virstoragetestdata/out/qcow2-auto_raw-raw-relative
create mode 100644 tests/virstoragetestdata/out/qcow2-qcow2_nbd-raw
create mode 100644 tests/virstoragetestdata/out/qcow2-qcow2_qcow2-auto
create mode 100644 tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_qcow2-auto
create mode 100644 tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-auto
create mode 100644 tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-raw
create mode 100644 tests/virstoragetestdata/out/qcow2-qcow2_raw-raw-relative
create mode 100644 tests/virstoragetestdata/out/qcow2-symlinks
create mode 100644 tests/virstoragetestdata/out/qed-auto_raw
create mode 100644 tests/virstoragetestdata/out/qed-qed_raw
create mode 100644 tests/virstoragetestdata/out/raw-auto
create mode 100644 tests/virstoragetestdata/out/raw-raw
--
2.31.1
3 years, 2 months
[PATCH] qemu: remove unnecessary strlen for LINE_ENDING
by renlei1998@163.com
From: Ren Lei <ren.lei4(a)zte.com.cn>
the length of LINE_ENDING is static, it's a waste to call
strlen every time.
Signed-off-by: Ren Lei <ren.lei4(a)zte.com.cn>
---
src/qemu/qemu_agent.c | 5 +++--
src/qemu/qemu_monitor_json.c | 3 ++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 5f421be6f6..3a453b4c58 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -47,6 +47,7 @@
VIR_LOG_INIT("qemu.qemu_agent");
#define LINE_ENDING "\n"
+#define LINE_ENDING_LENGTH 1
#define DEBUG_IO 0
#define DEBUG_RAW_IO 0
@@ -341,11 +342,11 @@ static int qemuAgentIOProcessData(qemuAgent *agent,
if (nl) {
int got = nl - (data + used);
- for (i = 0; i < strlen(LINE_ENDING); i++)
+ for (i = 0; i < LINE_ENDING_LENGTH; i++)
data[used + got + i] = '\0';
if (qemuAgentIOProcessLine(agent, data + used, msg) < 0)
return -1;
- used += got + strlen(LINE_ENDING);
+ used += got + LINE_ENDING_LENGTH;
} else {
break;
}
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 8d3c4031a6..8b77b3cdaa 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -51,6 +51,7 @@ VIR_LOG_INIT("qemu.qemu_monitor_json");
#define QOM_CPU_PATH "/machine/unattached/device[0]"
#define LINE_ENDING "\r\n"
+#define LINE_ENDING_LENGTH 2
VIR_ENUM_IMPL(qemuMonitorJob,
QEMU_MONITOR_JOB_TYPE_LAST,
@@ -271,7 +272,7 @@ int qemuMonitorJSONIOProcess(qemuMonitor *mon,
int got = nl - (data + used);
char *line;
line = g_strndup(data + used, got);
- used += got + strlen(LINE_ENDING);
+ used += got + LINE_ENDING_LENGTH;
line[got] = '\0'; /* kill \n */
if (qemuMonitorJSONIOProcessLine(mon, line, msg) < 0) {
VIR_FREE(line);
--
2.27.0
3 years, 2 months
[PATCH 0/6] qemu: Fix crash when validating a XML without disk's <target>
by Peter Krempa
Apart from fixing the crash the validation code is fixed to do the
correct thing and a test case is added.
Peter Krempa (6):
qemuDomainDefValidateDiskLunSource: Unbreak error messages
conf: validate: Move qemu-specific LUN disk validation to global
validation
conf: validate: Run global device definition validation before
callbacks
conf: Don't call 'virDomainDiskDefAssignAddress' when disk->dst is
NULL
virDomainDiskDefValidate: Move validation of disk target
qemuxml2argvtest: Add test case for missing disk '<target>'
src/conf/domain_conf.c | 1 +
src/conf/domain_validate.c | 94 ++++++++++++++-----
src/conf/domain_validate.h | 2 +
src/libvirt_private.syms | 1 +
src/qemu/qemu_domain.c | 50 ----------
src/qemu/qemu_domain.h | 3 -
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_validate.c | 3 -
.../default-video-type-x86_64-caps-test-0.err | 2 +-
.../disk-fdc-incompatible-address.err | 2 +-
.../disk-ide-incompatible-address.err | 2 +-
.../disk-missing-target-invalid.err | 1 +
.../disk-missing-target-invalid.xml | 22 +++++
.../disk-sata-incompatible-address.err | 2 +-
.../disk-scsi-incompatible-address.err | 2 +-
.../pseries-default-phb-numa-node.err | 2 +-
.../pseries-phb-invalid-target-index-1.err | 2 +-
.../pseries-phb-invalid-target-index-2.err | 2 +-
.../pseries-phb-invalid-target-index-3.err | 2 +-
.../video-invalid-multiple-devices.err | 2 +-
...splay-device-pci-address.x86_64-latest.err | 2 +-
tests/qemuxml2argvtest.c | 1 +
22 files changed, 109 insertions(+), 93 deletions(-)
create mode 100644 tests/qemuxml2argvdata/disk-missing-target-invalid.err
create mode 100644 tests/qemuxml2argvdata/disk-missing-target-invalid.xml
--
2.31.1
3 years, 2 months