[libvirt] [PATCH] virsh-nodedev: Avoid spurious errors
by Michal Privoznik
Our public free functions explicitly don't accept NULL pointers
(sigh). Therefore, callers must do something like this:
if (dev)
virNodeDeviceFree(dev);
And we are not doing that on two places I've found. This leads to
dummy error message thrown by virsh:
virsh # nodedev-dumpxml nonexistent-device
error: Could not find matching device 'nonexistent-device'
error: invalid node device pointer in virNodeDeviceFree
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/virsh-nodedev.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
index a35387a..46e0045 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -162,7 +162,8 @@ cmdNodeDeviceDestroy(vshControl *ctl, const vshCmd *cmd)
ret = true;
cleanup:
virStringFreeList(arr);
- virNodeDeviceFree(dev);
+ if (dev)
+ virNodeDeviceFree(dev);
return ret;
}
@@ -571,7 +572,8 @@ cmdNodeDeviceDumpXML(vshControl *ctl, const vshCmd *cmd)
cleanup:
virStringFreeList(arr);
VIR_FREE(xml);
- virNodeDeviceFree(device);
+ if (device)
+ virNodeDeviceFree(device);
return ret;
}
--
2.0.0
10 years, 7 months
[libvirt] [libvirt-php] libvirt_domain_new Create a slow vm
by Mario Di Ture
Hi,
I've tested this script on centos 6.5 (libvirt-0.10.2, qemu-kvm-0.12.1.2)
and
ubuntu server 14.04 (libvirt 1.2.2, qemu-kvm 2.0.0) with the same result.
The created vm is very slow compared to the vm created with virt-manager,
with the same features/devices on the same host.
Can you suggest any configuration that can avoid that slowness?
With regards
Mario D.
<?php
$conn = libvirt_connect('null', false);
$name="testvm";
$arch="x86_64";
$memMB=1024;
$maxmemMB=1536;
$vcpus=1;
$iso_image="/home/iso/CentOS-6.5-x86_64-minimal.iso";
$disk1 = array(
"path" => "/home/vm/centos-script.raw",
"driver" => "raw",
"bus" => "virtio",
"dev" => "hda",
"size" => "6G",
"flags" => VIR_DOMAIN_DISK_FILE |
VIR_DOMAIN_DISK_ACCESS_ALL );
$disks = array( $disk1 );
$network1 = array(
'mac' => '00:11:22:33:44:55',
'network' => 'default',
'model' => 'e1000'
);
$networks = array( $network1 );
$flags=VIR_DOMAIN_FLAG_FEATURE_ACPI;
$newdom=libvirt_domain_new($conn, $name, $arch, $memMB, $maxmemMB, $vcpus,
$iso_image, $disks, $networks, $flags);
print_r($newdom);
?>
10 years, 7 months
[libvirt] parallels: add 2 functions needed by OpenStack
by Alexander Burluka
Hello,
I would like to contribute in Libvirt development. Parallels team continues working
on driver to make it compatible with OpenStack. So, this patches are part of our
goal. I would gracefully accept your comments and remarks.
Thank you!
--
Regards,
Alexander Burluka
10 years, 7 months
[libvirt] [PATCH] Don't use AI_ADDRCONFIG when binding to wildcard addresses
by Ján Tomko
https://bugzilla.redhat.com/show_bug.cgi?id=1098659
With parallel boot, network addresses might not yet be assigned [1],
but binding to wildcard addresses should work.
For non-wildcard addresses, ADDRCONFIG is still used. Document this
in libvirtd.conf.
[1] http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
---
daemon/libvirtd.conf | 4 ++++
src/rpc/virnetsocket.c | 28 ++++++++++++++++++++++++++--
2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/daemon/libvirtd.conf b/daemon/libvirtd.conf
index aeba11d..e5856d4 100644
--- a/daemon/libvirtd.conf
+++ b/daemon/libvirtd.conf
@@ -48,6 +48,10 @@
# Override the default configuration which binds to all network
# interfaces. This can be a numeric IPv4/6 address, or hostname
#
+# If the libvirtd service is started in parallel with network
+# startup (e.g. with systemd), binding to addresses other than
+# the wildcards (0.0.0.0/::) might not be available yet.
+#
#listen_addr = "192.168.0.1"
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index a7e1783..87b39f2 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -226,15 +226,29 @@ int virNetSocketNewListenTCP(const char *nodename,
struct addrinfo hints;
int fd = -1;
size_t i;
- int addrInUse = false;
+ bool addrInUse = false;
+ bool familyNotSupported = false;
+ virSocketAddr tmp_addr;
*retsocks = NULL;
*nretsocks = 0;
memset(&hints, 0, sizeof(hints));
- hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
+ hints.ai_flags = AI_PASSIVE;
hints.ai_socktype = SOCK_STREAM;
+ /* Don't use ADDRCONFIG for binding to the wildcard address.
+ * Just catch the error returned by socket() if the system has
+ * no IPv6 support.
+ *
+ * This allows libvirtd to be started in parallel with the network
+ * startup in most cases.
+ */
+ if (nodename &&
+ !(virSocketAddrParse(&tmp_addr, nodename, AF_UNSPEC) > 0 &&
+ virSocketAddrIsWildcard(&tmp_addr)))
+ hints.ai_flags = AI_ADDRCONFIG;
+
int e = getaddrinfo(nodename, service, &hints, &ai);
if (e != 0) {
virReportError(VIR_ERR_SYSTEM_ERROR,
@@ -251,6 +265,11 @@ int virNetSocketNewListenTCP(const char *nodename,
if ((fd = socket(runp->ai_family, runp->ai_socktype,
runp->ai_protocol)) < 0) {
+ if (errno == EAFNOSUPPORT) {
+ familyNotSupported = true;
+ runp = runp->ai_next;
+ continue;
+ }
virReportSystemError(errno, "%s", _("Unable to create socket"));
goto error;
}
@@ -307,6 +326,11 @@ int virNetSocketNewListenTCP(const char *nodename,
fd = -1;
}
+ if (nsocks == 0 && familyNotSupported) {
+ virReportSystemError(EAFNOSUPPORT, "%s", _("Unable to bind to port"));
+ goto error;
+ }
+
if (nsocks == 0 &&
addrInUse) {
virReportSystemError(EADDRINUSE, "%s", _("Unable to bind to port"));
--
1.8.3.2
10 years, 7 months
[libvirt] [PATCH] leaseshelper: Include locale.h
by Michal Privoznik
The commit baafe668 introduces this new helper utility. As in all
our programs, there's setlocale() called at the beginning of
main(). However, this source file don't include locale.h file
which causes build errors on some systems (e.g. mine).
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/network/leaseshelper.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c
index e53a73c..eb695e4 100644
--- a/src/network/leaseshelper.c
+++ b/src/network/leaseshelper.c
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
+#include <locale.h>
#include "virutil.h"
#include "virthread.h"
--
2.0.0
10 years, 7 months
[libvirt] [PATCH 0/4] qemu: Some more device unplug fixes
by Jiri Denemark
This series depends on "qemu: Process DEVICE_DELETED event in a separate
thread" series I sent yesterday.
Jiri Denemark (4):
qemu: Unref cfg when detaching hostdev interface
qemu: Remove interface backend only after frontend is gone
qemu: Remove disk backend only after frontend is gone
qemu: Remove character device backend only after frontend is gone
src/qemu/qemu_hotplug.c | 122 ++++++++++++++++++++++++------------------------
1 file changed, 60 insertions(+), 62 deletions(-)
--
1.9.3
10 years, 7 months
[libvirt] [PATCH] Fix build on freebsd
by Pavel Hrdina
On freebsd there isn't known "setlocale" so we have to include locale.h
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
Pushed under trivial rule
src/network/leaseshelper.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c
index e53a73c..b6f6c32 100644
--- a/src/network/leaseshelper.c
+++ b/src/network/leaseshelper.c
@@ -25,6 +25,7 @@
#include <config.h>
+#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
--
1.8.5.5
10 years, 7 months
[libvirt] [PATCH 0/2] qemu: Process DEVICE_DELETED event in a separate thread
by Jiri Denemark
Jiri Denemark (2):
qemu: Finish device removal in the original thread
qemu: Process DEVICE_DELETED event in a separate thread
src/qemu/qemu_domain.h | 2 ++
src/qemu/qemu_driver.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
src/qemu/qemu_hotplug.c | 44 +++++++++++++++++++++++++++++++++-----------
src/qemu/qemu_hotplug.h | 2 +-
src/qemu/qemu_process.c | 30 +++++++++++++++++++++---------
5 files changed, 103 insertions(+), 23 deletions(-)
--
1.9.3
10 years, 7 months
[libvirt] Bug: iohelper drops I/O error messages
by Jason J. Herne
During a recent managed save operation I received the following error
message:
error: operation failed: domain save job: unexpectedly failed.
It turns out that I had run out of disk space. After a brief investigation I
discovered that libvirt_iohelper is exec'ed and is used to handle all
I/O during
a (Qemu) managed save operation. While iohelper appears to be set up to log
error conditions when they occur, for some reason the logging is getting
lost.
I'm hoping someone can help figure out why these errors are getting lost. It
would be nice to present a useful error message to the user when a
managed save
fails because of an I/O error.
--
-- Jason J. Herne (jjherne(a)linux.vnet.ibm.com)
10 years, 7 months