[libvirt] [libvirt-python PATCH] Fix cannot use VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS flags in domainListGetStats
by Luyao Huang
When set flags=libvirt.VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS, python will report
a error:
OverflowError: signed integer is greater than maximum
Because VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS = 2147483648 (2**31), and it set a
signed int in PyArg_ParseTuple function.
if (!PyArg_ParseTuple(args, (char *)"OOii:virDomainListGetStats",
&pyobj_conn, &py_domlist, &stats, &flags))
When python >= 2.3, 'I' means unsigned int and 'i' means int,so there should use 'I'.
From: https://docs.python.org/2/c-api/arg.html
I also found a lot of function use 'i' for a unsigned int, but i didn't change them.
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
libvirt-override.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libvirt-override.c b/libvirt-override.c
index c887b71..6dacdac 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -8126,7 +8126,7 @@ libvirt_virDomainListGetStats(PyObject *self ATTRIBUTE_UNUSED,
unsigned int flags;
unsigned int stats;
- if (!PyArg_ParseTuple(args, (char *)"OOii:virDomainListGetStats",
+ if (!PyArg_ParseTuple(args, (char *)"OOII:virDomainListGetStats",
&pyobj_conn, &py_domlist, &stats, &flags))
return NULL;
--
1.8.3.1
10 years, 1 month
[libvirt] [PATCH] qemu: unref cfg after TerminateMachine has been called
by Martin Kletzander
Commit 60627f6d added the code that requests driver cfg, but forgot to
unref it.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/qemu/qemu_cgroup.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index fa894c5..b5bdb36 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -1222,6 +1222,8 @@ qemuRemoveCgroup(virQEMUDriverPtr driver,
VIR_DEBUG("Failed to terminate cgroup for %s", vm->def->name);
}
+ virObjectUnref(cfg);
+
return virCgroupRemove(priv->cgroup);
}
--
2.1.2
10 years, 1 month
[libvirt] [PATCH] docs: Mention repository locations in contributor guidelines
by Martin Kletzander
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
HACKING | 18 +++++++++++-------
docs/hacking.html.in | 5 +++++
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/HACKING b/HACKING
index add0841..f8546cb 100644
--- a/HACKING
+++ b/HACKING
@@ -14,7 +14,11 @@ General tips for contributing patches
(1) Discuss any large changes on the mailing list first. Post patches early and
listen to feedback.
-(2) Post patches in unified diff format, with git rename detection enabled. You
+(2) Official upstream repository is kept in git ("git://libvirt.org/libvirt.git")
+and is browsable along with other libvirt-related repositories (e.g.
+libvirt-python) online <http://libvirt.org>.
+
+(3) Post patches in unified diff format, with git rename detection enabled. You
need a one-time setup of:
git config diff.renames true
@@ -66,7 +70,7 @@ though).
-(3) In your commit message, make the summary line reasonably short (60 characters
+(4) In your commit message, make the summary line reasonably short (60 characters
is typical), followed by a blank line, followed by any longer description of
why your patch makes sense. If the patch fixes a regression, and you know what
commit introduced the problem, mentioning that is useful. If the patch
@@ -78,7 +82,7 @@ is up to you if you want to include or omit them in the commit message.
-(4) Split large changes into a series of smaller patches, self-contained if
+(5) Split large changes into a series of smaller patches, self-contained if
possible, with an explanation of each patch and an explanation of how the
sequence of patches fits together. Moreover, please keep in mind that it's
required to be able to compile cleanly (*including* "make check" and "make
@@ -89,10 +93,10 @@ things).
-(5) Make sure your patches apply against libvirt GIT. Developers only follow GIT
+(6) Make sure your patches apply against libvirt GIT. Developers only follow GIT
and don't care much about released versions.
-(6) Run the automated tests on your code before submitting any changes. In
+(7) Run the automated tests on your code before submitting any changes. In
particular, configure with compile warnings set to -Werror. This is done
automatically for a git checkout; from a tarball, use:
@@ -138,7 +142,7 @@ various tests under gdb or Valgrind.
-(7) The Valgrind test should produce similar output to "make check". If the output
+(8) The Valgrind test should produce similar output to "make check". If the output
has traces within libvirt API's, then investigation is required in order to
determine the cause of the issue. Output such as the following indicates some
sort of leak:
@@ -214,7 +218,7 @@ to "tests/.valgrind.supp" in order to suppress the warning:
-(8) Update tests and/or documentation, particularly if you are adding a new
+(9) Update tests and/or documentation, particularly if you are adding a new
feature or changing the output of a program.
diff --git a/docs/hacking.html.in b/docs/hacking.html.in
index 8f2b9d6..4ab0179 100644
--- a/docs/hacking.html.in
+++ b/docs/hacking.html.in
@@ -11,6 +11,11 @@
<li>Discuss any large changes on the mailing list first. Post patches
early and listen to feedback.</li>
+ <li>Official upstream repository is kept in git
+ (<code>git://libvirt.org/libvirt.git</code>) and is browsable
+ along with other libvirt-related repositories
+ (e.g. libvirt-python) <a href="http://libvirt.org">online</a>.</li>
+
<li><p>Post patches in unified diff format, with git rename
detection enabled. You need a one-time setup of:</p>
<pre>
--
2.1.2
10 years, 1 month
[libvirt] [PATCH] qemu: x86_64 is good enough for i686
by Lubomir Rintel
virt-manager on Fedora sets up i686 hosts with "/usr/bin/qemu-kvm" emulator,
which in turn unconditionally execs qemu-system-x86_64 querying capabilities
then fails:
Error launching details: invalid argument: architecture from emulator 'x86_64' doesn't match given architecture 'i686'
Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/engine.py", line 748, in _show_vm_helper
details = self._get_details_dialog(uri, vm.get_connkey())
File "/usr/share/virt-manager/virtManager/engine.py", line 726, in _get_details_dialog
obj = vmmDetails(conn.get_vm(connkey))
File "/usr/share/virt-manager/virtManager/details.py", line 399, in __init__
self.init_details()
File "/usr/share/virt-manager/virtManager/details.py", line 784, in init_details
domcaps = self.vm.get_domain_capabilities()
File "/usr/share/virt-manager/virtManager/domain.py", line 518, in get_domain_capabilities
self.get_xmlobj().os.machine, self.get_xmlobj().type)
File "/usr/lib/python2.7/site-packages/libvirt.py", line 3492, in getDomainCapabilities
if ret is None: raise libvirtError ('virConnectGetDomainCapabilities() failed', conn=self)
libvirtError: invalid argument: architecture from emulator 'x86_64' doesn't match given architecture 'i686'
Journal:
Oct 16 21:08:26 goatlord.localdomain libvirtd[1530]: invalid argument: architecture from emulator 'x86_64' doesn't match given architecture 'i686'
---
src/qemu/qemu_driver.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7377320..e4b2b6c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17809,7 +17809,8 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
arch_from_caps = virQEMUCapsGetArch(qemuCaps);
- if (arch_from_caps != arch) {
+ if (arch_from_caps != arch &&
+ (arch_from_caps != VIR_ARCH_X86_64 || arch != VIR_ARCH_I686)) {
virReportError(VIR_ERR_INVALID_ARG,
_("architecture from emulator '%s' doesn't "
"match given architecture '%s'"),
--
2.1.0
10 years, 1 month
[libvirt] [PATCH] qemu: move setting emulatorpin ahead of monitor showing up
by Wang Rui
From: Zhou yimin <zhouyimin(a)huawei.com>
If VM is configured with many devices(including passthrough devices)
and large memory, libvirtd will take seconds(in the worst case) to
wait for monitor. In this period the qemu process may run on any
PCPU though I intend to pin emulator to the specified PCPU in xml
configuration.
Actually qemu process takes high cpu usage during vm startup.
So this is not the strict CPU isolation in this case.
Signed-off-by: Zhou yimin <zhouyimin(a)huawei.com>
---
src/qemu/qemu_process.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 95548aa..ef258cf 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4553,6 +4553,14 @@ int qemuProcessStart(virConnectPtr conn,
if (ret == -1) /* The VM failed to start */
goto cleanup;
+ VIR_DEBUG("Setting cgroup for emulator (if required)");
+ if (qemuSetupCgroupForEmulator(driver, vm, nodemask) < 0)
+ goto cleanup;
+
+ VIR_DEBUG("Setting affinity of emulator threads");
+ if (qemuProcessSetEmulatorAffinity(vm) < 0)
+ goto cleanup;
+
VIR_DEBUG("Waiting for monitor to show up");
if (qemuProcessWaitForMonitor(driver, vm, asyncJob, priv->qemuCaps, pos) < 0)
goto cleanup;
@@ -4588,10 +4596,6 @@ int qemuProcessStart(virConnectPtr conn,
if (qemuSetupCgroupForVcpu(vm) < 0)
goto cleanup;
- VIR_DEBUG("Setting cgroup for emulator (if required)");
- if (qemuSetupCgroupForEmulator(driver, vm, nodemask) < 0)
- goto cleanup;
-
VIR_DEBUG("Setting cgroup for each IOThread (if required)");
if (qemuSetupCgroupForIOThreads(vm) < 0)
goto cleanup;
@@ -4600,10 +4604,6 @@ int qemuProcessStart(virConnectPtr conn,
if (qemuProcessSetVcpuAffinities(vm) < 0)
goto cleanup;
- VIR_DEBUG("Setting affinity of emulator threads");
- if (qemuProcessSetEmulatorAffinity(vm) < 0)
- goto cleanup;
-
VIR_DEBUG("Setting affinity of IOThread threads");
if (qemuProcessSetIOThreadsAffinity(vm) < 0)
goto cleanup;
--
1.7.12.4
10 years, 1 month
[libvirt] [PATCH] - make virDomainDetachDeviceFlags respect VIR_DOMAIN_DEVICE_MODIFY_FORCE
by Marcin Gibuła
Hi,
currently, there is no way to force disk detach from KVM guest if guest
does not cooperate. This patch makes virDomainDetachDeviceFlags() respect
VIR_DOMAIN_DEVICE_MODIFY_FORCE flag. When it's on, libvirt will always
call drive_del, regardless if guest responsed to ACPI unplug request or not.
---
diff -ru libvirt-1.2.6-orig/src/qemu/qemu_driver.c libvirt-1.2.6/src/qemu/qemu_driver.c
--- libvirt-1.2.6-orig/src/qemu/qemu_driver.c 2014-07-02 05:35:47.000000000 +0200
+++ libvirt-1.2.6/src/qemu/qemu_driver.c 2014-10-09 13:37:27.863897583 +0200
@@ -6525,14 +6525,15 @@
static int
qemuDomainDetachDeviceLive(virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
- virDomainPtr dom)
+ virDomainPtr dom,
+ int flags)
{
virQEMUDriverPtr driver = dom->conn->privateData;
int ret = -1;
switch (dev->type) {
case VIR_DOMAIN_DEVICE_DISK:
- ret = qemuDomainDetachDeviceDiskLive(driver, vm, dev);
+ ret = qemuDomainDetachDeviceDiskLive(driver, vm, dev, flags);
break;
case VIR_DOMAIN_DEVICE_CONTROLLER:
ret = qemuDomainDetachDeviceControllerLive(driver, vm, dev);
@@ -7257,7 +7258,8 @@
virCapsPtr caps = NULL;
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
- VIR_DOMAIN_AFFECT_CONFIG, -1);
+ VIR_DOMAIN_AFFECT_CONFIG |
+ VIR_DOMAIN_DEVICE_MODIFY_FORCE, -1);
cfg = virQEMUDriverGetConfig(driver);
@@ -7343,7 +7345,7 @@
VIR_DOMAIN_DEVICE_ACTION_DETACH) < 0)
goto endjob;
- if ((ret = qemuDomainDetachDeviceLive(vm, dev_copy, dom)) < 0)
+ if ((ret = qemuDomainDetachDeviceLive(vm, dev_copy, dom, flags)) < 0)
goto endjob;
/*
* update domain status forcibly because the domain status may be
diff -ru libvirt-1.2.6-orig/src/qemu/qemu_hotplug.c libvirt-1.2.6/src/qemu/qemu_hotplug.c
--- libvirt-1.2.6-orig/src/qemu/qemu_hotplug.c 2014-06-27 05:50:18.000000000 +0200
+++ libvirt-1.2.6/src/qemu/qemu_hotplug.c 2014-10-09 13:35:55.566375716 +0200
@@ -2906,7 +2906,8 @@
static int
qemuDomainDetachVirtioDiskDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- virDomainDiskDefPtr detach)
+ virDomainDiskDefPtr detach,
+ int flags)
{
int ret = -1;
qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -2958,7 +2959,7 @@
qemuDomainObjExitMonitor(driver, vm);
rc = qemuDomainWaitForDeviceRemoval(vm);
- if (rc == 0 || rc == 1)
+ if (rc == 0 || rc == 1 || (flags & VIR_DOMAIN_DEVICE_MODIFY_FORCE))
ret = qemuDomainRemoveDiskDevice(driver, vm, detach);
else
ret = 0;
@@ -2971,7 +2972,8 @@
static int
qemuDomainDetachDiskDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- virDomainDiskDefPtr detach)
+ virDomainDiskDefPtr detach,
+ int flags)
{
int ret = -1;
qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -3003,7 +3005,7 @@
qemuDomainObjExitMonitor(driver, vm);
rc = qemuDomainWaitForDeviceRemoval(vm);
- if (rc == 0 || rc == 1)
+ if (rc == 0 || rc == 1 || (flags & VIR_DOMAIN_DEVICE_MODIFY_FORCE))
ret = qemuDomainRemoveDiskDevice(driver, vm, detach);
else
ret = 0;
@@ -3030,7 +3032,8 @@
int
qemuDomainDetachDeviceDiskLive(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- virDomainDeviceDefPtr dev)
+ virDomainDeviceDefPtr dev,
+ int flags)
{
virDomainDiskDefPtr disk;
int ret = -1;
@@ -3047,10 +3050,10 @@
case VIR_DOMAIN_DISK_DEVICE_DISK:
case VIR_DOMAIN_DISK_DEVICE_LUN:
if (disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO)
- ret = qemuDomainDetachVirtioDiskDevice(driver, vm, disk);
+ ret = qemuDomainDetachVirtioDiskDevice(driver, vm, disk, flags);
else if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI ||
disk->bus == VIR_DOMAIN_DISK_BUS_USB)
- ret = qemuDomainDetachDiskDevice(driver, vm, disk);
+ ret = qemuDomainDetachDiskDevice(driver, vm, disk, flags);
else
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("This type of disk cannot be hot unplugged"));
diff -ru libvirt-1.2.6-orig/src/qemu/qemu_hotplug.h libvirt-1.2.6/src/qemu/qemu_hotplug.h
--- libvirt-1.2.6-orig/src/qemu/qemu_hotplug.h 2014-06-25 13:25:52.000000000 +0200
+++ libvirt-1.2.6/src/qemu/qemu_hotplug.h 2014-10-09 13:36:22.255659117 +0200
@@ -71,7 +71,8 @@
int linkstate);
int qemuDomainDetachDeviceDiskLive(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- virDomainDeviceDefPtr dev);
+ virDomainDeviceDefPtr dev,
+ int flags);
int qemuDomainDetachControllerDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev);
--
mg
10 years, 1 month
[libvirt] [libvirt-python v3 PATCH] Improve error output when use getTime with a nonzero flags.
by Luyao Huang
When give a nonzero flags to getTime, c_retval will get -1 and goto cleanup.
But py_retval still is NULL,so set py_retval = VIR_PY_NONE.
This will make the output message more correct.
error will disappear:
SystemError: error return without exception set
v2:
https://www.redhat.com/archives/libvir-list/2014-October/msg00497.html
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
libvirt-override.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libvirt-override.c b/libvirt-override.c
index 9ba87eb..8690f4f 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -7757,9 +7757,11 @@ libvirt_virDomainGetTime(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
c_retval = virDomainGetTime(domain, &seconds, &nseconds, flags);
LIBVIRT_END_ALLOW_THREADS;
- if (c_retval < 0)
+ if (c_retval < 0) {
+ py_retval = VIR_PY_NONE;
goto cleanup;
-
+ }
+
if (!(pyobj_seconds = libvirt_longlongWrap(seconds)) ||
PyDict_SetItemString(dict, "seconds", pyobj_seconds) < 0)
goto cleanup;
--
1.8.3.1
10 years, 1 month
[libvirt] [libvirt-python v2 PATCH] Improve error output when use getTime with a nonzero flags.
by Luyao Huang
When give a nonzero flags to getTime, c_retval will get -1 and goto cleanup.
But py_retval still is NULL,so pass c_retval value to py_retval.
This will make the output message more correct.
error before use this patch:
SystemError: error return without exception set
after use the patch:
libvirtError: unsupported flags (0x1) in function qemuDomainGetTime
v1:
https://www.redhat.com/archives/libvir-list/2014-October/msg00482.html
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
libvirt-override.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libvirt-override.c b/libvirt-override.c
index 9ba87eb..c779aa3 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -7757,9 +7757,11 @@ libvirt_virDomainGetTime(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
c_retval = virDomainGetTime(domain, &seconds, &nseconds, flags);
LIBVIRT_END_ALLOW_THREADS;
- if (c_retval < 0)
+ if (c_retval < 0){
+ py_retval = libvirt_intWrap(c_retval);
goto cleanup;
-
+ }
+
if (!(pyobj_seconds = libvirt_longlongWrap(seconds)) ||
PyDict_SetItemString(dict, "seconds", pyobj_seconds) < 0)
goto cleanup;
--
1.8.3.1
10 years, 1 month
[libvirt] Implement quorum support.
by Matthias Gatto
Hello,
I'm implementing quorum in libvirt.
I've try to follow this proposal:
http://www.redhat.com/archives/libvir-list/2014-May/msg00546.html
At this point I've done this:
- add all the field need by quorum in _virStorageSource
(nBackingStores, threshold).
- handle more than one backing store in virStorageSource by adding a
function virStorageSourcePushBackingStore
- add support of the quorum syntax for the xml parser.
so now i have to work on qemuBuildDriveStr
But I've a problem:
in qemu a child of a quorum is a BlockDriverState, where it's a
virStorageSource in libvirt, so a child in qemu contain more
information than a backingStore in libvirt(blockinfo, throttle...).
I think about several solution for this problem:
- I can handle quorum's child differently than backingStore and create
a "virDomainDiskDefPtr childs" field in virDomainDiskDef or
virStorageSource.
- I can change the virStorageSourcePtr backingStore, to
virDomainDiskDefPtr backingStore, and move the field to backingStore
to virDomainDiskDef.
-I can move all the field need by a quorum's child from
virStorageSource to virDomainDiskDef.
But i don't know which solution is the best for libvirt, how do you
think i can handle this problem ?
Best regards,
Matthias
10 years, 1 month
[libvirt] [PATCH] tests: fix incorrect caps for shmem-invalid-size, shmem-small-size
by Maxime Leroy
VIR_TEST_DEBUG=2 ./qemuxml2argvtest generates the following output:
409) QEMU XML-2-ARGV shmem-invalid-size
... Got expected error: unsupported configuration: ivshmem device is not \
supported with this QEMU binary
OK
410) QEMU XML-2-ARGV shmem-small-size
... Got expected error: unsupported configuration: ivshmem device is not \
supported with this QEMU binary
OK
We should have:
409) QEMU XML-2-ARGV shmem-invalid-size
... Got expected error: XML error: shmem size must be a power of two
OK
410) QEMU XML-2-ARGV shmem-small-size
... Got expected error: XML error: shmem size must be at least 1 MiB
OK
This commit fixes the issue by providing QEMU_CAPS_DEVICE_IVSHMEM caps
for shmem-invalid-size, shmem-small-size test.
Signed-off-by: Maxime Leroy <maxime.leroy(a)6wind.com>
---
tests/qemuxml2argvtest.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index c13aa99..0e9fab9 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1469,8 +1469,10 @@ mymain(void)
DO_TEST("shmem", QEMU_CAPS_PCIDEVICE,
QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_IVSHMEM);
DO_TEST_FAILURE("shmem", NONE);
- DO_TEST_FAILURE("shmem-invalid-size", NONE);
- DO_TEST_FAILURE("shmem-small-size", NONE);
+ DO_TEST_FAILURE("shmem-invalid-size", QEMU_CAPS_PCIDEVICE,
+ QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_IVSHMEM);
+ DO_TEST_FAILURE("shmem-small-size", QEMU_CAPS_PCIDEVICE,
+ QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_IVSHMEM);
DO_TEST_PARSE_ERROR("shmem-msi-only", NONE);
virObjectUnref(driver.config);
--
1.9.3
10 years, 1 month