[libvirt] [PATCH] storage: avoid missing break in default branch of switch statement
by ajia@redhat.com
Detected by Coverity.
* src/storage/storage_backend.c: avoid missing break in default branch.
https://bugzilla.redhat.com/show_bug.cgi?id=721335
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
src/storage/storage_backend.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 6243d1e..004bc66 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -819,6 +819,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
virCommandAddArgFormat(cmd, "%lluK", size_arg);
if (do_encryption)
virCommandAddArg(cmd, "-e");
+ break;
}
} else {
virCommandAddArgList(cmd, "create", "-f", type,
--
1.7.1
13 years, 3 months
[libvirt] libvirt-0.9.1 to 0.9.3-r1: managedsave/save won't start/restore at saved state
by Nicolas Sebrecht
I'm seeing strange behaviour, here. Any guests saved using both
managedsave and save commands from virsh won't restore at saved state. A
new full boot sequence happen.
- Tested against libvirt v0.9.1, v0.9.2, v0.9.3-r1 (Gentoo)
- Confirmed on three different hosts Gentoo amd64 systems.
- Tested with gentoo and ubuntu guests.
- Nothing relevant in /var/log/libvirt/libvirt.log or
/var/log/libvirt/qemu/<dom>.log
The "state file" /var/lib/libvirt/qemu/save/<dom>.save exists and is
deleted when 'virsh start' is called.
The new boot sequence is confirmed by :
- VNC console checks
- previous screen sessions lost
- uptime
I've open a bug at https://bugs.gentoo.org/show_bug.cgi?id=376333 but
had no answer.
Any idea on what could happen or how to inspect it?
--
Nicolas Sebrecht
13 years, 3 months
[libvirt] [PATCH 1/3] qemu: avoid dead store in qemuProcessStart
by ajia@redhat.com
Value stored to 'ret' is never read, in fact, 'cleanup' section will
directly return -1 when function is fail, so remove this dead assignment.
* src/qemu/qemu_process.c: kill dead assignment.
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
src/qemu/qemu_process.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 88cefd5..b0d2149 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2908,13 +2908,11 @@ int qemuProcessStart(virConnectPtr conn,
VIR_DEBUG("Writing early domain status to disk");
if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0) {
- ret = -1;
goto cleanup;
}
VIR_DEBUG("Waiting for handshake from child");
if (virCommandHandshakeWait(cmd) < 0) {
- ret = -1;
goto cleanup;
}
@@ -2943,7 +2941,6 @@ int qemuProcessStart(virConnectPtr conn,
VIR_DEBUG("Labelling done, completing handshake to child");
if (virCommandHandshakeNotify(cmd) < 0) {
- ret = -1;
goto cleanup;
}
VIR_DEBUG("Handshake complete, child running");
--
1.7.1
13 years, 3 months
[libvirt] [PATCH] qemu: Avoid overwriting errors from virGetHostname
by Jiri Denemark
---
src/qemu/qemu_migration.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 7aeea69..4d0e062 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -257,7 +257,7 @@ qemuMigrationCookieNew(virDomainObjPtr dom)
memcpy(mig->uuid, dom->def->uuid, VIR_UUID_BUFLEN);
if (!(mig->localHostname = virGetHostname(NULL)))
- goto no_memory;
+ goto error;
if (virGetHostUUID(mig->localHostuuid) < 0) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unable to obtain host UUID"));
--
1.7.6
13 years, 3 months
[libvirt] Disk snapshot mode proposal: patch for storing the snapshot mode from .vmx to .xml
by computernews@rambler.ru
Hello,
Few days ago I have proposed to implement the snapshot mode
functionality for esx/vpx:
|Mail subject: "[libvirt] VMWare "independent disk" processing needed"
Sent: "04.07.2011"
Sender: "computernews(a)rambler.ru"
|
What I meant is to allow "libvirt" to handle (see full .vmx attached) :
|vmx: scsi0:1.mode = "independent-persistent"
vmx: scsi0:2.mode = "independent-nonpersistent"|
As none has responded I decided to start implementing that myself.
By now I have the managed to implement the .vmx -> .xml part. According
to "General tips for contributing patches"
(http://libvirt.org/hacking.html#patches) I am sending the patch back to
the community as early as it has sense as I still hope to contribute
this feature to the community. It builds and has been functionally
tested. I also tried my best to stick to coding conventions applied on
the project. So I hope my patch will not take long time to analyze for
someone experienced enough.
I saw someone already has started (put few comments about snapshot modes
in src/vmx/vmx.c). So tried to undestand an original idea and keep up
with it. I hope I was not wrong there.
I am willing to keep working in this direction. So if someone would be
so kind to take a look at my efforts and provide a feedback - it would
be very nice and, I hope, useful for the rest of the project.
Attached are:
1. patch itself
2. ".vmx" file I am testing on
3. ".xml" file produced by my changes
Looking forward to hear any feedback/criticism/advices. Thanks in advance.
Best regards
Oleh Paliy
13 years, 3 months
[libvirt] [PATCH] qemu: avoid pass null pointer as an argument
by ajia@redhat.com
In fact, 'pos' is always -1, this reason is because qemuProcessStart function
assigns -1 to 'pos' variable then call qemuProcessWaitForMonitor, meanwhile,
qemuProcessAttach function also call qemuProcessWaitForMonitor and directly
pass -1 as an argument, so if (pos != -1) statement can't been run for ever,
it also means we can't allocate memory to 'buf' variable, that is, 'buf' is
a initial value NULL, however, the function
qemuProcessReadLogFD(logfd, buf, buf_size, strlen(buf)) will be called
on 'cleanup' section, null pointer passed as an argument.
* src/qemu/qemu_process.c: avoid null pointer passed as an argument to a
'nonnull' parameter.
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
src/qemu/qemu_process.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index b0d2149..570992d 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1189,6 +1189,11 @@ qemuProcessWaitForMonitor(struct qemud_driver* driver,
goto closelog;
}
+ if (VIR_ALLOC_N(buf, buf_size) < 0) {
+ virReportOOMError();
+ return -1;
+ }
+
VIR_DEBUG("Connect monitor to %p '%s'", vm, vm->def->name);
if (qemuConnectMonitor(driver, vm) < 0) {
goto cleanup;
--
1.7.5.1
13 years, 3 months
[libvirt] PCI devices passthough to LXC containers using libvirt
by Devendra K. Modium
Hi All
Please let me know if anyone have given access to
PCI devices for a LXC container.
I have tried getting the xml from
"virsh nodedev-dumpxml pci_device" and
added to the libvirt xml file as shown below
<device>
<name>pci_0000_03_00_0</name>
<parent>pci_0000_00_03_0</parent>
<driver>
<name>nvidia</name>
</driver>
<capability type='pci'>
<domain>0</domain>
<bus>3</bus>
<slot>0</slot>
<function>0</function>
<product id='0x06fd' />
<vendor id='0x10de'>nVidia Corporation</vendor>
</capability>
</device>
But it didn't work. I see the logs and it says
couldn't get physical and virtual functions of these devices with error
get_physical_function_linux:323 : Attempting to get SR IOV physical function for device with sysfs path '/sys/devices/pci0000:00/0000:00:00.0'
16:48:34.033: 13802: debug : get_sriov_function:270 : Attempting to resolve device path from device link '/sys/devices/pci0000:00/0000:00:00.0/physfn'
16:48:34.033: 13802: debug : get_sriov_function:274 : SR IOV function link '/sys/devices/pci0000:00/0000:00:00.0/physfn' does not exist
16:48:34.033: 13802: debug : get_virtual_functions_linux:348 : Attempting to get SR IOV virtual functions for devicewith sysfs path '/sys/devices/pci0000:00/0000:00:00.0'
If anyone got some guidelines how to debug, please let me know.
Thanks in advance
Regards
Devendra
13 years, 3 months
[libvirt] [PATCH] qemu: avoid double free in qemuProcessWaitForMonitor
by ajia@redhat.com
Reported by Eric.
* src/qemu/qemu_process.c: avoid double free 'buf' on closelog lable.
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
src/qemu/qemu_process.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index b0d2149..5ef25cb 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1225,8 +1225,6 @@ cleanup:
}
closelog:
- VIR_FREE(buf);
-
if (VIR_CLOSE(logfd) < 0) {
char ebuf[1024];
VIR_WARN("Unable to close logfile: %s",
--
1.7.1
13 years, 3 months
[libvirt] qemu-kvm>=0.14 is unable to boot
by Zdenek Styblik
Hello,
I'm wondering what might be behind qemu-kvm>=0.14 is unable to boot
except from PXE and perhaps virtio HDD.
I mean, is somebody running qemu-kvm>=0.14 and libvirt-0.9.3/0.9.4
around here, thus is my setup broken?
Thanks,
Zdenek
--
Zdenek Styblik
email: stybla(a)turnovfree.net
jabber: stybla(a)jabber.turnovfree.net
13 years, 3 months
[libvirt] [PATCH] Set qemu migration speed unlimited when migrating to file
by Jim Fehlig
Discussed previously:
https://www.redhat.com/archives/libvir-list/2011-August/msg00166.html
The qemu migration speed default is 32MiB/s as defined in migration.c
/* Migration speed throttling */
static int64_t max_throttle = (32 << 20);
There is no reason to throttle migration when targeting a file. For
dump and save operations, set migration speed to unlimited prior to
migration and restore to default value after migration. Default units
is MB for migrate_set_speed monitor command, so (INT64_MAX / (1024 * 1024))
is used for unlimited migration speed.
Tested with both json and text monitors.
---
src/qemu/qemu_migration.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 7aeea69..4542289 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2676,6 +2676,13 @@ qemuMigrationToFile(struct qemud_driver *driver, virDomainObjPtr vm,
virCommandPtr cmd = NULL;
int pipeFD[2] = { -1, -1 };
+ /* No need for qemu default of 32MiB/s when migrating to a file.
+ Default speed unit is MB, so set to unlimited with INT64_MAX / 1M.
+ Failure to change migration speed is not fatal. */
+ qemuDomainObjEnterMonitor(driver, vm);
+ qemuMonitorSetMigrationSpeed(priv->mon, INT64_MAX / (1024 * 1024));
+ qemuDomainObjExitMonitor(driver, vm);
+
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD) &&
(!compressor || pipe(pipeFD) == 0)) {
/* All right! We can use fd migration, which means that qemu
@@ -2783,6 +2790,11 @@ qemuMigrationToFile(struct qemud_driver *driver, virDomainObjPtr vm,
ret = 0;
cleanup:
+ /* Restore migration speed to 32MiB/s default */
+ qemuDomainObjEnterMonitor(driver, vm);
+ qemuMonitorSetMigrationSpeed(priv->mon, (32 << 20));
+ qemuDomainObjExitMonitor(driver, vm);
+
VIR_FORCE_CLOSE(pipeFD[0]);
VIR_FORCE_CLOSE(pipeFD[1]);
virCommandFree(cmd);
--
1.7.5.4
13 years, 3 months