[libvirt] [PATCH] qemu_driver: pass path of compress prog directly
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)gmail.com>
We check compress prog in qemuCompressProgramAvailable,
then check it again in virExec.
This path will pass compress prog's path directly.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
src/qemu/qemu_driver.c | 42 ++++++++++++++++++++++++++----------------
1 file changed, 26 insertions(+), 16 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 97e2ffc..9f4e593 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3037,6 +3037,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
const char *path,
const char *domXML,
int compressed,
+ const char *compressed_path,
bool was_running,
unsigned int flags,
qemuDomainAsyncJob asyncJob)
@@ -3084,7 +3085,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
goto cleanup;
/* Perform the migration */
- if (qemuMigrationToFile(driver, vm, fd, qemuCompressProgramName(compressed),
+ if (qemuMigrationToFile(driver, vm, fd, compressed_path,
asyncJob) < 0)
goto cleanup;
@@ -3137,7 +3138,8 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
static int
qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
virDomainObjPtr vm, const char *path,
- int compressed, const char *xmlin, unsigned int flags)
+ int compressed, const char *compressed_path,
+ const char *xmlin, unsigned int flags)
{
char *xml = NULL;
bool was_running = false;
@@ -3209,7 +3211,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
goto endjob;
}
- ret = qemuDomainSaveMemory(driver, vm, path, xml, compressed,
+ ret = qemuDomainSaveMemory(driver, vm, path, xml, compressed, compressed_path,
was_running, flags, QEMU_ASYNC_JOB_SAVE);
if (ret < 0)
goto endjob;
@@ -3250,17 +3252,16 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
/* Returns true if a compression program is available in PATH */
static bool
-qemuCompressProgramAvailable(virQEMUSaveFormat compress)
+qemuCompressProgramAvailable(virQEMUSaveFormat compress, char **compressed_path)
{
- char *path;
-
- if (compress == QEMU_SAVE_FORMAT_RAW)
+ if (compress == QEMU_SAVE_FORMAT_RAW) {
+ *compressed_path = NULL;
return true;
+ }
- if (!(path = virFindFileInPath(qemuSaveCompressionTypeToString(compress))))
+ if (!(*compressed_path = virFindFileInPath(qemuSaveCompressionTypeToString(compress))))
return false;
- VIR_FREE(path);
return true;
}
@@ -3270,6 +3271,7 @@ qemuDomainSaveFlags(virDomainPtr dom, const char *path, const char *dxml,
{
virQEMUDriverPtr driver = dom->conn->privateData;
int compressed = QEMU_SAVE_FORMAT_RAW;
+ char *compressed_path = NULL;
int ret = -1;
virDomainObjPtr vm = NULL;
virQEMUDriverConfigPtr cfg = NULL;
@@ -3287,7 +3289,7 @@ qemuDomainSaveFlags(virDomainPtr dom, const char *path, const char *dxml,
"in configuration file"));
goto cleanup;
}
- if (!qemuCompressProgramAvailable(compressed)) {
+ if (!qemuCompressProgramAvailable(compressed, &compressed_path)) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Compression program for image format "
"in configuration file isn't available"));
@@ -3308,11 +3310,12 @@ qemuDomainSaveFlags(virDomainPtr dom, const char *path, const char *dxml,
}
ret = qemuDomainSaveInternal(driver, dom, vm, path, compressed,
- dxml, flags);
+ compressed_path, dxml, flags);
cleanup:
virDomainObjEndAPI(&vm);
virObjectUnref(cfg);
+ VIR_FREE(compressed_path);
return ret;
}
@@ -3343,6 +3346,7 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int flags)
virQEMUDriverPtr driver = dom->conn->privateData;
virQEMUDriverConfigPtr cfg = NULL;
int compressed = QEMU_SAVE_FORMAT_RAW;
+ char *compressed_path = NULL;
virDomainObjPtr vm;
char *name = NULL;
int ret = -1;
@@ -3377,7 +3381,7 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int flags)
"in configuration file"));
goto cleanup;
}
- if (!qemuCompressProgramAvailable(compressed)) {
+ if (!qemuCompressProgramAvailable(compressed, &compressed_path)) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Compression program for image format "
"in configuration file isn't available"));
@@ -3391,13 +3395,14 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int flags)
VIR_INFO("Saving state of domain '%s' to '%s'", vm->def->name, name);
ret = qemuDomainSaveInternal(driver, dom, vm, name,
- compressed, NULL, flags);
+ compressed, compressed_path, NULL, flags);
if (ret == 0)
vm->hasManagedSave = true;
cleanup:
virDomainObjEndAPI(&vm);
VIR_FREE(name);
+ VIR_FREE(compressed_path);
virObjectUnref(cfg);
return ret;
@@ -3617,6 +3622,7 @@ static virQEMUSaveFormat
getCompressionType(virQEMUDriverPtr driver)
{
int ret = QEMU_SAVE_FORMAT_RAW;
+ char *compressed_path = NULL;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
/*
@@ -3634,7 +3640,7 @@ getCompressionType(virQEMUDriverPtr driver)
ret = QEMU_SAVE_FORMAT_RAW;
goto cleanup;
}
- if (!qemuCompressProgramAvailable(ret)) {
+ if (!qemuCompressProgramAvailable(ret, &compressed_path)) {
VIR_WARN("%s", _("Compression program for dump image format "
"in configuration file isn't available, "
"using raw"));
@@ -3644,6 +3650,7 @@ getCompressionType(virQEMUDriverPtr driver)
}
cleanup:
virObjectUnref(cfg);
+ VIR_FREE(compressed_path);
return ret;
}
@@ -14308,6 +14315,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
bool pmsuspended = false;
virQEMUDriverConfigPtr cfg = NULL;
int compressed = QEMU_SAVE_FORMAT_RAW;
+ char *compressed_path = NULL;
/* If quiesce was requested, then issue a freeze command, and a
* counterpart thaw command when it is actually sent to agent.
@@ -14377,7 +14385,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
goto cleanup;
}
- if (!qemuCompressProgramAvailable(compressed)) {
+ if (!qemuCompressProgramAvailable(compressed, &compressed_path)) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Compression program for image format "
"in configuration file isn't available"));
@@ -14389,7 +14397,8 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
goto cleanup;
if ((ret = qemuDomainSaveMemory(driver, vm, snap->def->file,
- xml, compressed, resume, 0,
+ xml, compressed, compressed_path,
+ resume, 0,
QEMU_ASYNC_JOB_SNAPSHOT)) < 0)
goto cleanup;
@@ -14459,6 +14468,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
}
VIR_FREE(xml);
+ VIR_FREE(compressed_path);
virObjectUnref(cfg);
if (memory_unlink && ret < 0)
unlink(snap->def->file);
--
1.8.3.1
8 years, 3 months
[libvirt] [PATCH 0/2] Introduce basic virt-admin-self-test
by Michal Privoznik
I've realized we do no testing of virt-admin yet while reviewing Erik's
patches.
Michal Privoznik (2):
virsh: Move cmdSelfTest to vsh
tests: Self test virt-admin
.gitignore | 1 +
tests/Makefile.am | 1 +
tests/virsh-self-test | 21 ++++++++++++++++-----
tests/virt-admin-self-test | 1 +
tools/virsh.c | 45 +--------------------------------------------
tools/virt-admin.c | 1 +
tools/vsh.c | 38 ++++++++++++++++++++++++++++++++++++++
tools/vsh.h | 11 +++++++++++
8 files changed, 70 insertions(+), 49 deletions(-)
create mode 120000 tests/virt-admin-self-test
--
2.8.4
8 years, 3 months
[libvirt] [libvirt-perl PATCH 0/2] Updates to support recent upstream changes
by John Ferlan
Couple of patches to allow build/test to work with upstream top
John Ferlan (2):
Add support for VIR_SECRET_USAGE_TYPE_TLS
Add support for ERR_AGENT_UNSYNCED
Changes | 2 ++
Virt.xs | 2 ++
lib/Sys/Virt/Error.pm | 4 ++++
lib/Sys/Virt/Secret.pm | 7 +++++++
4 files changed, 15 insertions(+)
--
2.7.4
8 years, 3 months
[libvirt] [PATCH 0/2] Report block jobs more wisely
by Michal Privoznik
There's been a discussion recently (even here on the list [1])
that Nova is sometimes unable to fetch block job stats properly.
Basically, we may report job.cur == job.end == 0 in some cases
tricking Nova into thinking job is done when in fact it hasn't
even started yet.
Michal Privoznik (2):
qemuDomainGetBlockJobInfo: Move info translation into separate func
virDomainGetBlockJobInfo: Fix corner case when qemu reports no info
src/libvirt-domain.c | 7 ++++++
src/qemu/qemu_driver.c | 58 ++++++++++++++++++++++++++++++++++++--------------
2 files changed, 49 insertions(+), 16 deletions(-)
--
2.8.4
8 years, 3 months
[libvirt] [PATCH 0/4] Fix incorrect vcpu data refresh on daemon restart after vcpu hotplug
by Peter Krempa
See patches 3 and 4 for explanation.
Peter Krempa (4):
qemu: monitor: Use a more obvious iterator name
qemu: monitor: qemuMonitorGetCPUInfoHotplug: Add iterator 'anycpu'
qemu: monitor: Add vcpu state information to monitor data
qemu: domain: Don't infer vcpu state
src/qemu/qemu_domain.c | 14 +++---
src/qemu/qemu_monitor.c | 51 ++++++++++++++--------
src/qemu/qemu_monitor.h | 4 ++
.../qemumonitorjson-cpuinfo-ppc64-basic.data | 48 ++++++++++++++++++++
.../qemumonitorjson-cpuinfo-ppc64-hotplug-1.data | 48 ++++++++++++++++++++
.../qemumonitorjson-cpuinfo-ppc64-hotplug-2.data | 48 ++++++++++++++++++++
.../qemumonitorjson-cpuinfo-ppc64-hotplug-4.data | 48 ++++++++++++++++++++
.../qemumonitorjson-cpuinfo-ppc64-no-threads.data | 32 ++++++++++++++
...emumonitorjson-cpuinfo-x86-basic-pluggable.data | 16 +++++++
.../qemumonitorjson-cpuinfo-x86-full.data | 22 ++++++++++
tests/qemumonitorjsontest.c | 3 ++
11 files changed, 306 insertions(+), 28 deletions(-)
--
2.10.0
8 years, 3 months
[libvirt] [PATCH v2 0/3] Introduce aliases for virt-admin's srv-* commands
by Erik Skultety
the original version:
https://www.redhat.com/archives/libvir-list/2016-September/msg00312.html
since v1:
- tweaked the virsh-self-test so that it also checks the aliased commands
instead of skipping them (since there was a good reason for that before the
changes this series introduces)
- patches 2-3 remained untouched
Erik Skultety (3):
virt-admin: Tweak command parsing logic so that aliases point to new
commands
virt-admin: Add some command aliases to provide syntax sugar over ugly
commands
virt-admin: Replace the (now) aliases with new command names in the
man page
tools/virsh-nodedev.c | 6 ++----
tools/virsh.c | 10 ++++++----
tools/virsh.pod | 2 --
tools/virt-admin.c | 24 ++++++++++++++++++++++++
tools/virt-admin.pod | 30 +++++++++++++++---------------
tools/vsh.c | 6 ++++++
tools/vsh.h | 1 +
7 files changed, 54 insertions(+), 25 deletions(-)
--
2.5.5
8 years, 3 months
[libvirt] [PATCH 0/2] Fix vcpu hotplug with memoryless NUMA nodes
by Peter Krempa
See patch 2.
Peter Krempa (2):
util: numa: Remove impossible error handling
numa: Rename virNumaGetHostNodeset and make it return only nodes with
memory
src/libvirt_private.syms | 2 +-
src/qemu/qemu_cgroup.c | 4 ++--
src/util/virnuma.c | 18 +++++++++++-------
src/util/virnuma.h | 2 +-
4 files changed, 15 insertions(+), 11 deletions(-)
--
2.10.0
8 years, 3 months
Re: [libvirt] AC_HEADER_MAJOR vs. glibc 2.25(-to-be)
by Eric Blake
[adding libvirt list, as this is what sparked my investigations so far
today]
On 09/13/2016 04:36 PM, Eric Blake wrote:
> One other possibility that distros can do is to prime a config.site
> file, with $ac_cv_header_sys_types_h_makedev=no, to forcefully bypass
> the configure check that is normally done where <sys/types.h> would
> warn. It has to be in config.site, because non-glibc systems do not
> want to do that.
Okay, I have confirmed that this prime-the-cache idea DOES work, using
libvirt.git commit 419bc8cf (one commit prior to d53fa838 which
installed a hack into libvirt to force the use of -Werror for the
duration of AC_HEADER_MAJOR [1]). By itself, './configure' succeeds but
leaves MAJOR_IN_SYSMACROS undefined, which results in a build failure
later in libvirt; but when run as './configure
ac_cv_header_sys_types_h_makedev=no', MAJOR_IN_SYSMACROS gets defined
and the build succeeds.
I want to remove the libvirt hack (not all compilers understand -Werror,
even if libvirt is only ever built by gcc or clang), and my experiment
was enough to prove that:
1. distros that provide a config.site file can use this file to avoid
the problem, even for packages that have not yet rebuilt with a
new-enough autoconf to fix the issue
2. autoconf and gnulib should indeed be fixed to probe for
<sys/sysmacros.h> _prior_ to probing for whether makedev() exists in
<sys/type.h>, rather than the 2.69 logic of only checking for
<sys/sysmacros.h> if makedev() was not found earlier.
Of course, the libvirt hack should not be reverted until autoconf and
gnulib have the final solution in place.
>
> Meanwhile, even without an autoconf release scheduled, I am currently
> working on patching the existing autoconf macro and documentation to
> match the current situation. It sounds to me like we want the following
> logic:
>
> If <sys/sysmacros.h> exists and defines major(), use that,
> else if <sys/mkdev.h> exists, use that,
> else if <sys/types.h> defines major(), use that,
> else not available
The current autoconf code assumes that if <sys/sysmacros.h> exists, then
it defines major()/minor()/makedev(); I think that assumption is still
safe. Where autoconf was wrong was that it was not even probing for the
existence of <sys/sysmacros.h> if it found that <sys/types.h> was enough
to pollute the namespace with the three macros.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
8 years, 3 months
[libvirt] [PATCH] storage_backend_rbd: continue searching when failing in rbd_diff_iterate
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)gmail.com>
We try to find a snapshot that had no different between
the current state of RBD image.
If we failed in rbd_diff_iterate, just continue for the
next search iteration.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
src/storage/storage_backend_rbd.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index 4dd4b24..2756c83 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -831,9 +831,10 @@ virStorageBackendRBDSnapshotFindNoDiff(rbd_image_t image,
#endif
if (r < 0) {
- virReportSystemError(-r, _("failed to iterate RBD snapshot %s@%s"),
- imgname, snaps[i].name);
- goto cleanup;
+ VIR_DEBUG("failed to iterate RBD snapshot %s@%s,"
+ " rbd_diff return %d",
+ imgname, snaps[i].name, r);
+ continue;
}
/* If diff is still set to zero we found a snapshot without deltas */
--
1.8.3.1
8 years, 3 months
[libvirt] [PATCH 0/4] Introduce aliases for virt-admin's srv-* commands
by Erik Skultety
So, as suggested by Martin in [1], this series tweaks the command alias
handling logic, so that when creating alias, it is not necessary to duplicate
the original command's structure, thus creating a bit more noise. Instead,
the new format for an alias structure hints very clearly that it's just an
alias for a different command, while linking the alias with the original
command's data by using new element '.alias'.
[1] https://www.redhat.com/archives/libvir-list/2016-September/msg00129.html
Erik Skultety (4):
tests: fix incorrect status handling by virsh-self-test
virt-admin: Tweak command parsing logic so that aliases point to new
commands
virt-admin: Add some command aliases to provide syntax sugar over ugly
commands
virt-admin: Replace the (now) aliases with new command names in the
man page
tests/virsh-self-test | 2 +-
tools/virsh-nodedev.c | 6 ++----
tools/virsh.c | 3 ++-
tools/virt-admin.c | 24 ++++++++++++++++++++++++
tools/virt-admin.pod | 30 +++++++++++++++---------------
tools/vsh.c | 6 ++++++
tools/vsh.h | 1 +
7 files changed, 51 insertions(+), 21 deletions(-)
--
2.5.5
8 years, 3 months