[libvirt] [PATCH] qemu: Only issue the rtc-reset-reinjection QMP command on x86.
by Andrea Bolognani
The command is only defined in QEMU for TARGET_I386, so issuing it on
any other architecture can't possibly work.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1211938
---
src/qemu/qemu_driver.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index aa0acde..743ca6e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18945,7 +18945,10 @@ qemuDomainSetTime(virDomainPtr dom,
goto endjob;
}
- if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_RTC_RESET_REINJECTION)) {
+ /* The rtc-reset-reinjection QMP command is only available on x86 */
+ if (ARCH_IS_X86(vm->def->os.arch) &&
+ !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_RTC_RESET_REINJECTION))
+ {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("cannot set time: qemu doesn't support "
"rtc-reset-reinjection command"));
@@ -18968,13 +18971,16 @@ qemuDomainSetTime(virDomainPtr dom,
goto endjob;
}
- qemuDomainObjEnterMonitor(driver, vm);
- rv = qemuMonitorRTCResetReinjection(priv->mon);
- if (qemuDomainObjExitMonitor(driver, vm) < 0)
- goto endjob;
+ /* The rtc-reset-reinjection QMP command is only available on x86 */
+ if (ARCH_IS_X86(vm->def->os.arch)) {
+ qemuDomainObjEnterMonitor(driver, vm);
+ rv = qemuMonitorRTCResetReinjection(priv->mon);
+ if (qemuDomainObjExitMonitor(driver, vm) < 0)
+ goto endjob;
- if (rv < 0)
- goto endjob;
+ if (rv < 0)
+ goto endjob;
+ }
ret = 0;
--
2.1.0
9 years, 10 months
[libvirt] [PATCH 0/2] virsh: Further improve handling of integer options
by Andrea Bolognani
As suggested by Michal: now that we have a generic error message for
failures related to the parsing of integer options, it makes sense to
perform the corresponding check in a single spot instead of replicating
it every time vshCommandOpt*() is used.
Andrea Bolognani (2):
virsh: Pass vshControl to all vshCommandOpt*() calls.
virsh: Move error messages inside vshCommandOpt*() functions.
tests/vcpupin | 4 +-
tools/virsh-domain-monitor.c | 97 +++---
tools/virsh-domain.c | 696 +++++++++++++++++++------------------------
tools/virsh-host.c | 87 ++----
tools/virsh-interface.c | 18 +-
tools/virsh-network.c | 38 ++-
tools/virsh-nodedev.c | 6 +-
tools/virsh-pool.c | 26 +-
tools/virsh-secret.c | 8 +-
tools/virsh-snapshot.c | 88 +++---
tools/virsh-volume.c | 50 ++--
tools/virsh.c | 195 ++++++------
tools/virsh.h | 77 ++---
13 files changed, 624 insertions(+), 766 deletions(-)
--
2.1.0
9 years, 10 months
[libvirt] [PATCH libvirt] interface: don't error out if a bond has no interfaces
by Lubomir Rintel
It's not a problem at all and causes virt-manager to break down.
Note: netcf 0.2.8 generates invalid XML for a bond with no interfaces anyway,
so this error is in fact not reached as we fail earlier. Fix submitted upstream.
Signed-off-by: Lubomir Rintel <lkundrak(a)v3.sk>
---
src/conf/interface_conf.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index c2eb945..29769ac 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -553,19 +553,15 @@ virInterfaceDefParseBondItfs(virInterfaceDefPtr def,
nbItf = virXPathNodeSet("./interface", ctxt, &interfaces);
if (nbItf < 0) {
ret = -1;
- goto error;
+ goto cleanup;
}
- if (nbItf == 0) {
- virReportError(VIR_ERR_XML_ERROR,
- "%s", _("bond has no interfaces"));
- ret = -1;
- goto error;
- }
+ if (nbItf == 0)
+ goto cleanup;
if (VIR_ALLOC_N(def->data.bond.itf, nbItf) < 0) {
ret = -1;
- goto error;
+ goto cleanup;
}
def->data.bond.nbItf = nbItf;
@@ -575,12 +571,12 @@ virInterfaceDefParseBondItfs(virInterfaceDefPtr def,
if (itf == NULL) {
ret = -1;
def->data.bond.nbItf = i;
- goto error;
+ goto cleanup;
}
def->data.bond.itf[i] = itf;
}
- error:
+ cleanup:
VIR_FREE(interfaces);
ctxt->node = bond;
return ret;
--
2.4.1
9 years, 10 months
[libvirt] [PATCHv3] util: make it more robust to calculate timeout value
by Wang Yufei
From: Zhang Bo <oscar.zhangbo(a)huawei.com>
When we change system clock to years ago, a certain CPU may use up 100% cputime.
The reason is that in function virEventPollCalculateTimeout(), we assign the
unsigned long long result to an INT variable,
*timeout = then - now; // timeout is INT, and then/now are long long
if (*timeout < 0)
*timeout = 0;
there's a chance that variable @then minus variable @now may be a very large number
that overflows INT value expression, then *timeout will be negative and be assigned to 0.
Next the 'poll' in function virEventPollRunOnce() will get into an 'endless' while loop there.
thus, the cpu that virEventPollRunOnce() thread runs on will go up to 100%.
Although as we discussed before in https://www.redhat.com/archives/libvir-list/2015-May/msg00400.html
it should be prohibited to set-time while other applications are running, but it does
seems to have no harm to make the codes more robust.
Signed-off-by: Wang Yufei <james.wangyufei(a)huawei.com>
Signed-off-by: Zhang Bo <oscar.zhangbo(a)huawei.com>
---
src/util/vireventpoll.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/util/vireventpoll.c b/src/util/vireventpoll.c
index ffda206..4e4f407 100644
--- a/src/util/vireventpoll.c
+++ b/src/util/vireventpoll.c
@@ -357,9 +357,10 @@ static int virEventPollCalculateTimeout(int *timeout)
return -1;
EVENT_DEBUG("Schedule timeout then=%llu now=%llu", then, now);
- *timeout = then - now;
- if (*timeout < 0)
+ if (then <= now)
*timeout = 0;
+ else
+ *timeout = ((then-now) > INT_MAX) ? INT_MAX : (then-now);
} else {
*timeout = -1;
}
--
1.7.12.4
9 years, 10 months
[libvirt] [PATCH] storage_fs: Create directory with UID if needed
by Martin Kletzander
The code already exists there, it just modified different flags. I just
noticed this when looking at the code. This patch is better to view
with bigger context or '-W'.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/storage/storage_backend_fs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index bcbbb3ae252a..5dc712925b27 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -1,7 +1,7 @@
/*
* storage_backend_fs.c: storage backend for FS and directory handling
*
- * Copyright (C) 2007-2014 Red Hat, Inc.
+ * Copyright (C) 2007-2015 Red Hat, Inc.
* Copyright (C) 2007-2008 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -807,7 +807,7 @@ virStorageBackendFileSystemBuild(virConnectPtr conn ATTRIBUTE_UNUSED,
(needs_create_as_uid || !virFileExists(pool->def->target.path)))
mode = VIR_STORAGE_DEFAULT_POOL_PERM_MODE;
if (needs_create_as_uid)
- flags |= VIR_DIR_CREATE_AS_UID;
+ dir_create_flags |= VIR_DIR_CREATE_AS_UID;
/* Now create the final dir in the path with the uid/gid/mode
* requested in the config. If the dir already exists, just set
--
2.4.1
9 years, 10 months
[libvirt] [PATCH] zfs: fix storagepoolxml2xml test
by Roman Bogorodskiy
Commit 7c2d65d dropped setting default mode.
Update zfs tests accordingly.
---
tests/storagepoolxml2xmlout/pool-zfs-sourcedev.xml | 3 ---
tests/storagepoolxml2xmlout/pool-zfs.xml | 3 ---
2 files changed, 6 deletions(-)
diff --git a/tests/storagepoolxml2xmlout/pool-zfs-sourcedev.xml b/tests/storagepoolxml2xmlout/pool-zfs-sourcedev.xml
index 89dcdbf..8d9be73 100644
--- a/tests/storagepoolxml2xmlout/pool-zfs-sourcedev.xml
+++ b/tests/storagepoolxml2xmlout/pool-zfs-sourcedev.xml
@@ -10,8 +10,5 @@
</source>
<target>
<path>/dev/zvol/testpool</path>
- <permissions>
- <mode>0755</mode>
- </permissions>
</target>
</pool>
diff --git a/tests/storagepoolxml2xmlout/pool-zfs.xml b/tests/storagepoolxml2xmlout/pool-zfs.xml
index c9e5df9..1a8de4f 100644
--- a/tests/storagepoolxml2xmlout/pool-zfs.xml
+++ b/tests/storagepoolxml2xmlout/pool-zfs.xml
@@ -9,8 +9,5 @@
</source>
<target>
<path>/dev/zvol/testpool</path>
- <permissions>
- <mode>0755</mode>
- </permissions>
</target>
</pool>
--
2.3.5
9 years, 10 months
[libvirt] Libvirt now using Zanata for translation
by Daniel P. Berrange
As of current GIT master, libvirt is fully using Zanata for po file
translation
After some trouble with the zanata python client, I have now successfully
refreshed & pushed the current libvirt.pot file, and synchronized all
the translation po files back down to GIT master.
For ongoing refreshes of the libvirt.pot, it can be rebuild & pushed
to zanata and .po files resynchonized using
# cd po
# rm libvirt.pot
# make libvirt.pot
# zanata-cli push
# zanata-cli pull
Where 'zanata-cli' is the *JAVA* client, not the python client. I strongly
recommend against use of the python client for the libvirt project as it
doesn't handle the size of the libvirt.pot/.po files well resulting in
unexplained data loss. Even the java client has problems pushing the
.po files to the server due to poorly designed rate limiting in the
zanata server.
Fortunately this is not something we need do again, now we have imported
the existing .po file. The java client has been troublefree wrt to pushing
the .pot file and pulling .po files, which is all we need for ongoing work
now.
Currently myself & Daniel Veillard are setup as admins of the libvirt
project in Zanata & we can add further people as required.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
9 years, 10 months
[libvirt] [PATCH] util: improve the sysinfo element XML format
by Luyao Huang
When set sysinfo element without sub-elements,
libvirt will format it as:
<sysinfo type='smbios'>
</sysinfo>
After improve the format:
<sysinfo type='smbios'/>
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
src/util/virsysinfo.c | 33 ++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)
diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index 8bb17f0..f87376f 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -1041,31 +1041,42 @@ virSysinfoMemoryFormat(virBufferPtr buf, virSysinfoDefPtr def)
int
virSysinfoFormat(virBufferPtr buf, virSysinfoDefPtr def)
{
+ virBuffer childrenBuf = VIR_BUFFER_INITIALIZER;
const char *type = virSysinfoTypeToString(def->type);
+ int indent = virBufferGetIndent(buf, false);
+ int ret = -1;
if (!type) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected sysinfo type model %d"),
def->type);
virBufferFreeAndReset(buf);
- return -1;
+ goto cleanup;
}
- virBufferAsprintf(buf, "<sysinfo type='%s'>\n", type);
- virBufferAdjustIndent(buf, 2);
+ virBufferAdjustIndent(&childrenBuf, indent + 2);
- virSysinfoBIOSFormat(buf, def);
- virSysinfoSystemFormat(buf, def);
- virSysinfoProcessorFormat(buf, def);
- virSysinfoMemoryFormat(buf, def);
+ virSysinfoBIOSFormat(&childrenBuf, def);
+ virSysinfoSystemFormat(&childrenBuf, def);
+ virSysinfoProcessorFormat(&childrenBuf, def);
+ virSysinfoMemoryFormat(&childrenBuf, def);
- virBufferAdjustIndent(buf, -2);
- virBufferAddLit(buf, "</sysinfo>\n");
+ virBufferAsprintf(buf, "<sysinfo type='%s'", type);
+ if (virBufferUse(&childrenBuf)) {
+ virBufferAddLit(buf, ">\n");
+ virBufferAddBuffer(buf, &childrenBuf);
+ virBufferAddLit(buf, "</sysinfo>\n");
+ } else {
+ virBufferAddLit(buf, "/>\n");
+ }
if (virBufferCheckError(buf) < 0)
- return -1;
+ goto cleanup;
- return 0;
+ ret = 0;
+ cleanup:
+ virBufferFreeAndReset(&childrenBuf);
+ return ret;
}
bool virSysinfoIsEqual(virSysinfoDefPtr src,
--
1.8.3.1
9 years, 10 months
[libvirt] [PATCH v2] qemu: Fix compilation error when enum variable size differs from 'int'
by Peter Krempa
Since commit bcd9a564b631aa virDomainNumatuneGetMode returns the value
via a pointer rather than in the return value. The change triggered
problems with platforms where the compiler decides to use a data type of
size different than integer at the point where we typecast it.
Work around the issue by using an intermediate variable of the correct
type that gets casted back by the default typecasting rules.
---
Version 2:
- removed block from the case statement
- added ignore value section to silence coverity and initialized the temp variable
src/qemu/qemu_driver.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index aa0acde..1233d8f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10524,6 +10524,7 @@ qemuDomainGetNumaParameters(virDomainPtr dom,
size_t i;
virDomainObjPtr vm = NULL;
virDomainDefPtr persistentDef = NULL;
+ virDomainNumatuneMemMode tmpmode = VIR_DOMAIN_NUMATUNE_MEM_STRICT;
char *nodeset = NULL;
int ret = -1;
virCapsPtr caps = NULL;
@@ -10567,12 +10568,12 @@ qemuDomainGetNumaParameters(virDomainPtr dom,
switch (i) {
case 0: /* fill numa mode here */
+ ignore_value(virDomainNumatuneGetMode(def->numa, -1, &tmpmode));
+
if (virTypedParameterAssign(param, VIR_DOMAIN_NUMA_MODE,
- VIR_TYPED_PARAM_INT, 0) < 0)
+ VIR_TYPED_PARAM_INT, tmpmode) < 0)
goto cleanup;
- virDomainNumatuneGetMode(def->numa, -1,
- (virDomainNumatuneMemMode *) ¶m->value.i);
break;
case 1: /* fill numa nodeset here */
--
2.4.1
9 years, 10 months
[libvirt] [PATCH] conf: improve the address check for dimm type
by Luyao Huang
When hot-plug/cold-plug a memory device, we use
memcmp() function to check if there is a memory device
have the same address with the memory device we want
hot-pluged. But qemu forbid use/hot-plug 2 memory device
with same slot *or* the same base(qemu side this elemnt
named addr).
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
src/conf/domain_conf.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6e57425..413f839 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3089,7 +3089,10 @@ virDomainDeviceInfoAddressIsEqual(const virDomainDeviceInfo *a,
break;
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM:
- if (memcmp(&a->addr.dimm, &b->addr.dimm, sizeof(a->addr.dimm)))
+ if (a->addr.dimm.slot != b->addr.dimm.slot &&
+ (a->addr.dimm.base == 0 ||
+ b->addr.dimm.base == 0 ||
+ a->addr.dimm.base != b->addr.dimm.base))
return false;
break;
}
--
1.8.3.1
9 years, 10 months