[libvirt] [PATCH v1.2.[1-5]-maint] qemu: blockcopy: Don't remove existing disk mirror info
by Eric Blake
From: Peter Krempa <pkrempa(a)redhat.com>
When creating a new disk mirror the new struct is stored in a separate
variable until everything went well. The removed hunk would actually
remove existing mirror information for example when the api would be run
if a mirror still exists.
(cherry picked from commit 02b364e186d487f54ed410c01af042f23e812d42)
This fixes a regression introduced in commit ff5f30b.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
Conflicts:
src/qemu/qemu_driver.c - no refactoring of commit 7b7bf001
---
As Peter's patch resolves a regression, I'd like to backport it to
the maint branches; however, that means redoing the patch.
src/qemu/qemu_driver.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 59185c6..591864f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15203,6 +15203,7 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
struct stat st;
bool need_unlink = false;
char *mirror = NULL;
+ int mirrorFormat;
virQEMUDriverConfigPtr cfg = NULL;
/* Preliminaries: find the disk we are editing, sanity checks */
@@ -15290,10 +15291,10 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
goto endjob;
VIR_FORCE_CLOSE(fd);
if (!format)
- disk->mirrorFormat = disk->src.format;
+ mirrorFormat = disk->src.format;
} else if (format) {
- disk->mirrorFormat = virStorageFileFormatTypeFromString(format);
- if (disk->mirrorFormat <= 0) {
+ mirrorFormat = virStorageFileFormatTypeFromString(format);
+ if (mirrorFormat <= 0) {
virReportError(VIR_ERR_INVALID_ARG, _("unrecognized format '%s'"),
format);
goto endjob;
@@ -15303,11 +15304,11 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
* also passed the RAW flag (and format is non-NULL), or it is
* safe for us to probe the format from the file that we will
* be using. */
- disk->mirrorFormat = virStorageFileProbeFormat(dest, cfg->user,
- cfg->group);
+ mirrorFormat = virStorageFileProbeFormat(dest, cfg->user,
+ cfg->group);
}
- if (!format && disk->mirrorFormat > 0)
- format = virStorageFileFormatTypeToString(disk->mirrorFormat);
+ if (!format && mirrorFormat > 0)
+ format = virStorageFileFormatTypeToString(mirrorFormat);
if (VIR_STRDUP(mirror, dest) < 0)
goto endjob;
@@ -15333,13 +15334,12 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
/* Update vm in place to match changes. */
need_unlink = false;
disk->mirror = mirror;
+ disk->mirrorFormat = mirrorFormat;
mirror = NULL;
endjob:
if (need_unlink && unlink(dest))
VIR_WARN("unable to unlink just-created %s", dest);
- if (ret < 0 && disk)
- disk->mirrorFormat = VIR_STORAGE_FILE_NONE;
VIR_FREE(mirror);
if (!qemuDomainObjEndJob(driver, vm))
vm = NULL;
--
1.9.3
10 years, 9 months
[libvirt] [PATCH v2 for 1.2.6] build: link libvirt_conf with libxml
by Martin Kletzander
Since there is code using functions from the libxml library,
libvirt_conf should have that in LIBADD so it can be linked against
even without libvirt_util (which usually deals with the error itself,
since libvirt_util has libxml in LIBADD). The same applies to
storage_backend.c.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
This is a v2 of:
https://www.redhat.com/archives/libvir-list/2014-June/msg01322.html
If this gets ACKed for th 1.2.6 release, please push this as well
since I won't be available before DV makes the release, thank you.
---
src/Makefile.am | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 35720be..047d4c6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -991,6 +991,7 @@ libvirt_la_BUILT_LIBADD += libvirt_conf.la
libvirt_conf_la_SOURCES = $(CONF_SOURCES)
libvirt_conf_la_CFLAGS = $(AM_CFLAGS)
libvirt_conf_la_LDFLAGS = $(AM_LDFLAGS)
+libvirt_conf_la_LIBADD = $(LIBXML_LIBS)
noinst_LTLIBRARIES += libvirt_cpu.la
libvirt_la_BUILT_LIBADD += libvirt_cpu.la
@@ -1452,7 +1453,7 @@ libvirt_driver_storage_impl_la_CFLAGS = \
$(AM_CFLAGS)
libvirt_driver_storage_impl_la_LDFLAGS = $(AM_LDFLAGS)
libvirt_driver_storage_impl_la_LIBADD =
-libvirt_driver_storage_impl_la_LIBADD += $(SECDRIVER_LIBS)
+libvirt_driver_storage_impl_la_LIBADD += $(SECDRIVER_LIBS) $(LIBXML_LIBS)
if WITH_BLKID
libvirt_driver_storage_impl_la_CFLAGS += $(BLKID_CFLAGS)
libvirt_driver_storage_impl_la_LIBADD += $(BLKID_LIBS)
--
2.0.0
10 years, 9 months
[libvirt] [PATCH 0/4] Report less errors
by Ján Tomko
Some are distracting and not really helpful.
Ján Tomko (4):
Track privileged state in udev nodedev driver
Only detect PCI Express devices as root in udev nodedev driver
Introduce virFileReadAllQuiet
Report one error less when getting net dev speed
src/libvirt_private.syms | 1 +
src/node_device/node_device_udev.c | 10 ++++++++--
src/util/virfile.c | 15 +++++++++++++++
src/util/virfile.h | 2 ++
src/util/virnetdev.c | 7 ++++---
5 files changed, 30 insertions(+), 5 deletions(-)
--
1.8.5.5
10 years, 9 months
[libvirt] [PATCH for 1.2.6] vboxsnapshotxmltest: Don't write to a file in abs_srcdir
by Michal Privoznik
In the test, the snapshot XML is written into a file that's located
under:
abs_srcdir/vboxsnapshotxmldata/testResult.vbox
However, the abs_srcdir doesn't have to be necessarily writable. It
should have been abs_builddir instead. Moreover, the label in the func
creating the file is called 'fail' while it fulfils the duty of
'cleanup' label.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tests/vboxsnapshotxmltest.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/tests/vboxsnapshotxmltest.c b/tests/vboxsnapshotxmltest.c
index 7795688..85ef96a 100644
--- a/tests/vboxsnapshotxmltest.c
+++ b/tests/vboxsnapshotxmltest.c
@@ -59,42 +59,47 @@ testCompareXMLtoXMLFiles(const char *xml)
char *pathResult = NULL;
int ret = -1;
virVBoxSnapshotConfMachinePtr machine = NULL;
- if (virAsprintf(&pathResult, "%s/vboxsnapshotxmldata/testResult.vbox",
- abs_srcdir) < 0)
+
+ if (VIR_STRDUP(pathResult,
+ abs_builddir "/vboxsnapshotxmldata/testResult.vbox") < 0)
return -1;
+ if (virFileMakePath(abs_builddir "/vboxsnapshotxmldata") < 0)
+ goto cleanup;
+
if (virtTestLoadFile(xml, &xmlData) < 0)
- goto fail;
+ goto cleanup;
if (!(machine = virVBoxSnapshotConfLoadVboxFile(xml, (char*)"")))
- goto fail;
+ goto cleanup;
if (virVBoxSnapshotConfSaveVboxFile(machine, pathResult) < 0)
- goto fail;
+ goto cleanup;
if (virtTestLoadFile(pathResult, &actual) < 0)
- goto fail;
+ goto cleanup;
if (unlink(pathResult) < 0)
- goto fail;
+ goto cleanup;
if (!(actual = testFilterXML(actual)))
- goto fail;
+ goto cleanup;
if (!(xmlData = testFilterXML(xmlData)))
- goto fail;
+ goto cleanup;
if (STRNEQ(actual, xmlData)) {
virtTestDifference(stderr, xmlData, actual);
- goto fail;
+ goto cleanup;
}
ret = 0;
- fail:
+ cleanup:
VIR_FREE(xmlData);
VIR_FREE(actual);
virVBoxSnapshotConfMachineFree(machine);
VIR_FREE(pathResult);
+ rmdir(abs_builddir "/vboxsnapshotxmldata");
return ret;
}
--
1.8.5.5
10 years, 9 months
[libvirt] run domain in paused state
by Vasiliy Tolstov
Hi all. I need to construct domain, run it in paused state , attach
some devices and unpause it.
How can i do that in libvirt api (i'm use ruby).
As i see virsh have start --paused option, but how can i specify state
in domain xml?
--
Vasiliy Tolstov,
e-mail: v.tolstov(a)selfip.ru
jabber: vase(a)selfip.ru
10 years, 9 months
[libvirt] [PATCH for 1.2.6] securityselinuxlabeltest: Don't create dummy file in the srcdir
by Michal Privoznik
At the very beginning of the test we check if the underlying
filesystem supports extended attributes as they are used to store fake
SELinux labels. In order to check that, a dummy file is created and
semi-random attribute is set. However, the file is created under:
abs_srcdir "/securityselinuxlabeldata/testxattr"
which has two problems: abs_srcdir is not required to be writable, so
it should have been abs_builddir. The second one is - there's no
"securityselinuxlabeldata" folder under abs_builddir. The problem was
introduced in caf164f1.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tests/securityselinuxlabeltest.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabeltest.c
index 3699d89..455eb74 100644
--- a/tests/securityselinuxlabeltest.c
+++ b/tests/securityselinuxlabeltest.c
@@ -65,10 +65,11 @@ testUserXattrEnabled(void)
const char *con_value = "system_u:object_r:svirt_image_t:s0:c41,c264";
char *path = NULL;
if (virAsprintf(&path, "%s/securityselinuxlabeldata/testxattr",
- abs_srcdir) < 0)
+ abs_builddir) < 0)
goto cleanup;
- if (virFileTouch(path, 0600) < 0)
+ if (virFileMakePath(abs_builddir "/securityselinuxlabeldata") < 0 ||
+ virFileTouch(path, 0600) < 0)
goto cleanup;
len = setxattr(path, "user.libvirt.selinux", con_value,
@@ -83,6 +84,7 @@ testUserXattrEnabled(void)
cleanup:
unlink(path);
+ rmdir(abs_builddir "/securityselinuxlabeldata");
VIR_FREE(path);
return ret;
}
--
1.8.5.5
10 years, 9 months
[libvirt] Facing problems in running QEMU guest agents in Windows 2008 guest machine.
by Puneet Bakshi
Hi,
I have a CenOS host machine running KVM and a Windows 2008 guest machine. I
am able to run "qemu-monitor-command" but not "qemu-agent-command".
[root@sdsr720-14 Windows_ISO]# virsh qemu-monitor-command --hmp vm_win_05
'info network'
Devices not on any VLAN:
hostnet0: fd=23 peer=net0
net0: model=virtio-net-pci,macaddr=52:54:00:7f:4a:5b peer=hostnet0
[root@sdsr720-14 Windows_ISO]# virsh qemu-agent-command vm_win_05
'{"execute":"guest-ping"}'
[root@sdsr720-14 Windows_ISO]#
[QEMU guest installation]
To install QEMU guest agent, I followed steps mentioned at following URL
http://wiki.qemu.org/Features/QAPI/GuestAgent#Example_usage
[Problem-1]
"qemu-ga.exe -s install" runs silently, "net start qemu-ga" gave error.
Following is the snippet from Windows shell.
PS C:\puneet> .\qemu-ga.exe -s install
PS C:\puneet> net start qemu-ga
The service name is invalid.
More help is available by typing NET HELPMSG 2185.
PS C:\puneet>[root@sdsr720-14 Windows_ISO]#
[Problem-2]
When I double click the "qemu-ga.exe", it gives the following error.
"The application was unable to start correctly (0xc000007b). Click Ok to
close the application."
I tried some other possible ways also but could not get them working.
Regards,
~Puneet
10 years, 9 months
[libvirt] [PATCH] virsh: enable list inactive domain when using 'list --[no-]autostart
by Chen Hanxiao
This patch could let us know which domains are marked
as [no]autostart without starting them.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
tools/virsh-domain-monitor.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 8bd58ad..779b67b 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -1869,8 +1869,10 @@ cmdList(vshControl *ctl, const vshCmd *cmd)
FILTER("with-managed-save", VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE);
FILTER("without-managed-save", VIR_CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE);
- FILTER("autostart", VIR_CONNECT_LIST_DOMAINS_AUTOSTART);
- FILTER("no-autostart", VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART);
+ FILTER("autostart", VIR_CONNECT_LIST_DOMAINS_AUTOSTART |
+ VIR_CONNECT_LIST_DOMAINS_INACTIVE);
+ FILTER("no-autostart", VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART |
+ VIR_CONNECT_LIST_DOMAINS_INACTIVE);
FILTER("with-snapshot", VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT);
FILTER("without-snapshot", VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT);
--
1.9.0
10 years, 9 months
[libvirt] [PATCH] qemu: raise an error when trying to use readonly ide disks
by Giuseppe Scrivano
The IDE bus doesn't support readonly disks, so inform the user with an
error message instead of let qemu fail with a more obscure "Device
'ide-hd' could not be initialized" error message.
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1112939
Signed-off-by: Giuseppe Scrivano <gscrivan(a)redhat.com>
---
src/qemu/qemu_command.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 63f322a..4829176 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3385,8 +3385,15 @@ qemuBuildDriveStr(virConnectPtr conn,
disk->bus != VIR_DOMAIN_DISK_BUS_IDE)
virBufferAddLit(&opt, ",boot=on");
if (disk->readonly &&
- virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_READONLY))
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_READONLY)) {
+ if (disk->bus == VIR_DOMAIN_DISK_BUS_IDE &&
+ disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("readonly ide disks are not supported"));
+ goto error;
+ }
virBufferAddLit(&opt, ",readonly=on");
+ }
if (disk->transient) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("transient disks not supported yet"));
--
1.9.3
10 years, 9 months
[libvirt] [PATCHv4 00/29] (for 1.2.7) qemu: Refactor handling of disk image metadata
by Peter Krempa
This is meant for the 1.2.7 release as we are currently in freeze for 1.2.6.
This version incorporates feedback from Eric's review and adds a ton of new stuff.
Peter Krempa (29):
storage: Implement virStorageFileCreate for local and gluster files
qemu: Don't propagate whole disk definition into qemuDomainGetImageIds
qemu: Add helper to initialize storage file backend with correct
uid/gid
storage: file: Tolerate NULL src when uninitializing the backend
conf: Don't output seclabels for backingStore elements
storage: Move readonly and shared flags to disk source from disk def
util: storagefile: Add deep copy for struct virStorageSource
util: storage: Add helper to determine whether storage is local
util: storage: Add function to transfer config parts to new chain
element
util: storage: Copy parent's disk metadata to backing chain elements
util: cgroup: Add helper to convert device mode to string
qemu: cgroup: Add functions to set cgroup image stuff on individual
imgs
qemu: cgroup: Setup only the top level disk image for read-write
access
locking: Add APIs to lock individual image files
security: Introduce APIs to label single images
security: selinux: Implement per-image seclabel restore
security: selinux: Implement per-image seclabel set
security: DAC: Implement per-image seclabel restore
security: DAC: Implement per-image seclabel set
security: AppArmor: Implement per-image seclabel restore
security: AppArmor: Implement per-image seclabel set
util: storage: Make virStorageFileChainLookup more network storage
aware
util: storage: Return complete parent info from
virStorageFileChainLookup
qemu: blockcopy: Use the mirror disk source to label the files
qemu: block: Properly track disk source while pivotting to new image
qemu: snapshot: Improve approach to deal with snapshot metadata
qemu: Refactor qemuDomainPrepareDiskChainElement
qemu: snapshot: Refactor image labelling of new snapshot files
qemu: snapshot: Use storage driver to pre-create snapshot file
src/conf/domain_conf.c | 77 +++++---
src/conf/domain_conf.h | 2 -
src/libvirt_private.syms | 8 +
src/libxl/libxl_conf.c | 2 +-
src/locking/domain_lock.c | 65 ++++---
src/locking/domain_lock.h | 8 +
src/lxc/lxc_cgroup.c | 2 +-
src/lxc/lxc_controller.c | 2 +-
src/lxc/lxc_driver.c | 2 +-
src/qemu/qemu_cgroup.c | 109 ++++++-----
src/qemu/qemu_cgroup.h | 3 +
src/qemu/qemu_command.c | 14 +-
src/qemu/qemu_conf.c | 4 +-
src/qemu/qemu_domain.c | 29 ++-
src/qemu/qemu_domain.h | 4 +
src/qemu/qemu_driver.c | 349 +++++++++++-----------------------
src/qemu/qemu_migration.c | 16 +-
src/security/security_apparmor.c | 55 ++++--
src/security/security_dac.c | 111 +++++------
src/security/security_driver.h | 10 +
src/security/security_manager.c | 56 ++++++
src/security/security_manager.h | 7 +
src/security/security_nop.c | 19 ++
src/security/security_selinux.c | 150 +++++++++------
src/security/security_stack.c | 38 ++++
src/security/virt-aa-helper.c | 2 +-
src/storage/storage_backend_fs.c | 17 ++
src/storage/storage_backend_gluster.c | 28 +++
src/storage/storage_driver.c | 2 +-
src/util/vircgroup.c | 62 ++++--
src/util/vircgroup.h | 2 +
src/util/virstoragefile.c | 300 ++++++++++++++++++++++++++---
src/util/virstoragefile.h | 15 +-
src/vbox/vbox_tmpl.c | 30 +--
src/xenxs/xen_sxpr.c | 10 +-
src/xenxs/xen_xm.c | 10 +-
tests/virstoragetest.c | 86 ++++-----
37 files changed, 1097 insertions(+), 609 deletions(-)
--
1.9.3
10 years, 9 months