[libvirt] [PATCH] qemu: snapshot: split out preparation of a snapshot with blockdev
by Peter Krempa
Separate the blockdev code since it makes the original function lenghty.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_driver.c | 96 ++++++++++++++++++++++++------------------
1 file changed, 56 insertions(+), 40 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index abfb540d80..45363b0d6d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15228,6 +15228,58 @@ qemuDomainSnapshotDiskCleanup(qemuDomainSnapshotDiskDataPtr data,
}
+static int
+qemuDomainSnapshotDiskPrepareOneBlockdev(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ qemuDomainSnapshotDiskDataPtr dd,
+ virQEMUDriverConfigPtr cfg,
+ bool reuse,
+ virHashTablePtr blockNamedNodeData,
+ qemuDomainAsyncJob asyncJob)
+{
+ qemuDomainObjPrivatePtr priv = vm->privateData;
+ g_autoptr(virStorageSource) terminator = NULL;
+ int rc;
+
+ /* create a terminator for the snapshot disks so that qemu does not try
+ * to open them at first */
+ if (!(terminator = virStorageSourceNew()))
+ return -1;
+
+ if (qemuDomainPrepareStorageSourceBlockdev(dd->disk, dd->src,
+ priv, cfg) < 0)
+ return -1;
+
+ if (!(dd->crdata = qemuBuildStorageSourceChainAttachPrepareBlockdevTop(dd->src,
+ terminator,
+ priv->qemuCaps)))
+ return -1;
+
+ if (reuse) {
+ if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
+ return -1;
+
+ rc = qemuBlockStorageSourceAttachApply(qemuDomainGetMonitor(vm),
+ dd->crdata->srcdata[0]);
+
+ if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
+ return -1;
+ } else {
+ if (qemuBlockStorageSourceCreateDetectSize(blockNamedNodeData,
+ dd->src, dd->disk->src) < 0)
+ return -1;
+
+ if (qemuBlockStorageSourceCreate(vm, dd->src, dd->disk->src,
+ NULL, dd->crdata->srcdata[0],
+ asyncJob) < 0)
+ return -1;
+ }
+
+ dd->blockdevadded = true;
+ return 0;
+}
+
+
static int
qemuDomainSnapshotDiskPrepareOne(virQEMUDriverPtr driver,
virDomainObjPtr vm,
@@ -15240,12 +15292,9 @@ qemuDomainSnapshotDiskPrepareOne(virQEMUDriverPtr driver,
bool blockdev,
qemuDomainAsyncJob asyncJob)
{
- qemuDomainObjPrivatePtr priv = vm->privateData;
virDomainDiskDefPtr persistdisk;
- g_autoptr(virStorageSource) terminator = NULL;
bool supportsCreate;
bool supportsBacking;
- int rc;
dd->disk = disk;
@@ -15314,43 +15363,10 @@ qemuDomainSnapshotDiskPrepareOne(virQEMUDriverPtr driver,
dd->prepared = true;
- if (blockdev) {
- /* create a terminator for the snapshot disks so that qemu does not try
- * to open them at first */
- if (!(terminator = virStorageSourceNew()))
- return -1;
-
- if (qemuDomainPrepareStorageSourceBlockdev(dd->disk, dd->src,
- priv, cfg) < 0)
- return -1;
-
- if (!(dd->crdata = qemuBuildStorageSourceChainAttachPrepareBlockdevTop(dd->src,
- terminator,
- priv->qemuCaps)))
- return -1;
-
- if (reuse) {
- if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
- return -1;
-
- rc = qemuBlockStorageSourceAttachApply(qemuDomainGetMonitor(vm),
- dd->crdata->srcdata[0]);
-
- if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
- return -1;
- } else {
- if (qemuBlockStorageSourceCreateDetectSize(blockNamedNodeData,
- dd->src, dd->disk->src) < 0)
- return -1;
-
- if (qemuBlockStorageSourceCreate(vm, dd->src, dd->disk->src,
- NULL, dd->crdata->srcdata[0],
- asyncJob) < 0)
- return -1;
- }
-
- dd->blockdevadded = true;
- }
+ if (blockdev &&
+ qemuDomainSnapshotDiskPrepareOneBlockdev(driver, vm, dd, cfg, reuse,
+ blockNamedNodeData, asyncJob) < 0)
+ return -1;
return 0;
}
--
2.23.0
5 years, 1 month
[libvirt] [PATCH] qemu: command: Use XML based disk bus convertor in error message
by Peter Krempa
The qemu driver has an internal implementation for converting disk bus
to string for use with qemu. This should not be used in error messages
though as we want to report the string based on the XML value.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_command.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f37aecda37..3806cbbaf9 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1303,7 +1303,7 @@ qemuCheckDiskConfig(virDomainDiskDefPtr disk,
disk->bus != VIR_DOMAIN_DISK_BUS_SCSI) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("disk device='lun' is not supported for bus='%s'"),
- virDomainDiskQEMUBusTypeToString(disk->bus));
+ virDomainDiskBusTypeToString(disk->bus));
return -1;
}
--
2.23.0
5 years, 1 month
[libvirt] [PATCH] util: pci: Remove always-false condition
by Peter Krempa
Commit d19c21429fd modified the condition so that it checks whether the
value is more than 0xFFFFFFFF. Since addr->domain is an unsigned int, it
will never be more than that.
Remove the whole check
src/util/virpci.c:1291:22: error: result of comparison 'unsigned int' > 4294967295 is always false [-Werror,-Wtautological-type-limit-compare]
if (addr->domain > 0xFFFFFFFF) {
~~~~~~~~~~~~ ^ ~~~~~~~~~~
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
This was caught by new clang:
$ clang -v
clang version 9.0.0 (Fedora 9.0.0-1.fc31)
This "fix" is the naive approach which assumes the original patch was
correct.
src/util/virpci.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/src/util/virpci.c b/src/util/virpci.c
index f9e39e79d8..cd560d683b 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -1288,14 +1288,6 @@ bool
virPCIDeviceAddressIsValid(virPCIDeviceAddressPtr addr,
bool report)
{
- if (addr->domain > 0xFFFFFFFF) {
- if (report)
- virReportError(VIR_ERR_XML_ERROR,
- _("Invalid PCI address domain='0x%x', "
- "must be <= 0xFFFF"),
- addr->domain);
- return false;
- }
if (addr->bus > 0xFF) {
if (report)
virReportError(VIR_ERR_XML_ERROR,
--
2.23.0
5 years, 1 month
[libvirt] [PATCH 0/2] Couple of fixes for exported stuff
by Peter Krempa
Peter Krempa (2):
datatypes: Fix comment for the _virNetwork struct
syms: Add 'global:' keyword to LIBVIRT_5.8 section
src/datatypes.h | 2 +-
src/libvirt_public.syms | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
--
2.23.0
5 years, 1 month
[libvirt] [PATCH 0/8] Coverity related patches
by John Ferlan
Some related to "new-ish" changes that have caused Coverity to
discover new issues and some from older changes from a pile of
50 or so that are not essentially "false positives".
John Ferlan (8):
vbox: Fix possible NULL deref
conf: Remove ATTRIBUTE_NONNULL for virDomainQemuMonitorEventNew
tests: Fix memory leak in mymain
lxc: Remove unnecessary comment
tests: Remove _NULLABLE in virNetDevExists mock
qemu: Fix possible NULL deref in qemuDomainSaveImageStartVM
tests: Add return value check in checkUserInfo
tests: Fix logic to not have possible NULL deref
src/conf/domain_event.c | 6 +++++-
src/conf/domain_event.h | 2 +-
src/lxc/lxc_container.c | 5 -----
src/qemu/qemu_driver.c | 2 +-
src/vbox/vbox_common.c | 4 ++--
tests/qemuagenttest.c | 4 +++-
tests/qemuhotplugtest.c | 3 +--
tests/qemuxml2argvmock.c | 2 +-
tests/virbitmaptest.c | 6 ++++--
9 files changed, 18 insertions(+), 16 deletions(-)
--
2.20.1
5 years, 1 month
[libvirt] [PATCH] util: Fix segmentation fault when seclabel fails to allocate memory
by jcfaracco@gmail.com
From: Julio Faracco <jcfaracco(a)gmail.com>
In function virSecurityDeviceLabelDefNew(), when libvirt fails to
allocate seclabel structure it returns a failure. This case is setting
seclabel as a NULL pointer and accessing its attribute below. This
commit fixes this wrong logic.
Signed-off-by: Julio Faracco <jcfaracco(a)gmail.com>
---
src/util/virseclabel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virseclabel.c b/src/util/virseclabel.c
index a2b5ebf6b7..2141d84210 100644
--- a/src/util/virseclabel.c
+++ b/src/util/virseclabel.c
@@ -77,7 +77,7 @@ virSecurityDeviceLabelDefNew(const char *model)
if (VIR_ALLOC(seclabel) < 0) {
virSecurityDeviceLabelDefFree(seclabel);
- seclabel = NULL;
+ return NULL;
}
seclabel->model = g_strdup(model);
--
2.20.1
5 years, 1 month
[libvirt] [dockerfiles PATCH 0/3] Refresh after recent changes
by Andrea Bolognani
Pushed under the Dockerfiles refresh rules.
As usual, patches as sent to the list don't apply and are to be
considered informational only.
Andrea Bolognani (3):
Drop Fedora 29
Add Fedora 31
Refresh afted adding python3-docutils for libvirt
buildenv-libosinfo-fedora-29.zip | Bin 544 -> 0 bytes
buildenv-libosinfo-fedora-31.zip | Bin 0 -> 544 bytes
buildenv-libvirt-centos-7.zip | Bin 759 -> 765 bytes
buildenv-libvirt-debian-10-cross-aarch64.zip | Bin 1010 -> 1016 bytes
buildenv-libvirt-debian-10-cross-armv6l.zip | Bin 1003 -> 1009 bytes
buildenv-libvirt-debian-10-cross-armv7l.zip | Bin 1008 -> 1013 bytes
buildenv-libvirt-debian-10-cross-i686.zip | Bin 1001 -> 1008 bytes
buildenv-libvirt-debian-10-cross-mips.zip | Bin 997 -> 1003 bytes
buildenv-libvirt-debian-10-cross-mips64el.zip | Bin 1011 -> 1017 bytes
buildenv-libvirt-debian-10-cross-mipsel.zip | Bin 1001 -> 1007 bytes
buildenv-libvirt-debian-10-cross-ppc64le.zip | Bin 1012 -> 1019 bytes
buildenv-libvirt-debian-10-cross-s390x.zip | Bin 1000 -> 1006 bytes
buildenv-libvirt-debian-10.zip | Bin 898 -> 904 bytes
buildenv-libvirt-debian-9-cross-aarch64.zip | Bin 1042 -> 1048 bytes
buildenv-libvirt-debian-9-cross-armv6l.zip | Bin 1033 -> 1039 bytes
buildenv-libvirt-debian-9-cross-armv7l.zip | Bin 1039 -> 1045 bytes
buildenv-libvirt-debian-9-cross-mips.zip | Bin 1033 -> 1039 bytes
buildenv-libvirt-debian-9-cross-mips64el.zip | Bin 1041 -> 1051 bytes
buildenv-libvirt-debian-9-cross-mipsel.zip | Bin 1036 -> 1043 bytes
buildenv-libvirt-debian-9-cross-ppc64le.zip | Bin 1045 -> 1053 bytes
buildenv-libvirt-debian-9-cross-s390x.zip | Bin 1034 -> 1040 bytes
buildenv-libvirt-debian-9.zip | Bin 927 -> 934 bytes
buildenv-libvirt-debian-sid-cross-aarch64.zip | Bin 1010 -> 1015 bytes
buildenv-libvirt-debian-sid-cross-armv6l.zip | Bin 1003 -> 1009 bytes
buildenv-libvirt-debian-sid-cross-armv7l.zip | Bin 1008 -> 1013 bytes
buildenv-libvirt-debian-sid-cross-i686.zip | Bin 1001 -> 1008 bytes
buildenv-libvirt-debian-sid-cross-mips.zip | Bin 1000 -> 1006 bytes
...denv-libvirt-debian-sid-cross-mips64el.zip | Bin 1014 -> 1017 bytes
buildenv-libvirt-debian-sid-cross-mipsel.zip | Bin 1005 -> 1011 bytes
buildenv-libvirt-debian-sid-cross-ppc64le.zip | Bin 1012 -> 1018 bytes
buildenv-libvirt-debian-sid-cross-s390x.zip | Bin 1000 -> 1006 bytes
buildenv-libvirt-debian-sid.zip | Bin 898 -> 904 bytes
buildenv-libvirt-fedora-29.zip | Bin 768 -> 0 bytes
buildenv-libvirt-fedora-30.zip | Bin 891 -> 897 bytes
buildenv-libvirt-fedora-31.zip | Bin 0 -> 776 bytes
buildenv-libvirt-fedora-rawhide.zip | Bin 788 -> 796 bytes
buildenv-libvirt-ubuntu-16.zip | Bin 933 -> 939 bytes
buildenv-libvirt-ubuntu-18.zip | Bin 935 -> 941 bytes
38 files changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 buildenv-libosinfo-fedora-29.zip
create mode 100644 buildenv-libosinfo-fedora-31.zip
delete mode 100644 buildenv-libvirt-fedora-29.zip
create mode 100644 buildenv-libvirt-fedora-31.zip
--
2.21.0
5 years, 1 month
[libvirt] [PATCH] spec: fix rpm build with VPATH
by Pavel Hrdina
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
libvirt.spec.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 723ced3535..eb8b2df055 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1532,7 +1532,7 @@ exit 0
%files docs
%doc AUTHORS ChangeLog NEWS README README.md
-%doc libvirt-docs/*
+%doc %{_vpath_builddir}/libvirt-docs/*
%files daemon
@@ -1892,7 +1892,7 @@ exit 0
%config(noreplace) %{_sysconfdir}/sysconfig/libvirt-guests
%attr(0755, root, root) %{_libexecdir}/libvirt-guests.sh
-%files libs -f %{name}.lang
+%files libs -f %{_vpath_builddir}/%{name}.lang
%license COPYING COPYING.LESSER
%config(noreplace) %{_sysconfdir}/libvirt/libvirt.conf
%config(noreplace) %{_sysconfdir}/libvirt/libvirt-admin.conf
--
2.23.0
5 years, 1 month
[libvirt] [PATCH] src: lxc: Fix typo in a Makefile variable
by Michal Privoznik
In commit 0985a9597bb0348d46c0d18dc548a676bf0ad8e2 we stopped
distributing generated source file. This is done by prepending
binary_SOURCES variable with "nodist_". However, there is a typo
- the prefix is "nodst_" instead of "nodist_".
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed under trivial rule.
src/lxc/Makefile.inc.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lxc/Makefile.inc.am b/src/lxc/Makefile.inc.am
index d3a7cbf93b..6aaec09fb4 100644
--- a/src/lxc/Makefile.inc.am
+++ b/src/lxc/Makefile.inc.am
@@ -127,7 +127,7 @@ augeastest_DATA += lxc/test_virtlxcd.aug
CLEANFILES += lxc/virtlxcd.aug
virtlxcd_SOURCES = $(REMOTE_DAEMON_SOURCES)
-nodst_virtlxcd_SOURCES = $(REMOTE_DAEMON_GENERATED)
+nodist_virtlxcd_SOURCES = $(REMOTE_DAEMON_GENERATED)
virtlxcd_CFLAGS = \
$(REMOTE_DAEMON_CFLAGS) \
-DDAEMON_NAME="\"virtlxcd\"" \
--
2.23.0
5 years, 1 month
[libvirt] [PATCH 0/5] Update news for versions from 5.7 to 5.8
by Han Han
Han Han (5):
news: Support for kvm dedicated performance hint in 5.7
news: Support unmanaged macvtap devices in 5.8
news: Support to run SLIRP networking in a separate process in 5.8
news: Support vhost-user-gpu in 5.8
news: Introduce virConnectSetIdentity API in 5.8
docs/news.xml | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
--
2.24.0.rc1
5 years, 1 month