[libvirt] [PATCH] Name domain managed state file with domain UUID
by Osier Yang
A domain managed state file named with domain name can cause
problem if the domain is undefined, and a later new domain is
created with the same name. The new domain will not be able to
start.
---
src/libxl/libxl_driver.c | 4 +++-
src/qemu/qemu_driver.c | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 586d562..7e4e261 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -220,8 +220,10 @@ libxlDoNodeGetInfo(libxlDriverPrivatePtr driver, virNodeInfoPtr info)
static char *
libxlDomainManagedSavePath(libxlDriverPrivatePtr driver, virDomainObjPtr vm) {
char *ret;
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+ virUUIDFormat(vm->def->uuid, uuidstr);
- if (virAsprintf(&ret, "%s/%s.save", driver->saveDir, vm->def->name) < 0) {
+ if (virAsprintf(&ret, "%s/%s.save", driver->saveDir, uuidstr) < 0) {
virReportOOMError();
return NULL;
}
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a05a1ee..db77615 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2398,8 +2398,10 @@ cleanup:
static char *
qemuDomainManagedSavePath(struct qemud_driver *driver, virDomainObjPtr vm) {
char *ret;
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+ virUUIDFormat(vm->def->uuid, uuidstr);
- if (virAsprintf(&ret, "%s/%s.save", driver->saveDir, vm->def->name) < 0) {
+ if (virAsprintf(&ret, "%s/%s.save", driver->saveDir, uuidstr) < 0) {
virReportOOMError();
return(NULL);
}
--
1.7.6
13 years, 5 months
[libvirt] [PATCH] RPC: fix argument's name
by Wen Congyang
---
src/rpc/virnetsocket.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 4b0c2ee..3392047 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -1042,8 +1042,8 @@ int virNetSocketAccept(virNetSocketPtr sock, virNetSocketPtr *clientsock)
}
-static void virNetSocketEventHandle(int fd ATTRIBUTE_UNUSED,
- int watch ATTRIBUTE_UNUSED,
+static void virNetSocketEventHandle(int watch ATTRIBUTE_UNUSED,
+ int fd ATTRIBUTE_UNUSED,
int events,
void *opaque)
{
--
1.7.1
13 years, 5 months
[libvirt] [PATCH] kill vm if saving config failed in v3 protocol
by Wen Congyang
If virDomainSaveConfig() failed, we will return NULL to source,
and the vm is still available to restart during confirm() step in
v3 protocol. So we should kill it off in qemuMigrationFinish().
In v2 protocol, we should not set vm to NULL, because we hold
a reference of vm and should unrefernce it.
---
src/qemu/qemu_migration.c | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 800b714..fa98cba 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2471,7 +2471,7 @@ qemuMigrationFinish(struct qemud_driver *driver,
if (!virDomainObjIsActive(vm)) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("guest unexpectedly quit"));
- goto cleanup;
+ goto endjob;
}
qemuMigrationVPAssociatePortProfiles(vm->def);
@@ -2491,7 +2491,24 @@ qemuMigrationFinish(struct qemud_driver *driver,
* Return a NULL dom pointer, and hope that this is a rare
* situation and management tools are smart.
*/
- vm = NULL;
+
+ /*
+ * In v3 protocol, the source VM is still available to
+ * restart during confirm() step, so we kill it off
+ * now.
+ * In v2 protocol, the source is dead, so we leave
+ * target in paused state, in case admin can fix
+ * things up
+ */
+ if (v3proto) {
+ qemuProcessStop(driver, vm, 1, VIR_DOMAIN_SHUTOFF_FAILED);
+ qemuAuditDomainStop(vm, "failed");
+ if (newVM) {
+ if (qemuDomainObjEndJob(vm) > 0)
+ virDomainRemoveInactive(&driver->domains, vm);
+ vm = NULL;
+ }
+ }
goto endjob;
}
--
1.7.1
13 years, 5 months
[libvirt] [PATCH] fix typo error
by Wen Congyang
---
docs/news.html.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/docs/news.html.in b/docs/news.html.in
index 6c94afc..625e3b9 100644
--- a/docs/news.html.in
+++ b/docs/news.html.in
@@ -151,7 +151,7 @@ and check the <a href="http://libvirt.org/git/?p=libvirt.git;a=log">GIT log</a>
Support automatic creation of leases for disks in sanlock (Daniel P. Berrange),<br/>
Support loading a configuration file for sanlock plugin (Daniel P. Berrange),<br/>
Allow per-driver config file for lock manager plugins (Daniel P. Berrange),<br/>
- network: add domain to unqualified names defined with <host&g; (Laine Stump),<br/>
+ network: add domain to unqualified names defined with <host> (Laine Stump),<br/>
Convert libvirtd over to the new RPC handling APIs (Daniel P. Berrange),<br/>
Convert the remote driver to new RPC client APIs (Daniel P. Berrange),<br/>
Add XDR_CFLAGS to libvirt-net-rpc.la library (Daniel P. Berrange),<br/>
--
1.7.1
13 years, 5 months
[libvirt] [PATCH] Name domain managed state file with domain UUID
by Osier Yang
A domain managed state file named with domain name can cause
problem if the domain is undefined, and a later new domain is
created with the same name. The new domain will not be able to
start.
---
src/libxl/libxl_driver.c | 4 +++-
src/qemu/qemu_driver.c | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 586d562..7e4e261 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -220,8 +220,10 @@ libxlDoNodeGetInfo(libxlDriverPrivatePtr driver, virNodeInfoPtr info)
static char *
libxlDomainManagedSavePath(libxlDriverPrivatePtr driver, virDomainObjPtr vm) {
char *ret;
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+ virUUIDFormat(vm->def->uuid, uuidstr);
- if (virAsprintf(&ret, "%s/%s.save", driver->saveDir, vm->def->name) < 0) {
+ if (virAsprintf(&ret, "%s/%s.save", driver->saveDir, uuidstr) < 0) {
virReportOOMError();
return NULL;
}
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a05a1ee..db77615 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2398,8 +2398,10 @@ cleanup:
static char *
qemuDomainManagedSavePath(struct qemud_driver *driver, virDomainObjPtr vm) {
char *ret;
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+ virUUIDFormat(vm->def->uuid, uuidstr);
- if (virAsprintf(&ret, "%s/%s.save", driver->saveDir, vm->def->name) < 0) {
+ if (virAsprintf(&ret, "%s/%s.save", driver->saveDir, uuidstr) < 0) {
virReportOOMError();
return(NULL);
}
--
1.7.6
13 years, 5 months
[libvirt] [PATCH 0/7] Add support for setting QoS
by Michal Privoznik
This patch series add support for setting traffic shaping and policing
on both domain's interface and network's virtual bridge. Basically,
this is done via 'tc' from iproute2 package. For shaping is HTB used,
for policing we need u32 match selector. Both should be available in
RHEL-6 kernel.
Michal Privoznik (7):
bandwidth: Define schema and create documentation
bandwidth: Declare internal structures
bandwidth: Add format parsing functions
bandwidth: Create format functions
bandwitdh: Implement functions to enable and disable QoS
bandwidth: Add test cases for network
bandwidth: Add domain schema test suite
configure.ac | 4 +
docs/formatdomain.html.in | 32 ++
docs/formatnetwork.html.in | 30 ++
docs/schemas/domain.rng | 50 +++
docs/schemas/network.rng | 51 +++
src/conf/domain_conf.c | 6 +
src/conf/domain_conf.h | 1 +
src/conf/network_conf.c | 8 +
src/conf/network_conf.h | 1 +
src/libvirt_private.syms | 6 +
src/network/bridge_driver.c | 8 +
src/qemu/qemu_command.c | 5 +
src/util/network.c | 508 +++++++++++++++++++++++++
src/util/network.h | 28 ++
tests/domainschemadata/domain-bandwidth.xml | 72 ++++
tests/networkxml2xmlin/bandwidth-network.xml | 16 +
tests/networkxml2xmlout/bandwidth-network.xml | 16 +
tests/networkxml2xmltest.c | 1 +
18 files changed, 843 insertions(+), 0 deletions(-)
create mode 100644 tests/domainschemadata/domain-bandwidth.xml
create mode 100644 tests/networkxml2xmlin/bandwidth-network.xml
create mode 100644 tests/networkxml2xmlout/bandwidth-network.xml
--
1.7.5.rc3
13 years, 5 months
[libvirt] [PATCH v3] bios: Add support for SGA
by Michal Privoznik
This patch creates new <bios> element which, at this time has the only
attribute useserial='yes|no'. This attribute allow users to use
Serial Graphics Adapter and see BIOS messages from the very first moment
domain boots up. Therefore, users can choose boot medium, set PXE, etc.
---
diff to v2:
-move from <serial> to <bios>
-include Eric's and Dan's suggestions
diff to v1:
-move from <video> to <serial> as Dan suggested:
https://www.redhat.com/archives/libvir-list/2011-July/msg00134.html
docs/formatdomain.html.in | 9 ++++++
docs/schemas/domain.rng | 14 +++++++++
src/conf/domain_conf.c | 27 ++++++++++++++++-
src/conf/domain_conf.h | 13 ++++++++
src/qemu/qemu_capabilities.c | 3 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 20 +++++++++++++
tests/qemuxml2argvdata/qemuxml2argv-bios.args | 6 ++++
tests/qemuxml2argvdata/qemuxml2argv-bios.xml | 39 +++++++++++++++++++++++++
tests/qemuxml2argvtest.c | 1 +
10 files changed, 131 insertions(+), 2 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-bios.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-bios.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 10d87a9..9cc0bca 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -86,6 +86,7 @@
<boot dev='cdrom'/>
<bootmenu enable='yes'/>
<smbios mode='sysinfo'/>
+ <bios useserial='yes'/>
</os>
...</pre>
@@ -137,6 +138,14 @@
specified, the hypervisor default is used. <span class="since">
Since 0.8.7</span>
</dd>
+ <dt><code>bios</code></dt>
+ <dd>This element has attribute <code>useserial</code> with possible
+ values <code>yes</code> or <code>no</code>. It enables or disables
+ Serial Graphics Adapter which allows users to see BIOS messages
+ on a serial port. Therefore, one need to have
+ <a href="#elementCharSerial">serial port</a> defined.
+ <span class="since">Since 0.9.4</span>
+ </dd>
</dl>
<h4><a name="elementsOSBootloader">Host bootloader</a></h4>
diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
index 3c8414e..2d3b3cd 100644
--- a/docs/schemas/domain.rng
+++ b/docs/schemas/domain.rng
@@ -151,6 +151,9 @@
<optional>
<ref name="smbios"/>
</optional>
+ <optional>
+ <ref name="bios"/>
+ </optional>
</interleave>
</element>
</define>
@@ -2261,6 +2264,17 @@
</element>
</define>
+ <define name="bios">
+ <element name="bios">
+ <attribute name="useserial">
+ <choice>
+ <value>yes</value>
+ <value>no</value>
+ </choice>
+ </attribute>
+ </element>
+ </define>
+
<define name="address">
<element name="address">
<choice>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2275d3a..eaafa15 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5628,9 +5628,9 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt,
{
xmlNodePtr *nodes = NULL;
int i, n;
- char *bootstr;
+ char *bootstr, *useserial;
int ret = -1;
- unsigned long deviceBoot;
+ unsigned long deviceBoot, serialPorts;
if (virXPathULong("count(./devices/disk[boot]"
"|./devices/interface[boot]"
@@ -5684,6 +5684,22 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt,
VIR_FREE(bootstr);
}
+ useserial = virXPathString("string(./os/bios[1]/@useserial)", ctxt);
+ if (useserial) {
+ if (STREQ(useserial, "yes")) {
+ if (virXPathULong("count(./devices/serial)",
+ ctxt, &serialPorts) < 0) {
+ virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("need at least one serial port "
+ "for useserial"));
+ goto cleanup;
+ }
+ def->os.bios.useserial = VIR_DOMAIN_BIOS_USESERIAL_YES;
+ } else {
+ def->os.bios.useserial = VIR_DOMAIN_BIOS_USESERIAL_NO;
+ }
+ }
+
*bootCount = deviceBoot;
ret = 0;
@@ -9720,6 +9736,13 @@ char *virDomainDefFormat(virDomainDefPtr def,
: "no");
virBufferAsprintf(&buf, " <bootmenu enable='%s'/>\n", enabled);
}
+
+ if (def->os.bios.useserial) {
+ const char *useserial = (def->os.bios.useserial ==
+ VIR_DOMAIN_BIOS_USESERIAL_YES ? "yes"
+ : "no");
+ virBufferAsprintf(&buf, " <bios useserial='%s'/>\n", useserial);
+ }
}
if (def->os.smbios_mode) {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ddfe18e..71cb145 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -923,6 +923,18 @@ enum virDomainLifecycleCrashAction {
VIR_DOMAIN_LIFECYCLE_CRASH_LAST
};
+enum virDomainBIOSUseserial {
+ VIR_DOMAIN_BIOS_USESERIAL_DEFAULT = 0,
+ VIR_DOMAIN_BIOS_USESERIAL_YES,
+ VIR_DOMAIN_BIOS_USESERIAL_NO
+};
+
+typedef struct _virDomainBIOSDef virDomainBIOSDef;
+typedef virDomainBIOSDef *virDomainBIOSDefPtr;
+struct _virDomainBIOSDef {
+ int useserial;
+};
+
/* Operating system configuration data & machine / arch */
typedef struct _virDomainOSDef virDomainOSDef;
typedef virDomainOSDef *virDomainOSDefPtr;
@@ -942,6 +954,7 @@ struct _virDomainOSDef {
char *bootloader;
char *bootloaderArgs;
int smbios_mode;
+ virDomainBIOSDef bios;
};
enum virDomainSeclabelType {
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 2c037ce..1421a5e 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -122,6 +122,7 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
"pci-multifunction", /* 60 */
"virtio-blk-pci.ioeventfd",
+ "sga",
);
struct qemu_feature_flags {
@@ -1212,6 +1213,8 @@ qemuCapsParseDeviceStr(const char *str, virBitmapPtr flags)
qemuCapsSet(flags, QEMU_CAPS_DEVICE_QXL_VGA);
if (strstr(str, "virtio-blk-pci.ioeventfd"))
qemuCapsSet(flags, QEMU_CAPS_VIRTIO_IOEVENTFD);
+ if (strstr(str, "name \"sga\""))
+ qemuCapsSet(flags, QEMU_CAPS_SGA);
return 0;
}
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 0b9c8be..d251262 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -97,6 +97,7 @@ enum qemuCapsFlags {
QEMU_CAPS_DEVICE_QXL_VGA = 59, /* Is the primary and vga campatible qxl device named qxl-vga? */
QEMU_CAPS_PCI_MULTIFUNCTION = 60, /* -device multifunction=on|off */
QEMU_CAPS_VIRTIO_IOEVENTFD = 61, /* IOeventFD feature: virtio-{net|blk}-pci.ioeventfd=on/off */
+ QEMU_CAPS_SGA = 62, /* Serial Graphics Adapter */
QEMU_CAPS_LAST, /* this must always be the last item */
};
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6e4480e..7eb721c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3060,6 +3060,26 @@ qemuBuildCommandLine(virConnectPtr conn,
"-nodefaults"); /* Disable default guest devices */
}
+ /* Serial graphics adapter */
+ if (def->os.bios.useserial == VIR_DOMAIN_BIOS_USESERIAL_YES) {
+ if (!qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("qemu does not support -device"));
+ goto error;
+ }
+ if (!qemuCapsGet(qemuCaps, QEMU_CAPS_SGA)) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("qemu does not support SGA"));
+ goto error;
+ }
+ if (!def->nserials) {
+ qemuReportError(VIR_ERR_XML_ERROR, "%s",
+ _("need at least one serial port to use SGA"));
+ goto error;
+ }
+ virCommandAddArgList(cmd, "-device", "sga", NULL);
+ }
+
if (monitor_chr) {
char *chrdev;
/* Use -chardev if it's available */
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-bios.args b/tests/qemuxml2argvdata/qemuxml2argv-bios.args
new file mode 100644
index 0000000..f9727c4
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-bios.args
@@ -0,0 +1,6 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 1024 -smp 1 -nodefaults -device sga \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-hda /dev/HostVG/QEMUGuest1 -serial pty \
+-usb -device usb-tablet,id=input0 -vnc 127.0.0.1:0 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-bios.xml b/tests/qemuxml2argvdata/qemuxml2argv-bios.xml
new file mode 100644
index 0000000..5ce3e24
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-bios.xml
@@ -0,0 +1,39 @@
+<domain type='qemu'>
+ <name>test-bios</name>
+ <uuid>362d1fc1-df7d-193e-5c18-49a71bd1da66</uuid>
+ <memory>1048576</memory>
+ <currentMemory>1048576</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ <bootmenu enable='yes'/>
+ <bios useserial='yes'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <serial type='pty'>
+ <target port='0'/>
+ </serial>
+ <console type='pty'>
+ <target type='serial' port='0'/>
+ </console>
+ <input type='tablet' bus='usb'/>
+ <input type='mouse' bus='ps2'/>
+ <graphics type='vnc' port='5900' autoport='no' listen='127.0.0.1'/>
+ <video>
+ <model type='cirrus' vram='9216' heads='1'/>
+ </video>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index ec1f4b5..2e6c546 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -287,6 +287,7 @@ mymain(void)
QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT,
QEMU_CAPS_BOOTINDEX);
DO_TEST("bootloader", true, QEMU_CAPS_DOMID);
+ DO_TEST("bios", false, QEMU_CAPS_DEVICE, QEMU_CAPS_SGA);
DO_TEST("clock-utc", false, NONE);
DO_TEST("clock-localtime", false, NONE);
/*
--
1.7.5.rc3
13 years, 5 months
[libvirt] Exposing qemu support for SDL via capabilities
by Adam Litke
Hi all,
In order to nicely support domains that use qemu's SDL support,
libvirt-cim is looking for a way to confirm if the underlying qemu
emulator can support SDL. Libvirt already knows this information
internally. It seems to me that the best way to provide this
information is by reporting it as a guest feature via the capabilities
API call. I was thinking the node '/capabilities/guest/features/sdl'
could be added when qemu supports SDL.
Is this a good idea?
--
Adam Litke
IBM Linux Technology Center
13 years, 5 months
[libvirt] [BUG] event's bug?
by Wen Congyang
Steps to produce this bug:
1. # virsh migrate vm1 --p2p qemu+tls://<remote host>/system
error: End of file while reading data: Input/output error
Now the libvirtd crashed.
This bug only happened twice.
I use gdb to analyze the core file:
(gdb) info threads
6 Thread 3952 0x000000351fe0b43c in pthread_cond_wait@(a)GLIBC_2.3.2 () from /lib64/libpthread.so.0
5 Thread 3951 0x000000351fe0b43c in pthread_cond_wait@(a)GLIBC_2.3.2 () from /lib64/libpthread.so.0
4 Thread 3950 0x000000351fe0b43c in pthread_cond_wait@(a)GLIBC_2.3.2 () from /lib64/libpthread.so.0
3 Thread 3949 0x000000351fe0b43c in pthread_cond_wait@(a)GLIBC_2.3.2 () from /lib64/libpthread.so.0
2 Thread 3948 0x000000351fe0b43c in pthread_cond_wait@(a)GLIBC_2.3.2 () from /lib64/libpthread.so.0
* 1 Thread 3947 0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x0000003f2a834150 in _gnutls_string_resize (dest=0x7f92740079d8, new_size=<value optimized out>) at gnutls_str.c:192
#2 0x0000003f2a81a614 in _gnutls_io_read_buffered (session=0x7f9274006d30, iptr=0x7fffb3476148, sizeOfPtr=5, recv_type=<value optimized out>) at gnutls_buffers.c:515
#3 0x0000003f2a816031 in _gnutls_recv_int (session=0x7f9274006d30, type=GNUTLS_APPLICATION_DATA, htype=4294967295, data=0x7f92740155e8 "", sizeofdata=4) at gnutls_record.c:904
#4 0x00007f9285bd2ec7 in virNetTLSSessionRead (sess=0x7f927400a5d0, buf=0x7f92740155e8 "", len=4) at rpc/virnettlscontext.c:812
#5 0x00007f9285bd50a4 in virNetSocketReadWire (sock=0x7f9274006ba0, buf=0x7f92740155e8 "", len=4) at rpc/virnetsocket.c:801
#6 0x00007f9285bd5815 in virNetSocketRead (sock=0x7f9274006ba0, buf=0x7f92740155e8 "", len=4) at rpc/virnetsocket.c:981
#7 0x00007f9285bce40f in virNetClientIOReadMessage (client=0x7f9274015590) at rpc/virnetclient.c:711
#8 0x00007f9285bce461 in virNetClientIOHandleInput (client=0x7f9274015590) at rpc/virnetclient.c:730
#9 0x00007f9285bcf0f4 in virNetClientIncomingEvent (sock=0x7f9274006ba0, events=1, opaque=0x7f9274015590) at rpc/virnetclient.c:1119
#10 0x00007f9285bd5b87 in virNetSocketEventHandle (fd=13, watch=20, events=1, opaque=0x7f9274006ba0) at rpc/virnetsocket.c:1052
#11 0x00007f9285b09325 in virEventPollDispatchHandles (nfds=10, fds=0xfe51d0) at util/event_poll.c:469
#12 0x00007f9285b09a7e in virEventPollRunOnce () at util/event_poll.c:610
#13 0x00007f9285b07ec5 in virEventRunDefaultImpl () at util/event.c:247
#14 0x0000000000449cc2 in virNetServerRun (srv=0xfc3490) at rpc/virnetserver.c:662
#15 0x000000000041e3c5 in main (argc=2, argv=0x7fffb3476b68) at libvirtd.c:1561
The debug log in /var/log/libvirt/libvirtd.log:
...
11:18:27.838: 1848: debug : virEventPollRemoveHandle:171 : Remove handle w=13
11:18:27.838: 1847: debug : virEventPollDispatchHandles:454 : i=3 w=4
11:18:27.838: 1847: debug : virEventPollDispatchHandles:454 : i=4 w=5
11:18:27.838: 1847: debug : virEventPollDispatchHandles:454 : i=5 w=6
11:18:27.838: 1847: debug : virEventPollDispatchHandles:454 : i=6 w=12
11:18:27.838: 1847: debug : virEventPollDispatchHandles:454 : i=7 w=13
11:18:27.838: 1847: debug : virEventPollDispatchHandles:467 : Dispatch n=7 f=20 w=13 e=1 0x7f00780aaa80
11:18:27.838: 1848: debug : virEventPollRemoveHandle:184 : mark delete 7 20
11:18:27.838: 1848: debug : virEventPollInterruptLocked:677 : Interrupting
11:18:27.838: 1848: debug : virNetSocketFree:627 : sock=0x7f00780aaa80 fd=20
11:18:27.838: 1848: debug : virEventPollRemoveTimeout:276 : Remove timer 10
11:18:27.838: 1848: debug : virEventPollInterruptLocked:677 : Interrupting
11:18:27.838: 1848: debug : virDomainObjUnref:1142 : obj=0x7f007800ce10 refs=2
11:18:27.838: 1848: debug : virDomainObjUnref:1142 : obj=0x7f007800ce10 refs=1
====== end of log =====
The reason is that: we dispatch handle(fd = 20, watch=13) and remove the handle(watch=13) almost
at the same time(The order is: dispatch, remove)
We remove the handle when remote connection is closed, and we will call virNetSocketFree() to free sock,
but we still use sock in another thread. It's very dangerous!!!
I think we should wait dispatching a handle when removing the same handle.
13 years, 5 months
[libvirt] [PATCH] vbox: Fix logic in storage driver open function
by Matthias Bolte
If the main driver is the vbox driver, then the open function
has to return an error if the private data is invalid.
---
src/vbox/vbox_tmpl.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 37fe248..dfa676e 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -7753,19 +7753,16 @@ static virDrvOpenStatus vboxStorageOpen (virConnectPtr conn,
vboxGlobalData *data = conn->privateData;
if (STRNEQ(conn->driver->name, "VBOX"))
- goto cleanup;
+ return VIR_DRV_OPEN_DECLINED;
if ((data->pFuncs == NULL) ||
(data->vboxObj == NULL) ||
(data->vboxSession == NULL))
- goto cleanup;
+ return VIR_DRV_OPEN_ERROR;
VIR_DEBUG("vbox storage initialized");
/* conn->storagePrivateData = some storage specific data */
return VIR_DRV_OPEN_SUCCESS;
-
-cleanup:
- return VIR_DRV_OPEN_DECLINED;
}
static int vboxStorageClose (virConnectPtr conn) {
--
1.7.4.1
13 years, 5 months