[libvirt] [PATCHv5 2/2] qemu: Disk Geometry Override Support
by Viktor Mihajlovski
From: J.B. Joret <jb(a)linux.vnet.ibm.com>
Qemu command line generation for geometry override and testcases.
V2 Changes: squashed qemu code and testcases.
V3 Changes: use virReportError.
V4 Changes: rebase
V5 Changes: Fixed test invocation for geometry.
Signed-off-by: J.B. Joret <jb(a)linux.vnet.ibm.com>
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
src/qemu/qemu_command.c | 59 ++++++++++++++++++++
.../qemuxml2argv-disk-geometry.args | 4 +
.../qemuxml2argv-disk-geometry.xml | 26 +++++++++
tests/qemuxml2argvtest.c | 2 +
4 files changed, 91 insertions(+), 0 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-geometry.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-geometry.xml
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 9383530..cc44015 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2073,6 +2073,8 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
{
virBuffer opt = VIR_BUFFER_INITIALIZER;
const char *bus = virDomainDiskQEMUBusTypeToString(disk->bus);
+ const char *trans =
+ virDomainDiskGeometryTransTypeToString(disk->geometry.trans);
int idx = virDiskNameToIndex(disk->dst);
int busid = -1, unitid = -1;
@@ -2275,6 +2277,24 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
disk->type != VIR_DOMAIN_DISK_TYPE_DIR &&
qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_FORMAT))
virBufferAsprintf(&opt, ",format=%s", disk->driverType);
+
+ /* generate geometry command string*/
+ if (disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK ||
+ disk->type == VIR_DOMAIN_DISK_TYPE_FILE) {
+ if (disk->geometry.cylinders > 0 &&
+ disk->geometry.heads > 0 &&
+ disk->geometry.sectors > 0) {
+
+ virBufferAsprintf(&opt, ",cyls=%u,heads=%u,secs=%u",
+ disk->geometry.cylinders,
+ disk->geometry.heads,
+ disk->geometry.sectors);
+
+ if (disk->geometry.trans != VIR_DOMAIN_DISK_TRANS_DEFAULT)
+ virBufferEscapeString(&opt, ",trans=%s", trans);
+ }
+ }
+
if (disk->serial &&
qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_SERIAL)) {
if (qemuSafeSerialParamValue(disk->serial) < 0)
@@ -6691,6 +6711,7 @@ qemuParseCommandLineDisk(virCapsPtr caps,
int idx = -1;
int busid = -1;
int unitid = -1;
+ int trans = VIR_DOMAIN_DISK_TRANS_DEFAULT;
if ((nkeywords = qemuParseKeywords(val,
&keywords,
@@ -6895,6 +6916,44 @@ qemuParseCommandLineDisk(virCapsPtr caps,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse io mode '%s'"), values[i]);
}
+ } else if (STREQ(keywords[i], "cyls")) {
+ if (virStrToLong_ui(values[i], NULL, 10,
+ &(def->geometry.cylinders)) < 0) {
+ virDomainDiskDefFree(def);
+ def = NULL;
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse cylinders value'%s'"),
+ values[i]);
+ }
+ } else if (STREQ(keywords[i], "heads")) {
+ if (virStrToLong_ui(values[i], NULL, 10,
+ &(def->geometry.heads)) < 0) {
+ virDomainDiskDefFree(def);
+ def = NULL;
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse heads value'%s'"),
+ values[i]);
+ }
+ } else if (STREQ(keywords[i], "secs")) {
+ if (virStrToLong_ui(values[i], NULL, 10,
+ &(def->geometry.sectors)) < 0) {
+ virDomainDiskDefFree(def);
+ def = NULL;
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse sectors value'%s'"),
+ values[i]);
+ }
+ } else if (STREQ(keywords[i], "trans")) {
+ def->geometry.trans =
+ virDomainDiskGeometryTransTypeFromString(values[i]);
+ if ((trans < VIR_DOMAIN_DISK_TRANS_DEFAULT) ||
+ (trans >= VIR_DOMAIN_DISK_TRANS_LAST)) {
+ virDomainDiskDefFree(def);
+ def = NULL;
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse translation value'%s'"),
+ values[i]);
+ }
}
}
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-geometry.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-geometry.args
new file mode 100644
index 0000000..7cd6650
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-geometry.args
@@ -0,0 +1,4 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
+pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
+-no-acpi -boot c -drive file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0,cyls=16383,heads=16,secs=63,trans=lba \
+-net none -serial none -parallel none -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-geometry.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-geometry.xml
new file mode 100644
index 0000000..f0cf4ae
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-geometry.xml
@@ -0,0 +1,26 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory>219136</memory>
+ <currentMemory>219136</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <geometry cyls='16383' heads='16' secs='63' trans='lba'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index f8d8db5..71513fb 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -788,6 +788,8 @@ mymain(void)
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
QEMU_CAPS_IDE_CD);
+ DO_TEST("disk-geometry", QEMU_CAPS_DRIVE);
+
VIR_FREE(driver.stateDir);
virCapabilitiesFree(driver.caps);
VIR_FREE(map);
--
1.7.0.4
12 years, 3 months
[libvirt] [PATCHv4 0/2] Rework of Disk Geometry Support
by Viktor Mihajlovski
With qemu it is possible to override the geometry (cylinders, heads,
sectors) of disks.
This series adds a new XML tag for geometry and the related
support in the qemu driver.
V2 Changes:
Refactor into the generic domain configuration/XML support for disk
geometry and a qemu specific part with the testcase
V3 Changes:
1. Use virReportError instead of custom xxxReportError.
2. Moved the geometry element to diskspec, so it applies to all kind
of disks.
V4 Changes:
Rebase for libvirt 0.10.0 freeze.
J.B. Joret (2):
Support for Disk Geometry Override
qemu: Disk Geometry Override Support
docs/formatdomain.html.in | 25 +++++++
docs/schemas/domaincommon.rng | 25 +++++++
src/conf/domain_conf.c | 71 ++++++++++++++++++++
src/conf/domain_conf.h | 17 +++++
src/libvirt_private.syms | 2 +
src/qemu/qemu_command.c | 59 ++++++++++++++++
.../qemuxml2argv-disk-geometry.args | 4 +
.../qemuxml2argv-disk-geometry.xml | 26 +++++++
tests/qemuxml2argvtest.c | 2 +
9 files changed, 231 insertions(+), 0 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-geometry.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-geometry.xml
12 years, 3 months
[libvirt] [PATCH 0/7] support guest agent general command v3
by MATSUDA, Daiki
Hi. All.
I rewrote the patched.
But I modified the feature for the situation @result pointer is NULL.
Though before it does not forcely wait, I think it is not meanless because
@result pointer is always NULL.
And @timeout must be following
VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK(-2) : does not block and wait forever.
VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT(-1) : use default time for waiting
VIR_DOMAIN_QEMU_AGENT_COMMAND_NOWIAT(0) : does not wait and out soon
positive value : wait for pointed seconds.
In addition, I added the some options for virsh command qemu-agent-command
--block : it means taht @timeout is VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK.
--async : it means taht @timeout is VIR_DOMAIN_QEMU_AGENT_COMMAND_NOWIAT.
--timeout @seconds : @seconds must be positive value and it means that @timeout
is positive value case.
These upper options are exclusive.
If no options are given, it means taht @timeout is IR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT.
virsh # help qemu-agent-command
NAME
qemu-agent-command - QEMU Guest Agent Command
SYNOPSIS
qemu-agent-command <domain> [--timeout <number>] [--async] [--block] {[--cmd] <string>}...
DESCRIPTION
Run an arbitrary qemu guest agent command; use at your own risk
OPTIONS
[--domain] <string> domain name, id or uuid
--timeout <number> timeout seconds. must be positive.
--async execute command without waiting for timeout
--block execute command without timeout
[--cmd] <string> command
virsh # qemu-agent-command RHEL58_64 '{"execute":"guest-info"}'
{"return":{"version":"1.1.50","supported_commands":[{"enabled":true,"name":"guest-network-get-interfaces"},{"enabled":true,"name":"guest-suspend-hybrid"},{"enabled":true,"name":"guest-suspend-ram"},{"enabled":true,"name":"guest-suspend-disk"},{"enabled":true,"name":"guest-fsfreeze-thaw"},{"enabled":true,"name":"guest-fsfreeze-freeze"},{"enabled":true,"name":"guest-fsfreeze-status"},{"enabled":true,"name":"guest-file-flush"},{"enabled":true,"name":"guest-file-seek"},{"enabled":true,"name":"guest-file-write"},{"enabled":true,"name":"guest-file-read"},{"enabled":true,"name":"guest-file-close"},{"enabled":true,"name":"guest-file-open"},{"enabled":true,"name":"guest-shutdown"},{"enabled":true,"name":"guest-info"},{"enabled":true,"name":"guest-ping"},{"enabled":true,"name":"guest-sync"},{"enabled":true,"name":"guest-sync-delimited"}]}}
virsh # qemu-agent-command --block RHEL58_64 '{"execute":"guest-sync","arguments":{"id":123}}'
{"return":123}
12 years, 3 months
[libvirt] [PATCH 0/7] Forward mode='hostdev' patch series
by Shradha Shah
This patch series supports the forward mode='hostdev'. The functionality
of this mode is the same as interface type='hostdev' but with the added
benefit of using interface pools.
The patch series also contains a patch to support use of interface names
and PCI device addresses interchangeably in a network xml, and return
the appropriate one in actualDevice when networkAllocateActualDevice is
called.
At the top level managed attribute can be specified with identical results
as when it's specified for a hostdev.
Currently forward mode='hostdev' does not support USB devices.
Shradha Shah (7):
conf: move DevicePCIAddress functions to separate file
network: helper function to create interface pool from PF
RNG updates, new xml parser/formatter code to support forward
mode=hostdev
Code to return interface name or pci_addr of the VF in actualDevice
Add function virDevicePCIAddressEqual
Forward Mode Hostdev network driver Implementation
Forward Mode 'Hostdev' qemu driver implementation
docs/formatnetwork.html.in | 62 +++++
docs/schemas/basictypes.rng | 46 ++++
docs/schemas/domaincommon.rng | 44 ----
docs/schemas/network.rng | 53 ++++-
include/libvirt/virterror.h | 1 +
src/Makefile.am | 7 +-
src/conf/device_conf.c | 147 +++++++++++
src/conf/device_conf.h | 68 ++++++
src/conf/domain_conf.c | 114 +--------
src/conf/domain_conf.h | 25 +--
src/conf/network_conf.c | 130 +++++++++--
src/conf/network_conf.h | 26 ++-
src/libvirt_private.syms | 11 +-
src/network/bridge_driver.c | 414 +++++++++++++++++++++++---------
src/qemu/qemu_command.c | 52 +++-
src/qemu/qemu_hotplug.c | 7 +-
src/qemu/qemu_monitor.c | 14 +-
src/qemu/qemu_monitor.h | 17 +-
src/qemu/qemu_monitor_json.c | 14 +-
src/qemu/qemu_monitor_json.h | 14 +-
src/qemu/qemu_monitor_text.c | 16 +-
src/qemu/qemu_monitor_text.h | 14 +-
src/util/virnetdev.c | 25 +-
src/util/virnetdev.h | 4 +-
src/util/virterror.c | 3 +-
src/xen/xend_internal.c | 3 +-
tests/networkxml2xmlin/hostdev-pf.xml | 7 +
tests/networkxml2xmlin/hostdev.xml | 10 +
tests/networkxml2xmlout/hostdev-pf.xml | 7 +
tests/networkxml2xmlout/hostdev.xml | 10 +
tests/networkxml2xmltest.c | 2 +
31 files changed, 976 insertions(+), 391 deletions(-)
create mode 100644 src/conf/device_conf.c
create mode 100644 src/conf/device_conf.h
create mode 100644 tests/networkxml2xmlin/hostdev-pf.xml
create mode 100644 tests/networkxml2xmlin/hostdev.xml
create mode 100644 tests/networkxml2xmlout/hostdev-pf.xml
create mode 100644 tests/networkxml2xmlout/hostdev.xml
--
1.7.4.4
12 years, 3 months
[libvirt] [RFC] Support cpu hotplug in libvirt.
by tangchen
Hi~
It seems that libvirt is not cpu hotplug aware.
Please refer to the following problem.
1. At first, we have 2 cpus.
# cat /cgroup/cpuset/cpuset.cpus
0-1
# cat /cgroup/cpuset/libvirt/qemu/cpuset.cpus
0-1
2. And we have a vm1 with following configuration.
<cputune>
<vcpupin vcpu='0' cpuset='1'/>
<hypervisorpin cpuset='1'/>
</cputune>
3. Offline cpu1.
# echo 0 > /sys/devices/system/cpu/cpu1/online
# cat /sys/devices/system/cpu/cpu1/online
0
# cat /cgroup/cpuset/cpuset.cpus
0
# cat /cgroup/cpuset/libvirt/qemu/cpuset.cpus
0
4. Online cpu1.
# echo 1 > /sys/devices/system/cpu/cpu1/online
# cat /sys/devices/system/cpu/cpu1/online
1
# cat /cgroup/cpuset/cpuset.cpus
0-1
# cat /cgroup/cpuset/libvirt/cpuset.cpus
0
# cat /cgroup/cpuset/libvirt/qemu/cpuset.cpus
0
# cat /cgroup/cpuset/libvirt/lxc/cpuset.cpus
0
Here,cgroup updated cpuset.cpus,but not for libvirt directory,and also qemu and lxc directory.
vm1 cannot be started again.
# virsh start vm1
error: Failed to start domain vm1
error: Unable to set cpuset.cpus: Permission denied
And libvird gave the following errors.
2012-07-17 07:30:22.478+0000: 3118: error : qemuSetupCgroupVcpuPin:498 : Unable to set cpuset.cpus: Permission denied
I am trying to use netlink socket with NETLINK_KOBJECT_UEVENT protocol to
listen to cpu hotplug events. But I met a little problem here.
virNetlinkEventServiceStart() only create a global variable server, and
create a NETLINK_ROUTE netlink socket for it.
So if I want to create another different netlink socket, such as NETLINK_KOBJECT_UEVENT,
what should I do ?
Shall we make the server global variable a global array ?
(It seems there are a lot of work to do.)
Thanks. :)
--
Best Regards,
Tang chen
12 years, 3 months
[libvirt] [PATCH] Add support for setting VLANs on Open vSwitch ports
by Kyle Mestery
Add the ability to support VLAN tags for Open vSwitch
virtual port types. To accomplish this, modify
virNetDevOpenvswitchAddPort and
virNetDevTapCreateInBridgePort to take a virNetDevVlanPtr
argument. When adding the port to the OVS bridge, setup
either a single VLAN or a trunk port based on the
configuration from the virNetDevVlanPtr.
Signed-off-by: Kyle Mestery <kmestery(a)cisco.com>
---
.gnulib | 2 +-
src/lxc/lxc_process.c | 2 +-
src/network/bridge_driver.c | 2 +-
src/qemu/qemu_command.c | 1 +
src/uml/uml_conf.c | 1 +
src/util/virnetdevopenvswitch.c | 34 +++++++++++++++++++++++++++++++---
src/util/virnetdevopenvswitch.h | 4 +++-
src/util/virnetdevtap.c | 3 ++-
src/util/virnetdevtap.h | 2 ++
9 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/.gnulib b/.gnulib
index 271dd74..dbd9144 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 271dd74fdf54ec2a03e73a5173b0b5697f6088f1
+Subproject commit dbd914496c99c52220e5f5ba4121d6cb55fb3beb
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 046ed86..dc34bef 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -325,7 +325,7 @@ static int virLXCProcessSetupInterfaceBridged(virConnectPtr conn,
if (vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH)
ret = virNetDevOpenvswitchAddPort(brname, parentVeth, &net->mac,
- vm->uuid, vport);
+ vm->uuid, vport, &net->vlan);
else
ret = virNetDevBridgeAddPort(brname, parentVeth);
if (ret < 0)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 474bbfa..a78e3b6 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -1763,7 +1763,7 @@ networkStartNetworkVirtual(struct network_driver *driver,
}
if (virNetDevTapCreateInBridgePort(network->def->bridge,
&macTapIfName, &network->def->mac,
- NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
VIR_NETDEV_TAP_CREATE_USE_MAC_FOR_BRIDGE) < 0) {
VIR_FREE(macTapIfName);
goto err0;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 9383530..e0062a1 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -255,6 +255,7 @@ qemuNetworkIfaceConnect(virDomainDefPtr def,
err = virNetDevTapCreateInBridgePort(brname, &net->ifname, &net->mac,
def->uuid, &tapfd,
virDomainNetGetActualVirtPortProfile(net),
+ &net->vlan,
tap_create_flags);
virDomainAuditNetDevice(def, net, "/dev/net/tun", tapfd >= 0);
if (err < 0) {
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index 4c299d8..5461b42 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -141,6 +141,7 @@ umlConnectTapDevice(virConnectPtr conn,
if (virNetDevTapCreateInBridgePort(bridge, &net->ifname, &net->mac,
vm->uuid, NULL,
virDomainNetGetActualVirtPortProfile(net),
+ &net->vlan,
VIR_NETDEV_TAP_CREATE_IFUP) < 0) {
if (template_ifname)
VIR_FREE(net->ifname);
diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
index b57532b..8a31e77 100644
--- a/src/util/virnetdevopenvswitch.c
+++ b/src/util/virnetdevopenvswitch.c
@@ -46,9 +46,11 @@
int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
const virMacAddrPtr macaddr,
const unsigned char *vmuuid,
- virNetDevVPortProfilePtr ovsport)
+ virNetDevVPortProfilePtr ovsport,
+ virNetDevVlanPtr virtVlan)
{
int ret = -1;
+ int i = 0;
virCommandPtr cmd = NULL;
char macaddrstr[VIR_MAC_STRING_BUFLEN];
char ifuuidstr[VIR_UUID_STRING_BUFLEN];
@@ -57,6 +59,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
char *ifaceid_ex_id = NULL;
char *profile_ex_id = NULL;
char *vmid_ex_id = NULL;
+ virBufferPtr buf;
virMacAddrFormat(macaddr, macaddrstr);
virUUIDFormat(ovsport->interfaceID, ifuuidstr);
@@ -76,11 +79,35 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
ovsport->profileID) < 0)
goto out_of_memory;
}
+ if (virtVlan) {
+ if (VIR_ALLOC(buf) < 0)
+ goto out_of_memory;
+
+ /* Trunk port first */
+ if (virtVlan->trunk) {
+ virBufferAdd(buf, "trunk=", -1);
+
+ /*
+ * Trunk ports have at least one VLAN. Do the first one
+ * outside the "for" loop so we can put a "," at the
+ * start of the for loop if there are more than one VLANs
+ * on this trunk port.
+ */
+ virBufferAsprintf(buf, "%d", virtVlan->tag[i]);
+
+ for (i = 1; i < virtVlan->nTags; i++) {
+ virBufferAdd(buf, ",", -1);
+ virBufferAsprintf(buf, "%d", virtVlan->tag[i]);
+ }
+ } else {
+ virBufferAsprintf(buf, "tag=%d", virtVlan->tag[0]);
+ }
+ }
cmd = virCommandNew(OVSVSCTL);
if (ovsport->profileID[0] == '\0') {
virCommandAddArgList(cmd, "--", "--may-exist", "add-port",
- brname, ifname,
+ brname, ifname, virBufferCurrentContent(buf),
"--", "set", "Interface", ifname, attachedmac_ex_id,
"--", "set", "Interface", ifname, ifaceid_ex_id,
"--", "set", "Interface", ifname, vmid_ex_id,
@@ -89,7 +116,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
NULL);
} else {
virCommandAddArgList(cmd, "--", "--may-exist", "add-port",
- brname, ifname,
+ brname, ifname, virBufferCurrentContent(buf),
"--", "set", "Interface", ifname, attachedmac_ex_id,
"--", "set", "Interface", ifname, ifaceid_ex_id,
"--", "set", "Interface", ifname, vmid_ex_id,
@@ -108,6 +135,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
ret = 0;
cleanup:
+ VIR_FREE(buf);
VIR_FREE(attachedmac_ex_id);
VIR_FREE(ifaceid_ex_id);
VIR_FREE(vmid_ex_id);
diff --git a/src/util/virnetdevopenvswitch.h b/src/util/virnetdevopenvswitch.h
index fbf9168..58b4dda 100644
--- a/src/util/virnetdevopenvswitch.h
+++ b/src/util/virnetdevopenvswitch.h
@@ -27,13 +27,15 @@
# include "internal.h"
# include "util.h"
# include "virnetdevvportprofile.h"
+# include "virnetdevvlan.h"
int virNetDevOpenvswitchAddPort(const char *brname,
const char *ifname,
const virMacAddrPtr macaddr,
const unsigned char *vmuuid,
- virNetDevVPortProfilePtr ovsport)
+ virNetDevVPortProfilePtr ovsport,
+ virNetDevVlanPtr virtVlan)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_RETURN_CHECK;
diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c
index 192d180..24f30b5 100644
--- a/src/util/virnetdevtap.c
+++ b/src/util/virnetdevtap.c
@@ -280,6 +280,7 @@ int virNetDevTapCreateInBridgePort(const char *brname,
const unsigned char *vmuuid,
int *tapfd,
virNetDevVPortProfilePtr virtPortProfile,
+ virNetDevVlanPtr virtVlan,
unsigned int flags)
{
virMacAddr tapmac;
@@ -324,7 +325,7 @@ int virNetDevTapCreateInBridgePort(const char *brname,
if (virtPortProfile) {
if (virNetDevOpenvswitchAddPort(brname, *ifname, macaddr, vmuuid,
- virtPortProfile) < 0) {
+ virtPortProfile, virtVlan) < 0) {
goto error;
}
} else {
diff --git a/src/util/virnetdevtap.h b/src/util/virnetdevtap.h
index ce3365e..45d0c08 100644
--- a/src/util/virnetdevtap.h
+++ b/src/util/virnetdevtap.h
@@ -25,6 +25,7 @@
# include "internal.h"
# include "virnetdevvportprofile.h"
+# include "virnetdevvlan.h"
int virNetDevTapCreate(char **ifname,
int *tapfd,
@@ -50,6 +51,7 @@ int virNetDevTapCreateInBridgePort(const char *brname,
const unsigned char *vmuuid,
int *tapfd,
virNetDevVPortProfilePtr virtPortProfile,
+ virNetDevVlanPtr virtVlan,
unsigned int flags)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_RETURN_CHECK;
--
1.7.11.2
12 years, 3 months
[libvirt] libvirtd crash when attach-disk to VM
by Wangpan
Hi all,
I got a depressed problem(libvirtd crash with SIGABRT or SIGSEGV sometimes) when attach a nbd disk to a VM by using cmd as follow:
virsh attach-disk 228 --source /dev/nbd0 --target vdd --sourcetype block --driver qemu --subdriver raw
or just using virsh attach-disk 228 /dev/nbd0 vdd.
and this problem occurs everytime when I attach a nbd disk to VM.
the device nbd0 is create by qemu-nbd cmd: qemu-nbd -c /dev/nbd0 /home/hzwangpan/zero
root@114-113-199-15:/home/hzwangpan# qemu-nbd -V
qemu-nbd version 0.0.1
the 'zero' file was created by qemu-img cmd: qemu-img create -f raw zero 512M
qemu-img version 1.1.0, Copyright (c) 2004-2008 Fabrice Bellard
Some info of packages' version is listed below:
root@114-113-199-15:/home/hzwangpan# dpkg -l | grep libvi
ii libvirt-bin 0.9.12-4 programs for the libvirt library
ii libvirt-dev 0.9.12-4 development files for the libvirt library
ii libvirt0 0.9.12-4 library for interfacing with different virtualization systems
ii libvirt0-dbg 0.9.12-4 library for interfacing with different virtualization systems
root@114-113-199-15:/home/hzwangpan# virsh version
Compiled against library: libvir 0.9.12
Using library: libvir 0.9.12
Using API: QEMU 0.9.12
Running hypervisor: QEMU 1.1.0
root@114-113-199-15:/home/hzwangpan# kvm -version
QEMU emulator version 1.1.0 (qemu-kvm-1.1.0+dfsg-3, Debian), Copyright (c) 2003-2008 Fabrice Bellard
root@114-113-199-15:/home/hzwangpan# uname -a
Linux 114-113-199-15 3.2.0-3-amd64 #1 SMP Thu Jun 28 09:07:26 UTC 2012 x86_64 GNU/Linux
root@114-113-199-15:/home/hzwangpan# cat /etc/issue
Debian GNU/Linux wheezy/sid \n \l
the backtrace info when libvirtd crash is list here:
1) one situation:
*** glibc detected *** /usr/sbin/libvirtd: malloc(): memory corruption (fast): 0x000000000087bc10 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x75b46)[0x7ffff4608b46]
/lib/x86_64-linux-gnu/libc.so.6(+0x79428)[0x7ffff460c428]
/lib/x86_64-linux-gnu/libc.so.6(__libc_malloc+0x70)[0x7ffff460d960]
/lib/x86_64-linux-gnu/libc.so.6(__strdup+0x22)[0x7ffff4612912]
/usr/lib/libvirt.so.0(virJSONValueObjectAppend+0x39)[0x7ffff77b75c9]
/usr/lib/libvirt.so.0(virJSONValueObjectAppendString+0x37)[0x7ffff77b7e87]
/usr/sbin/libvirtd[0x4aa884]
/usr/sbin/libvirtd[0x4ac3a7]
/usr/sbin/libvirtd[0x49d303]
/usr/sbin/libvirtd[0x4a8bfe]
/usr/sbin/libvirtd[0x4b0814]
/usr/sbin/libvirtd[0x484a5d]
/usr/sbin/libvirtd[0x461d9e]
/usr/lib/libvirt.so.0(virDomainAttachDevice+0xdd)[0x7ffff7846f5d]
/usr/sbin/libvirtd[0x43ccfe]
/usr/lib/libvirt.so.0(+0x129866)[0x7ffff788a866]
/usr/lib/libvirt.so.0(+0x1254d1)[0x7ffff78864d1]
/usr/lib/libvirt.so.0(+0x6273e)[0x7ffff77c373e]
/usr/lib/libvirt.so.0(+0x621c9)[0x7ffff77c31c9]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x6b50)[0x7ffff4d27b50]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7ffff466b6dd]
======= Memory map: ========
00400000-0053d000 r-xp 00000000 08:01 69457 /usr/sbin/libvirtd
0073c000-0073e000 r--p 0013c000 08:01 69457 /usr/sbin/libvirtd
0073e000-00746000 rw-p 0013e000 08:01 69457 /usr/sbin/libvirtd
00746000-00aa1000 rw-p 00000000 00:00 0 [heap]
7fffe0000000-7fffe021f000 rw-p 00000000 00:00 0
7fffe021f000-7fffe4000000 ---p 00000000 00:00 0
7fffe77ff000-7fffe7800000 ---p 00000000 00:00 0
7fffe7800000-7fffe8000000 rw-p 00000000 00:00 0
7fffe8000000-7fffe8175000 rw-p 00000000 00:00 0
7fffe8175000-7fffec000000 ---p 00000000 00:00 0
7fffec138000-7fffec139000 ---p 00000000 00:00 0
7fffec139000-7fffec939000 rw-p 00000000 00:00 0
7fffec939000-7fffec96e000 r--s 00000000 08:06 286722 /var/cache/nscd/passwd
7fffec96e000-7fffec99a000 rw-p 00000000 00:00 0
7fffec99a000-7fffec99b000 ---p 00000000 00:00 0
7fffec99b000-7fffed19b000 rw-p 00000000 00:00 0
7fffed19b000-7fffed315000 r-xp 00000000 08:01 124989 /usr/lib/x86_64-linux-gnu/libdb-5.1.so
7fffed315000-7fffed515000 ---p 0017a000 08:01 124989 /usr/lib/x86_64-linux-gnu/libdb-5.1.so
7fffed515000-7fffed51b000 r--p 0017a000 08:01 124989 /usr/lib/x86_64-linux-gnu/libdb-5.1.so
7fffed51b000-7fffed51e000 rw-p 00180000 08:01 124989 /usr/lib/x86_64-linux-gnu/libdb-5.1.so
7fffed51e000-7fffed524000 r-xp 00000000 08:01 133549 /usr/lib/x86_64-linux-gnu/sasl2/libsasldb.so.2.0.25
7fffed524000-7fffed723000 ---p 00006000 08:01 133549 /usr/lib/x86_64-linux-gnu/sasl2/libsasldb.so.2.0.25
7fffed723000-7fffed724000 r--p 00005000 08:01 133549 /usr/lib/x86_64-linux-gnu/sasl2/libsasldb.so.2.0.25
7fffed724000-7fffed725000 rw-p 00006000 08:01 133549 /usr/lib/x86_64-linux-gnu/sasl2/libsasldb.so.2.0.25
7fffed725000-7fffed75a000 r--s 00000000 08:06 286723 /var/cache/nscd/group
7fffed75a000-7fffed75b000 ---p 00000000 00:00 0
7fffed75b000-7fffedf5b000 rw-p 00000000 00:00 0
7fffedf5b000-7fffedf5c000 ---p 00000000 00:00 0
7fffedf5c000-7fffee75c000 rw-p 00000000 00:00 0
7fffee75c000-7fffee75d000 ---p 00000000 00:00 0
7fffee75d000-7fffeef5d000 rw-p 00000000 00:00 0
7fffeef5d000-7fffeef5e000 ---p 00000000 00:00 0
7fffeef5e000-7fffef75e000 rw-p 00000000 00:00 0
7fffef75e000-7fffef75f000 ---p 00000000 00:00 0
7fffef75f000-7fffeff5f000 rw-p 00000000 00:00 0
7fffeff5f000-7fffeff60000 ---p 00000000 00:00 0
7fffeff60000-7ffff0760000 rw-p 00000000 00:00 0
7ffff0760000-7ffff0761000 ---p 00000000 00:00 0
7ffff0761000-7ffff0f61000 rw-p 00000000 00:00 0
7ffff0f61000-7ffff0f62000 ---p 00000000 00:00 0
7ffff0f62000-7ffff1762000 rw-p 00000000 00:00 0
7ffff1762000-7ffff1763000 ---p 00000000 00:00 0
7ffff1763000-7ffff1f63000 rw-p 00000000 00:00 0
7ffff1f63000-7ffff1f64000 ---p 00000000 00:00 0
7ffff1f64000-7ffff2764000 rw-p 00000000 00:00 0
7ffff2764000-7ffff2799000 r--s 00000000 08:06 303114 /var/cache/nscd/hosts
7ffff2799000-7ffff27ae000 r-xp 00000000 08:01 57404 /lib/x86_64-linux-gnu/libgcc_s.so.1
7ffff27ae000-7ffff29ae000 ---p 00015000 08:01 57404 /lib/x86_64-linux-gnu/libgcc_s.so.1
7ffff29ae000-7ffff29af000 rw-p 00015000 08:01 57404 /lib/x86_64-linux-gnu/libgcc_s.so.1
7ffff29af000-7ffff29c7000 r-xp 00000000 08:01 110124 /usr/lib/libfa.so.1.3.5
7ffff29c7000-7ffff2bc7000 ---p 00018000 08:01 110124 /usr/lib/libfa.so.1.3.5
7ffff2bc7000-7ffff2bc8000 rw-p 00018000 08:01 110124 /usr/lib/libfa.so.1.3.5
7ffff2bc8000-7ffff2be9000 r-xp 00000000 08:01 57814 /lib/x86_64-linux-gnu/liblzma.so.5.0.0
7ffff2be9000-7ffff2de9000 ---p 00021000 08:01 57814 /lib/x86_64-linux-gnu/liblzma.so.5.0.0
7ffff2de9000-7ffff2dea000 r--p 00021000 08:01 57814 /lib/x86_64-linux-gnu/liblzma.so.5.0.0
7ffff2dea000-7ffff2deb000 rw-p 00022000 08:01 57814 /lib/x86_64-linux-gnu/liblzma.so.5.0.0
7ffff2deb000-7ffff2e6c000 r-xp 00000000 08:01 57526 /lib/x86_64-linux-gnu/libm-2.13.so
7ffff2e6c000-7ffff306b000 ---p 00081000 08:01 57526 /lib/x86_64-linux-gnu/libm-2.13.so
7ffff306b000-7ffff306c000 r--p 00080000 08:01 57526 /lib/x86_64-linux-gnu/libm-2.13.so
7ffff306c000-7ffff306d000 rw-p 00081000 08:01 57526 /lib/x86_64-linux-gnu/libm-2.13.so
7ffff306d000-7ffff30a9000 r-xp 00000000 08:01 76972 /usr/lib/x86_64-linux-gnu/libxslt.so.1.1.26
7ffff30a9000-7ffff32a8000 ---p 0003c000 08:01 76972 /usr/lib/x86_64-linux-gnu/libxslt.so.1.1.26
7ffff32a8000-7ffff32aa000 r--p 0003b000 08:01 76972 /usr/lib/x86_64-linux-gnu/libxslt.so.1.1.26
7ffff32aa000-7ffff32ab000 rw-p 0003d000 08:01 76972 /usr/lib/x86_64-linux-gnu/libxslt.so.1.1.26
7ffff32ab000-7ffff32bf000 r-xp 00000000 08:01 76971 /usr/lib/x86_64-linux-gnu/libexslt.so.0.8.15
7ffff32bf000-7ffff34be000 ---p 00014000 08:01 76971 /usr/lib/x86_64-linux-gnu/libexslt.so.0.8.15
7ffff34be000-7ffff34bf000 r--p 00013000 08:01 76971 /usr/lib/x86_64-linux-gnu/libexslt.so.0.8.15
7ffff34bf000-7ffff34c0000 rw-p 00014000 08:01 76971 /usr/lib/x86_64-linux-gnu/libexslt.so.0.8.15
7ffff34c0000-7ffff3519000 r-xp 00000000 08:01 93870 /usr/lib/libaugeas.so.0.15.0
7ffff3519000-7ffff3718000 ---p 00059000 08:01 93870 /usr/lib/libaugeas.so.0.15.0
7ffff3718000-7ffff371b000 rw-p 00058000 08:01 93870 /usr/lib/libaugeas.so.0.15.0
7ffff371b000-7ffff372e000 r-xp 00000000 08:01 57421 /lib/x86_64-linux-gnu/libresolv-2.13.so
Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff1761700 (LWP 8216)]
0x00007ffff45c5475 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0 0x00007ffff45c5475 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff45c86f0 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff45ff2fb in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3 0x00007ffff4608b46 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#4 0x00007ffff460c428 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#5 0x00007ffff460d960 in malloc () from /lib/x86_64-linux-gnu/libc.so.6
#6 0x00007ffff4612912 in strdup () from /lib/x86_64-linux-gnu/libc.so.6
#7 0x00007ffff77b75c9 in virJSONValueObjectAppend (object=object@entry=0x91d810, key=key@entry=0x4fef81 "execute", value=value@entry=0x85de90)
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/util/json.c:274
#8 0x00007ffff77b7e87 in virJSONValueObjectAppendString (object=object@entry=0x91d810, key=key@entry=0x4fef81 "execute", value=value@entry=0x51196f "human-monitor-command")
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/util/json.c:296
#9 0x00000000004aa884 in qemuMonitorJSONMakeCommandRaw (wrap=wrap@entry=false, cmdname=cmdname@entry=0x51196f "human-monitor-command")
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/qemu/qemu_monitor_json.c:404
#10 0x00000000004ac3a7 in qemuMonitorJSONHumanCommandWithFd (mon=mon@entry=0x7fffe80010b0, cmd_str=<optimized out>, scm_fd=-1, reply_str=0x7ffff1760920)
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/qemu/qemu_monitor_json.c:886
#11 0x000000000049d303 in qemuMonitorHMPCommandWithFd (mon=mon@entry=0x7fffe80010b0, cmd=<optimized out>, scm_fd=scm_fd@entry=-1, reply=reply@entry=0x7ffff1760920)
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/qemu/qemu_monitor.c:910
#12 0x00000000004a8bfe in qemuMonitorTextAddDrive (mon=mon@entry=0x7fffe80010b0, drivestr=drivestr@entry=0x7fffe0202020 "file=/dev/nbd0,if=none,id=drive-virtio-disk3,format=raw")
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/qemu/qemu_monitor_text.c:2836
#13 0x00000000004b0814 in qemuMonitorJSONAddDrive (mon=0x7fffe80010b0, drivestr=0x7fffe0202020 "file=/dev/nbd0,if=none,id=drive-virtio-disk3,format=raw")
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/qemu/qemu_monitor_json.c:2979
#14 0x00000000004a1bad in qemuMonitorAddDrive (mon=<optimized out>, drivestr=<optimized out>) at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/qemu/qemu_monitor.c:2571
#15 0x0000000000484a5d in qemuDomainAttachPciDiskDevice (conn=conn@entry=0x7fffe00111f0, driver=driver@entry=0x81fec0, vm=vm@entry=0x82f6b0, disk=disk@entry=0x7fffe02024d0)
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/qemu/qemu_hotplug.c:250
#16 0x0000000000461d9e in qemuDomainAttachDeviceDiskLive (vm=0x82f6b0, driver=0x81fec0, conn=0x7fffe00111f0, dev=<optimized out>)
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/qemu/qemu_driver.c:5179
#17 qemuDomainAttachDeviceLive (dev=0x7fffe001d5b0, vm=0x82f6b0, dom=<optimized out>) at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/qemu/qemu_driver.c:5238
#18 qemuDomainModifyDeviceFlags (dom=<optimized out>, xml=0x7fffe001d5b0 "\001", flags=<optimized out>, action=<optimized out>)
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/qemu/qemu_driver.c:5779
#19 0x00007ffff7846f5d in virDomainAttachDevice (domain=domain@entry=0x7fffe0201fb0,
xml=0x7fffe0201e50 "<disk type='block'>\n <driver name='qemu' type='raw'/>\n <source dev='/dev/nbd0'/>\n <target dev='vdd'/>\n</disk>\n")
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/libvirt.c:9288
#20 0x000000000043ccfe in remoteDispatchDomainAttachDevice (args=0x7fffe0201ff0, rerr=0x7ffff1760c90, client=<optimized out>, server=<optimized out>, msg=<optimized out>)
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./daemon/remote_dispatch.h:320
#21 remoteDispatchDomainAttachDeviceHelper (server=<optimized out>, client=<optimized out>, msg=<optimized out>, rerr=0x7ffff1760c90, args=0x7fffe0201ff0, ret=<optimized out>)
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./daemon/remote_dispatch.h:298
#22 0x00007ffff788a866 in virNetServerProgramDispatchCall (msg=0x7fffe8093d20, client=0x7fffe8053050, server=0x76e920, prog=0x778880)
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/rpc/virnetserverprogram.c:416
#23 virNetServerProgramDispatch (prog=0x778880, server=server@entry=0x76e920, client=0x7fffe8053050, msg=0x7fffe8093d20)
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/rpc/virnetserverprogram.c:289
#24 0x00007ffff78864d1 in virNetServerHandleJob (jobOpaque=<optimized out>, opaque=0x76e920) at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/rpc/virnetserver.c:161
#25 0x00007ffff77c373e in virThreadPoolWorker (opaque=opaque@entry=0x7789a0) at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/util/threadpool.c:144
#26 0x00007ffff77c31c9 in virThreadHelper (data=<optimized out>) at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/util/threads-pthread.c:161
#27 0x00007ffff4d27b50 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#28 0x00007ffff466b6dd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#29 0x0000000000000000 in ?? ()
(gdb) f 7
#7 0x00007ffff77b75c9 in virJSONValueObjectAppend (object=object@entry=0x91d810, key=key@entry=0x4fef81 "execute", value=value@entry=0x85de90)
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/util/json.c:274
warning: Source file is more recent than executable.
274 if (!(newkey = strdup(key)))
(gdb) l
269 return -1;
270
271 if (virJSONValueObjectHasKey(object, key))
272 return -1;
273
274 if (!(newkey = strdup(key)))
275 return -1;
276
277 if (VIR_REALLOC_N(object->data.object.pairs,
278 object->data.object.npairs + 1) < 0) {
(gdb)
2) another situation:
Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff075f700 (LWP 11697)]
0x00007ffff45c5475 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0 0x00007ffff45c5475 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff45c86f0 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff45ff2fb in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3 0x00007ffff4608b46 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#4 0x00007ffff460d87c in free () from /lib/x86_64-linux-gnu/libc.so.6
#5 0x00007ffff77ba4c9 in virFree (ptrptr=ptrptr@entry=0x7ffff075e8e8) at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/util/memory.c:310
#6 0x000000000049d321 in qemuMonitorHMPCommandWithFd (mon=mon@entry=0x9214e0, cmd=<optimized out>, scm_fd=scm_fd@entry=-1, reply=reply@entry=0x7ffff075e920)
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/qemu/qemu_monitor.c:916
#7 0x00000000004a8bfe in qemuMonitorTextAddDrive (mon=mon@entry=0x9214e0, drivestr=drivestr@entry=0x8f7090 "file=/dev/nbd0,if=none,id=drive-virtio-disk3,format=raw")
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/qemu/qemu_monitor_text.c:2836
#8 0x00000000004b0814 in qemuMonitorJSONAddDrive (mon=0x9214e0, drivestr=0x8f7090 "file=/dev/nbd0,if=none,id=drive-virtio-disk3,format=raw")
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/qemu/qemu_monitor_json.c:2979
#9 0x00000000004a1bad in qemuMonitorAddDrive (mon=<optimized out>, drivestr=<optimized out>) at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/qemu/qemu_monitor.c:2571
#10 0x0000000000484a5d in qemuDomainAttachPciDiskDevice (conn=conn@entry=0x9213c0, driver=driver@entry=0x8162c0, vm=vm@entry=0x820530, disk=disk@entry=0x8f5290)
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/qemu/qemu_hotplug.c:250
#11 0x0000000000461d9e in qemuDomainAttachDeviceDiskLive (vm=0x820530, driver=0x8162c0, conn=0x9213c0, dev=<optimized out>)
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/qemu/qemu_driver.c:5179
#12 qemuDomainAttachDeviceLive (dev=0x8465b0, vm=0x820530, dom=<optimized out>) at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/qemu/qemu_driver.c:5238
#13 qemuDomainModifyDeviceFlags (dom=<optimized out>, xml=0x8465b0 "\001", flags=<optimized out>, action=<optimized out>)
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/qemu/qemu_driver.c:5779
#14 0x00007ffff7846f5d in virDomainAttachDevice (domain=domain@entry=0x8f6080,
xml=0x8f5610 "<disk type='block'>\n <driver name='qemu' type='raw'/>\n <source dev='/dev/nbd0'/>\n <target dev='vdd'/>\n</disk>\n")
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/libvirt.c:9288
#15 0x000000000043ccfe in remoteDispatchDomainAttachDevice (args=0x8f60c0, rerr=0x7ffff075ec90, client=<optimized out>, server=<optimized out>, msg=<optimized out>)
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./daemon/remote_dispatch.h:320
#16 remoteDispatchDomainAttachDeviceHelper (server=<optimized out>, client=<optimized out>, msg=<optimized out>, rerr=0x7ffff075ec90, args=0x8f60c0, ret=<optimized out>)
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./daemon/remote_dispatch.h:298
#17 0x00007ffff788a866 in virNetServerProgramDispatchCall (msg=0x7fffe00929d0, client=0x7fffe0052880, server=0x76e920, prog=0x778880)
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/rpc/virnetserverprogram.c:416
#18 virNetServerProgramDispatch (prog=0x778880, server=server@entry=0x76e920, client=0x7fffe0052880, msg=0x7fffe00929d0)
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/rpc/virnetserverprogram.c:289
#19 0x00007ffff78864d1 in virNetServerHandleJob (jobOpaque=<optimized out>, opaque=0x76e920) at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/rpc/virnetserver.c:161
#20 0x00007ffff77c373e in virThreadPoolWorker (opaque=opaque@entry=0x7789a0) at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/util/threadpool.c:144
#21 0x00007ffff77c31c9 in virThreadHelper (data=<optimized out>) at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/util/threads-pthread.c:161
#22 0x00007ffff4d27b50 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#23 0x00007ffff466b6dd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#24 0x0000000000000000 in ?? ()
(gdb) f 6
#6 0x000000000049d321 in qemuMonitorHMPCommandWithFd (mon=mon@entry=0x9214e0, cmd=<optimized out>, scm_fd=scm_fd@entry=-1, reply=reply@entry=0x7ffff075e920)
at /build/buildd-libvirt_0.9.12-4-amd64-KyxbcZ/libvirt-0.9.12/./src/qemu/qemu_monitor.c:916
916 VIR_FREE(json_cmd);
(gdb) l
911 } else {
912 ret = qemuMonitorTextCommandWithFd(mon, cmd, scm_fd, reply);
913 }
914
915 cleanup:
916 VIR_FREE(json_cmd);
917 return ret;
918 }
919
920 /* Ensure proper locking around callbacks. */
(gdb) p json_cmd
$3 = 0x933c20 "drive_add dummy file=/dev/nbd0,if=none,id=drive-virtio-disk3,format=raw"
(gdb)
anybody can give me any clue? Thanks in advance!
2012-08-16
Wangpan
12 years, 3 months
[libvirt] [PATCH] conf: Fix ABI stability check for spicevmc channel
by Jiri Denemark
Change device type of a virtio channel from/to spicevmc is not a user
visible change. However, spicevmc channels use different default target
name than other virtio channels. To maintain ABI stability during this
change target name must be explicitly specified (and equal) in both
configurations.
---
src/conf/domain_conf.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a2e73c6..a330b0e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10075,6 +10075,15 @@ static bool virDomainChannelDefCheckABIStability(virDomainChrDefPtr src,
NULLSTR(dst->target.name), NULLSTR(src->target.name));
goto cleanup;
}
+ if (src->source.type != dst->source.type &&
+ (src->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC ||
+ dst->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC) &&
+ !src->target.name) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Changing device type to/from spicevmc would"
+ " change default target channel name"));
+ goto cleanup;
+ }
break;
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD:
if (memcmp(src->target.addr, dst->target.addr,
--
1.7.11.1
12 years, 3 months
[libvirt] [PATCH] docs: Enhance documentation of log_filters
by Jiri Denemark
Also make sure documentation in libvirtd.conf matches the one from
logging.html.
---
daemon/libvirtd.conf | 9 ++++++---
docs/logging.html.in | 9 ++++++---
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/daemon/libvirtd.conf b/daemon/libvirtd.conf
index 56e880b..3d296cd 100644
--- a/daemon/libvirtd.conf
+++ b/daemon/libvirtd.conf
@@ -291,10 +291,13 @@
# Logging filters:
# A filter allows to select a different logging level for a given category
# of logs
-# The format for a filter is:
+# The format for a filter is one of:
# x:name
-# where name is a match string e.g. remote or qemu
-# the x prefix is the minimal level where matching messages should be logged
+# x:+name
+# where name is a string which is matched against source file name,
+# e.g., "remote", "qemu", or "util/json", the optional "+" prefix
+# tells libvirt to log stack trace for each message matching name,
+# and x is the minimal level where matching messages should be logged:
# 1: DEBUG
# 2: INFO
# 3: WARNING
diff --git a/docs/logging.html.in b/docs/logging.html.in
index 87e2292..a95f7bc 100644
--- a/docs/logging.html.in
+++ b/docs/logging.html.in
@@ -118,9 +118,12 @@
<pre>
x:name (log message only)
x:+name (log message + stack trace)</pre>
- <p>where <code>name</code> is a match string e.g. <code>remote</code> or
- <code>qemu</code> and the x is the minimal level where matching messages
- should be logged:</p>
+ <p>where <code>name</code> is a string which is matched against source
+ file name, e.g., <code>remote</code>, <code>qemu</code>, or
+ <code>util/json</code>, the optional <code>+</code> prefix tells libvirt
+ to log stack trace for each message matching <code>name</code>, and
+ <code>x</code> is the minimal level where matching messages should
+ be logged:</p>
<ul>
<li>1: DEBUG</li>
<li>2: INFO</li>
--
1.7.11.1
12 years, 3 months
[libvirt] [PATCH 0/3] Storage: Allow pool building while creating it
by Osier Yang
Patch 1/3 is just about the indention fix.
We tries to start the pool while creating a transicient pool,
if the pool target is not existed yet, we must fail on starting,
and thus we see many users raise up the problem on either list
or bugzilla. Patch 2/3 and 3/3 are to fix the problem by introducing
flags to allow the pool building for APIs virStoragePoolCreate
and virStoragePoolCreateXML, and expose the flags to commands
pool-create/pool-create-as/pool-start.
Osier Yang (3):
Fix the indentions of libvirt.h.in
storage: New flags to allow building the pool while creating it
virsh: New options for the 3 pool commands to allow pool building
include/libvirt/libvirt.h.in | 109 +++++++++++++++++++++++------------------
src/libvirt.c | 4 +-
src/storage/storage_driver.c | 38 ++++++++++++++-
tools/virsh.c | 100 ++++++++++++++++++++++++++++++++++++--
tools/virsh.pod | 27 +++++++++-
5 files changed, 217 insertions(+), 61 deletions(-)
Regards,
Osier
--
1.7.7.3
12 years, 3 months