[libvirt] [PATCH]docs: fix a typo in formatnwfilter.html.in
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
s/insallations/installations/
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
docs/formatnwfilter.html.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/formatnwfilter.html.in b/docs/formatnwfilter.html.in
index c5ab68d..4b95fce 100644
--- a/docs/formatnwfilter.html.in
+++ b/docs/formatnwfilter.html.in
@@ -2355,7 +2355,7 @@
on the source system are equivalent to those on the target system
and vice versa.
<br/><br/>
- Migration must occur between libvirt insallations of version
+ Migration must occur between libvirt installations of version
0.8.1 or later in order not to lose the network traffic filters
associated with an interface.
</p>
--
1.8.2.1
11 years
[libvirt] [PATCH] docs: improve job info details
by Eric Blake
Noticed while revieweing the patches for qemu's new migration state.
* include/libvirt/libvirt.h.in (_virDomainJobInfo): Fix typo,
grammar.
* src/libvirt.c (virDomainGetJobInfo): Add cross reference.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing under the trivial rule.
include/libvirt/libvirt.h.in | 8 ++++----
src/libvirt.c | 3 +++
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 80b2d78..d656634 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -4067,20 +4067,20 @@ struct _virDomainJobInfo {
/* One of virDomainJobType */
int type;
- /* Time is measured in mill-seconds */
+ /* Time is measured in milliseconds */
unsigned long long timeElapsed; /* Always set */
unsigned long long timeRemaining; /* Only for VIR_DOMAIN_JOB_BOUNDED */
/* Data is measured in bytes unless otherwise specified
- * and is measuring the job as a whole
+ * and is measuring the job as a whole.
*
* For VIR_DOMAIN_JOB_UNBOUNDED, dataTotal may be less
* than the final sum of dataProcessed + dataRemaining
* in the event that the hypervisor has to repeat some
- * data eg due to dirtied pages during migration
+ * data, such as due to dirtied pages during migration.
*
* For VIR_DOMAIN_JOB_BOUNDED, dataTotal shall always
- * equal sum of dataProcessed + dataRemaining
+ * equal the sum of dataProcessed + dataRemaining.
*/
unsigned long long dataTotal;
unsigned long long dataProcessed;
diff --git a/src/libvirt.c b/src/libvirt.c
index 90608ab..6a17db8 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -18666,6 +18666,9 @@ error:
* Extract information about progress of a background job on a domain.
* Will return an error if the domain is not active.
*
+ * This function returns a limited amount of information in comparison
+ * to virDomainGetJobStats().
+ *
* Returns 0 in case of success and -1 in case of failure.
*/
int
--
1.8.3.1
11 years
[libvirt] [PATCH] qemu: Call qemuSetupHostdevCGroup later during hotplug
by Jiri Denemark
https://bugzilla.redhat.com/show_bug.cgi?id=1025108
So far qemuSetupHostdevCGroup was called very early during hotplug, even
before we knew the device we were about to hotplug was actually
available. By calling the function later, we make sure QEMU won't be
allowed to access devices used by other domains.
Another important effect of this change is that hopluging USB devices
specified by vendor and product (but not by their USB address) works
again. This was broken since v1.0.5-171-g7d763ac, when the call to
qemuFindHostdevUSBDevice was moved after the call to
qemuSetupHostdevCGroup, which then used an uninitialized USB address.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_hotplug.c | 36 +++++++++++++++++++++++++++---------
1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 6eb483c..0d9a3aa 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1135,6 +1135,7 @@ int qemuDomainAttachHostPciDevice(virQEMUDriverPtr driver,
int configfd = -1;
char *configfd_name = NULL;
bool releaseaddr = false;
+ bool teardowncgroup = false;
int backend = hostdev->source.subsys.u.pci.backend;
if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0)
@@ -1171,6 +1172,10 @@ int qemuDomainAttachHostPciDevice(virQEMUDriverPtr driver,
break;
}
+ if (qemuSetupHostdevCGroup(vm, hostdev) < 0)
+ goto error;
+ teardowncgroup = true;
+
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, -1) < 0)
goto error;
@@ -1226,6 +1231,9 @@ int qemuDomainAttachHostPciDevice(virQEMUDriverPtr driver,
return 0;
error:
+ if (teardowncgroup && qemuTeardownHostdevCgroup(vm, hostdev) < 0)
+ VIR_WARN("Unable to remove host device cgroup ACL on hotplug fail");
+
if (releaseaddr)
qemuDomainReleaseDeviceAddress(vm, hostdev->info, NULL);
@@ -1418,6 +1426,7 @@ int qemuDomainAttachHostUsbDevice(virQEMUDriverPtr driver,
virUSBDevicePtr usb = NULL;
char *devstr = NULL;
bool added = false;
+ bool teardowncgroup = false;
int ret = -1;
if (qemuFindHostdevUSBDevice(hostdev, true, &usb) < 0)
@@ -1435,6 +1444,10 @@ int qemuDomainAttachHostUsbDevice(virQEMUDriverPtr driver,
added = true;
virUSBDeviceListSteal(list, usb);
+ if (qemuSetupHostdevCGroup(vm, hostdev) < 0)
+ goto cleanup;
+ teardowncgroup = true;
+
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, -1) < 0)
goto cleanup;
@@ -1461,6 +1474,10 @@ int qemuDomainAttachHostUsbDevice(virQEMUDriverPtr driver,
ret = 0;
cleanup:
+ if (ret < 0 &&
+ teardowncgroup &&
+ qemuTeardownHostdevCgroup(vm, hostdev) < 0)
+ VIR_WARN("Unable to remove host device cgroup ACL on hotplug fail");
if (added)
virUSBDeviceListSteal(driver->activeUsbHostdevs, usb);
virUSBDeviceFree(usb);
@@ -1478,6 +1495,7 @@ qemuDomainAttachHostScsiDevice(virQEMUDriverPtr driver,
qemuDomainObjPrivatePtr priv = vm->privateData;
char *devstr = NULL;
char *drvstr = NULL;
+ bool teardowncgroup = false;
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE) ||
!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) ||
@@ -1498,6 +1516,10 @@ qemuDomainAttachHostScsiDevice(virQEMUDriverPtr driver,
return -1;
}
+ if (qemuSetupHostdevCGroup(vm, hostdev) < 0)
+ goto cleanup;
+ teardowncgroup = true;
+
if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, -1) < 0)
goto cleanup;
@@ -1535,8 +1557,11 @@ qemuDomainAttachHostScsiDevice(virQEMUDriverPtr driver,
ret = 0;
cleanup:
- if (ret < 0)
+ if (ret < 0) {
qemuDomainReAttachHostScsiDevices(driver, vm->def->name, &hostdev, 1);
+ if (teardowncgroup && qemuTeardownHostdevCgroup(vm, hostdev) < 0)
+ VIR_WARN("Unable to remove host device cgroup ACL on hotplug fail");
+ }
VIR_FREE(drvstr);
VIR_FREE(devstr);
return ret;
@@ -1553,12 +1578,9 @@ int qemuDomainAttachHostDevice(virQEMUDriverPtr driver,
return -1;
}
- if (qemuSetupHostdevCGroup(vm, hostdev) < 0)
- return -1;
-
if (virSecurityManagerSetHostdevLabel(driver->securityManager,
vm->def, hostdev, NULL) < 0)
- goto cleanup;
+ return -1;
switch (hostdev->source.subsys.type) {
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
@@ -1592,10 +1614,6 @@ error:
if (virSecurityManagerRestoreHostdevLabel(driver->securityManager,
vm->def, hostdev, NULL) < 0)
VIR_WARN("Unable to restore host device labelling on hotplug fail");
-
-cleanup:
- if (qemuTeardownHostdevCgroup(vm, hostdev) < 0)
- VIR_WARN("Unable to remove host device cgroup ACL on hotplug fail");
return -1;
}
--
1.8.4.3
11 years
Re: [libvirt] [Qemu-devel] -vga std vs. -device VGA
by Eric Blake
[adding libvirt]
On 11/13/2013 10:01 PM, Alexey Kardashevskiy wrote:
> Hi everyone.
>
> Here is a problem with the SPAPR machine and a libvirt's habit to use
> "-nodefaults".
>
> When we run QEMU with "-vga std", a VGA device is created from the
> machine_init callback and if VGA is added, then we automatically add a PCI
> USB OHCI adapter with a keyboard and everybody (SLOF, yaboot, guest kernel)
> is happy - there are both input and output devices.
>
> However libvirt uses "-device VGA" to create a VGA device. In this case the
> actual VGA device is created in vl.c and we (SPAPR) do not have control
> over this process so we do not automatically create anything in addition to
> VGA. As a result, yaboot fails as there is no input device.
>
> x86 creates a whole bunch of various devices including a keyboard
> controller (i8042) even with "-nodefaults" but this is not true for SPAPR.
Then libvirt needs to be taught to provide the same devices via -device
that would be present during -vga.
>
> Since we (POWERPC folks) want everything to work as close to x86 as
> possible, we need to do something about it :)
Hmm, but adding automatic devices in a future qemu release compared to
what you do now could be a regression - once libvirt is taught how to
provide the correct devices for the qemu that exists now, wouldn't that
mean that your automatic device adding creates duplicates?
Libvirt uses -nodefaults for a reason - we really don't like automatic
devices (especially when the set of WHAT is automatic is prone to change
between qemu builds), and would much rather call out everything
explicitly so that we can guarantee guest ABI stability across qemu
upgrades.
>
> So the question is - is there any proper (i. e. qemu-upstreamable) way to
> detect a VGA device presence and create additional devices (OHCI, keyboard,
> mouse) as "-vga" does it now? The machine reset callback is too late for that.
>
> Or we should just print an error (in QEMU or SLOF) and do nothing and let
> the user configure all required devices in libvirt?
I'm in favor of printing an error if not enough devices were supplied,
and fixing libvirt to supply the correct devices when it doesn't use -vga.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
11 years
[libvirt] [PATCHv3] maint: Kill usage of atoi()
by Peter Krempa
Kill the use of atoi() and introduce syntax check to forbid it and it's
friends (atol, atoll, atof, atoq).
Also fix a typo in variable name holding the cylinders count of a disk
pool (apparently unused).
examples/domsuspend/suspend.c will need a larger scale refactor as the
whole example file is broken thus it will be exempted from the syntax
check for now.
---
Notes:
Version 3:
- add TODO to examples/domsuspend/suspend.c to remove the exemption of the syntax check
- exemption rule made specific for this file only
cfg.mk | 9 +++++++++
examples/domsuspend/suspend.c | 1 +
src/conf/storage_conf.h | 2 +-
src/qemu/qemu_command.c | 8 ++++++--
src/storage/storage_backend_disk.c | 14 +++++++++-----
src/xen/xend_internal.c | 17 +++++++++++++----
6 files changed, 39 insertions(+), 12 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index befd231..838934a 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -869,6 +869,12 @@ sc_prohibit_getenv:
halt='Use virGetEnv{Allow,Block}SUID instead of getenv' \
$(_sc_search_regexp)
+sc_prohibit_atoi:
+ @prohibit='\bato(i|f|l|ll|q) *\(' \
+ halt='Use virStrToLong* instead of atoi, atol, atof, atoq, atoll' \
+ $(_sc_search_regexp)
+
+
# We don't use this feature of maint.mk.
prev_version_file = /dev/null
@@ -1040,3 +1046,6 @@ exclude_file_name_regexp--sc_prohibit_int_ijk = \
exclude_file_name_regexp--sc_prohibit_getenv = \
^tests/.*\.[ch]$$
+
+exclude_file_name_regexp--sc_prohibit_atoi= \
+ ^examples/domsuspend/suspend.c$$
diff --git a/examples/domsuspend/suspend.c b/examples/domsuspend/suspend.c
index 6a0f5c9..5f7a890 100644
--- a/examples/domsuspend/suspend.c
+++ b/examples/domsuspend/suspend.c
@@ -104,6 +104,7 @@ int main(int argc, char **argv) {
}
if (argc > 1) {
+ /* TODO: remove exclusion of this file from syntax check denying atoi */
id = atoi(argv[1]);
}
if (id == 0) {
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index f062bd8..05c291e 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -227,7 +227,7 @@ struct _virStoragePoolSourceDevice {
* the geometry data is needed
*/
struct _geometry {
- int cyliders;
+ int cylinders;
int heads;
int sectors;
} geometry;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 966aa0d..25beedf 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3663,8 +3663,12 @@ qemuBuildDriveURIString(virConnectPtr conn,
if (disk->src && virAsprintf(&volimg, "/%s", disk->src) < 0)
goto cleanup;
- if (disk->hosts->port) {
- port = atoi(disk->hosts->port);
+ if (disk->hosts->port &&
+ virStrToLong_i(disk->hosts->port, NULL, 0, &port) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("failed to parse network port '%s'"),
+ disk->hosts->port);
+ goto cleanup;
}
if (disk->hosts->socket &&
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index 4e53ec5..a7a7d0e 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -280,12 +280,16 @@ virStorageBackendDiskMakePoolGeometry(virStoragePoolObjPtr pool,
char **const groups,
void *data ATTRIBUTE_UNUSED)
{
+ virStoragePoolSourceDevicePtr device = &(pool->def->source.devices[0]);
+ if (virStrToLong_i(groups[0], NULL, 0, &device->geometry.cylinders) < 0 ||
+ virStrToLong_i(groups[1], NULL, 0, &device->geometry.heads) < 0 ||
+ virStrToLong_i(groups[2], NULL, 0, &device->geometry.sectors) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Failed to create disk pool geometry"));
+ return -1;
+ }
- pool->def->source.devices[0].geometry.cyliders = atoi(groups[0]);
- pool->def->source.devices[0].geometry.heads = atoi(groups[1]);
- pool->def->source.devices[0].geometry.sectors = atoi(groups[2]);
-
- return 0;
+ return 0;
}
static int
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index dc57350..771288c 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -290,10 +290,19 @@ xend_req(int fd, char **content)
if (STREQ(buffer, "\r\n"))
break;
- if (istartswith(buffer, "Content-Length: "))
- content_length = atoi(buffer + 16);
- else if (istartswith(buffer, "HTTP/1.1 "))
- retcode = atoi(buffer + 9);
+ if (istartswith(buffer, "Content-Length: ")) {
+ if (virStrToLong_i(buffer + 16, NULL, 10, &content_length) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("failed to parse Xend response content length"));
+ return -1;
+ }
+ } else if (istartswith(buffer, "HTTP/1.1 ")) {
+ if (virStrToLong_i(buffer + 9, NULL, 10, &retcode) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("failed to parse Xend response return code"));
+ return -1;
+ }
+ }
}
VIR_FREE(buffer);
--
1.8.4.3
11 years
[libvirt] [PATCH] qemuMonitorIO: Don't use @mon after it's unrefed
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=1018267
The aim of virObject refing and urefing is to tell where the object is
to be used and when is no longer needed. Hence any object shouldn't be
used after it has been unrefed, as we might be the last to hold the
reference. The better way is to call virObjectUnref() *after* the last
object usage. In this specific case, the monitor EOF handler was called
after the qemuMonitorIO called virObjectUnref. Not only that @mon was
disposed (which is not used in the handler anyway) but the @mon->vm
which is causing a SIGSEGV:
2013-11-15 10:17:54.425+0000: 20110: error : qemuMonitorIO:688 : internal error: early end of file from monitor: possible problem:
qemu-kvm: -incoming tcp:01.01.01.0:49152: Failed to bind socket: Cannot assign requested address
Program received signal SIGSEGV, Segmentation fault.
qemuProcessHandleMonitorEOF (mon=<optimized out>, vm=0x7fb728004170) at qemu/qemu_process.c:299
299 if (priv->beingDestroyed) {
(gdb) p *priv
Cannot access memory at address 0x0
(gdb) p vm
$1 = (virDomainObj *) 0x7fb728004170
(gdb) p *vm
$2 = {parent = {parent = {magic = 3735928559, refs = 0, klass = 0xdeadbeef}, lock = {lock = {__data = {__lock = 2, __count = 0, __owner = 20110, __nusers = 1, __kind = 0, __spins = 0, __list = {__prev = 0x0,
__next = 0x0}}, __size = "\002\000\000\000\000\000\000\000\216N\000\000\001", '\000' <repeats 26 times>, __align = 2}}}, pid = 0, state = {state = 0, reason = 0}, autostart = 0, persistent = 0,
updated = 0, def = 0x0, newDef = 0x0, snapshots = 0x0, current_snapshot = 0x0, hasManagedSave = false, privateData = 0x0, privateDataFreeFunc = 0x0, taint = 304}
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_monitor.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 30315b3..935f140 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -721,33 +721,33 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque) {
/* We have to unlock to avoid deadlock against command thread,
* but is this safe ? I think it is, because the callback
* will try to acquire the virDomainObjPtr mutex next */
if (eof) {
qemuMonitorEofNotifyCallback eofNotify = mon->cb->eofNotify;
virDomainObjPtr vm = mon->vm;
/* Make sure anyone waiting wakes up now */
virCondSignal(&mon->notify);
virObjectUnlock(mon);
- virObjectUnref(mon);
VIR_DEBUG("Triggering EOF callback");
(eofNotify)(mon, vm, mon->callbackOpaque);
+ virObjectUnref(mon);
} else if (error) {
qemuMonitorErrorNotifyCallback errorNotify = mon->cb->errorNotify;
virDomainObjPtr vm = mon->vm;
/* Make sure anyone waiting wakes up now */
virCondSignal(&mon->notify);
virObjectUnlock(mon);
- virObjectUnref(mon);
VIR_DEBUG("Triggering error callback");
(errorNotify)(mon, vm, mon->callbackOpaque);
+ virObjectUnref(mon);
} else {
virObjectUnlock(mon);
virObjectUnref(mon);
}
}
static qemuMonitorPtr
qemuMonitorOpenInternal(virDomainObjPtr vm,
int fd,
--
1.8.3.2
11 years
[libvirt] [PATCHv2] maint: Kill usage of atoi()
by Peter Krempa
Kill the use of atoi() and introduce syntax check to forbit it and it's
friends (atol, atoll, atof, atoq).
Also fix a typo in variable name holding the cylinders count of a disk
pool (apparently unused).
---
cfg.mk | 9 +++++++++
src/conf/storage_conf.h | 2 +-
src/qemu/qemu_command.c | 8 ++++++--
src/storage/storage_backend_disk.c | 14 +++++++++-----
src/xen/xend_internal.c | 17 +++++++++++++----
5 files changed, 38 insertions(+), 12 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index befd231..901e307 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -869,6 +869,12 @@ sc_prohibit_getenv:
halt='Use virGetEnv{Allow,Block}SUID instead of getenv' \
$(_sc_search_regexp)
+sc_prohibit_atoi:
+ @prohibit='\bato(i|f|l|ll|q) *\(' \
+ halt='Use virStrToLong* instead of atoi, atol, atof, atoq, atoll' \
+ $(_sc_search_regexp)
+
+
# We don't use this feature of maint.mk.
prev_version_file = /dev/null
@@ -1040,3 +1046,6 @@ exclude_file_name_regexp--sc_prohibit_int_ijk = \
exclude_file_name_regexp--sc_prohibit_getenv = \
^tests/.*\.[ch]$$
+
+exclude_file_name_regexp--sc_prohibit_atoi= \
+ ^examples/.*\.[ch]$$
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index f062bd8..05c291e 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -227,7 +227,7 @@ struct _virStoragePoolSourceDevice {
* the geometry data is needed
*/
struct _geometry {
- int cyliders;
+ int cylinders;
int heads;
int sectors;
} geometry;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 966aa0d..25beedf 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3663,8 +3663,12 @@ qemuBuildDriveURIString(virConnectPtr conn,
if (disk->src && virAsprintf(&volimg, "/%s", disk->src) < 0)
goto cleanup;
- if (disk->hosts->port) {
- port = atoi(disk->hosts->port);
+ if (disk->hosts->port &&
+ virStrToLong_i(disk->hosts->port, NULL, 0, &port) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("failed to parse network port '%s'"),
+ disk->hosts->port);
+ goto cleanup;
}
if (disk->hosts->socket &&
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index 4e53ec5..a7a7d0e 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -280,12 +280,16 @@ virStorageBackendDiskMakePoolGeometry(virStoragePoolObjPtr pool,
char **const groups,
void *data ATTRIBUTE_UNUSED)
{
+ virStoragePoolSourceDevicePtr device = &(pool->def->source.devices[0]);
+ if (virStrToLong_i(groups[0], NULL, 0, &device->geometry.cylinders) < 0 ||
+ virStrToLong_i(groups[1], NULL, 0, &device->geometry.heads) < 0 ||
+ virStrToLong_i(groups[2], NULL, 0, &device->geometry.sectors) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Failed to create disk pool geometry"));
+ return -1;
+ }
- pool->def->source.devices[0].geometry.cyliders = atoi(groups[0]);
- pool->def->source.devices[0].geometry.heads = atoi(groups[1]);
- pool->def->source.devices[0].geometry.sectors = atoi(groups[2]);
-
- return 0;
+ return 0;
}
static int
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index dc57350..771288c 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -290,10 +290,19 @@ xend_req(int fd, char **content)
if (STREQ(buffer, "\r\n"))
break;
- if (istartswith(buffer, "Content-Length: "))
- content_length = atoi(buffer + 16);
- else if (istartswith(buffer, "HTTP/1.1 "))
- retcode = atoi(buffer + 9);
+ if (istartswith(buffer, "Content-Length: ")) {
+ if (virStrToLong_i(buffer + 16, NULL, 10, &content_length) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("failed to parse Xend response content length"));
+ return -1;
+ }
+ } else if (istartswith(buffer, "HTTP/1.1 ")) {
+ if (virStrToLong_i(buffer + 9, NULL, 10, &retcode) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("failed to parse Xend response return code"));
+ return -1;
+ }
+ }
}
VIR_FREE(buffer);
--
1.8.4.3
11 years
[libvirt] [PATCH] Fix migration with qemu 1.6
by whitearchey
QEMU 1.6.0 introduced new migration status: setup
Libvirt does not expect such string in QMP and refuses to migrate with error
"unexpected migration status in setup"
This patch fixes it.
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index a3d986f..4b5fdba 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1644,6 +1644,10 @@ qemuMigrationUpdateJobStatus(virQEMUDriverPtr driver,
_("%s: %s"), job, _("is not active"));
break;
+ case QEMU_MONITOR_MIGRATION_STATUS_SETUP:
+ ret = 0;
+ break;
+
case QEMU_MONITOR_MIGRATION_STATUS_ACTIVE:
priv->job.info.fileTotal = priv->job.status.disk_total;
priv->job.info.fileRemaining = priv->job.status.disk_remaining;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 30315b3..0d4598e 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -114,7 +114,7 @@ VIR_ONCE_GLOBAL_INIT(qemuMonitor)
VIR_ENUM_IMPL(qemuMonitorMigrationStatus,
QEMU_MONITOR_MIGRATION_STATUS_LAST,
- "inactive", "active", "completed", "failed", "cancelled")
+ "inactive", "active", "completed", "failed", "cancelled", "setup")
VIR_ENUM_IMPL(qemuMonitorMigrationCaps,
QEMU_MONITOR_MIGRATION_CAPS_LAST,
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index f893b1f..eabf000 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -397,6 +397,7 @@ enum {
QEMU_MONITOR_MIGRATION_STATUS_COMPLETED,
QEMU_MONITOR_MIGRATION_STATUS_ERROR,
QEMU_MONITOR_MIGRATION_STATUS_CANCELLED,
+ QEMU_MONITOR_MIGRATION_STATUS_SETUP,
QEMU_MONITOR_MIGRATION_STATUS_LAST
};
11 years
[libvirt] Fwd: Re: the case for volatile nwfilters
by Stefan Berger
For some reason this message could not be sent to the list.
On 10/30/2013 05:57 AM, Laine Stump wrote:
> On 10/29/2013 06:33 PM, Dan Kenigsberg wrote:
>> I'd like oVirt to make a more extensive usage of libvirt's nwfilters in
>> order to implement security groups, i.e. which protocol/port/host should
>> be open on an interface.
>>
>> Since oVirt is cetrally-managed by ovirt-engine, filter definitions
>> should be edited there and kept in its database. However, libivrt's
>> domain xml requires to have a locally-defined filter as well:
>>
>> <devices>
>> <interface type='bridge'>
>> <filterref filter='filter-name'/>
>> </interface>
>> </devices>
>>
>> We can leave with it by defining an ad-hoc filter before staring a VM,
>> deleting it after the VM stops, and collecting garbage (due to system
>> crashes) occasionally.
>>
>> It would be nicer if we could instead have just-in-time filter
>> definition such as
>>
>> <devices>
>> <interface type='bridge'>
>> <filter name='nameless'>
>> <rule/>
>> <rule/>
>> <rule/>
>> </filter>
>> </interface>
>> </devices>
>>
>> avoiding nwfilter persistence. Would something like this be beneficial
>> to other libvirt users? Would it be easy to implement within libvirt?
> My first thought when I saw the subject line was of adding a transient
> "define and start" API similar to that used for domains and networks,
> but of course nwfilters have no concept of "start" or "destroy", so they
> wouldn't be able to follow the same semantics as transient domains and
> networks anyway.
>
> Most likely Stefan made nwfilters use in domains all be references to
> the actual nwfilters rather than having them contained in order to 1)
> save duplication in the configuration now, and 2) potentially save
> duplication in the kernel iptables rules in the future. I can see the
> convenience, but wonder how much inefficiency it could lead to.
>
> Structurally it makes sense though, and the xml has conveniently named
> the existing element as <filterref> so that <filter> is still available
> - was there some premonition of this being requested in the future? :-)
>
> I recall that Stefan has been extremely busy elsewhere and unable to
> completely follow libvir-list for awhile, so I'm Cc'ing him - Stefan, do
> you have any opinion/wisdom on this?
>
Why can the client not call nwfilter-define to define a filter and have
the filter referenced from the domain XML?
Also many of the items in the domain XML only become active after a
reboot of the VM (afaik) and I didn't want to change that with nwfilter.
So you can at any time replace the referenced nwfilter and it will be
instantiated when/while the VM is running or rejected if it cannot be
instantiated.
Stefan
11 years
[libvirt] [PATCH 0/6] Fix couple of memleaks
by Michal Privoznik
Couple of patches I had lying around. I expect 4/6 to be controversial a bit.
But it shouldn't be a show stopper for others.
Michal Privoznik (6):
networkBuildDhcpDaemonCommandLine: Don't leak @configstr
networkBuildDhcpDaemonCommandLine: Don't leak @configfile
virPCIDeviceBindToStub: Remove unused @oldDriverPath and
@oldDriverName
virThreadPoolFree: Join worker threads
virDomainEventCallbackListFree: Don't leak @list->callbacks
qemuProcessReconnectHelper: Don't create joinable thread
src/conf/domain_event.c | 1 +
src/network/bridge_driver.c | 2 ++
src/qemu/qemu_process.c | 2 +-
src/util/virpci.c | 4 ----
src/util/virthreadpool.c | 9 +++++++++
5 files changed, 13 insertions(+), 5 deletions(-)
--
1.8.3.2
11 years