[libvirt] [PATCH] locking: Fix build with sanlock < 2.4
by Jiri Denemark
libvirt started using sanlock_killpath to implement on_lockfailure
action. Since sanlock_killpath was introduced in sanlock 2.4, libvirt
fails to build with older sanlock.
---
configure.ac | 7 +++++++
src/locking/lock_driver_sanlock.c | 13 +++++++++++++
2 files changed, 20 insertions(+)
diff --git a/configure.ac b/configure.ac
index 08dc63d..8810efd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1216,6 +1216,13 @@ if test "x$with_sanlock" != "xno"; then
if test "x$with_sanlock" = "xyes" ; then
AC_DEFINE_UNQUOTED([HAVE_SANLOCK], 1,
[whether Sanlock plugin for lock management is available])
+
+ AC_CHECK_LIB([sanlock_client], [sanlock_killpath],
+ [sanlock_killpath=yes], [sanlock_killpath=no])
+ if test "x$sanlock_killpath" = "xyes" ; then
+ AC_DEFINE_UNQUOTED([HAVE_SANLOCK_KILLPATH], 1,
+ [whether Sanlock supports sanlock_killpath])
+ fi
fi
fi
AM_CONDITIONAL([HAVE_SANLOCK], [test "x$with_sanlock" = "xyes"])
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index a218432..4682701 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -687,6 +687,7 @@ static int virLockManagerSanlockAddResource(virLockManagerPtr lock,
return 0;
}
+#if HAVE_SANLOCK_KILLPATH
static int
virLockManagerSanlockRegisterKillscript(int sock,
const char *vmuri,
@@ -762,6 +763,18 @@ cleanup:
VIR_FREE(args);
return ret;
}
+#else
+static int
+virLockManagerSanlockRegisterKillscript(int sock ATTRIBUTE_UNUSED,
+ const char *vmuri ATTRIBUTE_UNUSED,
+ const char *uuidstr ATTRIBUTE_UNUSED,
+ virDomainLockFailureAction action ATTRIBUTE_UNUSED)
+{
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("sanlock is too old to support lock failure action"));
+ return -1;
+}
+#endif
static int virLockManagerSanlockAcquire(virLockManagerPtr lock,
const char *state,
--
1.7.12.3
12 years, 1 month
[libvirt] [PATCH v3 0/4] command line fd passing using fd sets
by Corey Bryant
This series adds command line file descriptor passing support
via a new -add-fd option. This is a follow-on to the existing
QMP fd passing support provided in the following patch series:
comments.gmane.org/gmane.comp.emulators.qemu/165463
The new -add-fd option is designed to mirror the add-fd QMP
option as much as possible.
Corey Bryant (4):
monitor: Allow add-fd to any specified fd set
monitor: Enable adding an inherited fd to an fd set
monitor: Prevent removing fd from set during init
qemu-config: Add new -add-fd command line option
monitor.c | 142 +++++++++++++++++++++++++++++++++----------------------
monitor.h | 3 ++
qapi-schema.json | 2 +-
qemu-config.c | 22 +++++++++
qemu-options.hx | 36 ++++++++++++++
vl.c | 72 ++++++++++++++++++++++++++++
6 files changed, 220 insertions(+), 57 deletions(-)
--
1.7.11.4
12 years, 1 month
[libvirt] [PATCH] Fix virProcessKillPainfully on Win32
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Win32 platforms don't have SIGKILL defined, but they do have
SIGABRT. Since our virProcess wrapper treats anything which
isn't SIGTERM/SIGINT as equivalent to SIGKILL, just use
SIGABRT on Win32.
Pushed as a Win32 build break fix
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/util/virprocess.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index c70aa58..fee333f 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -267,8 +267,15 @@ virProcessKillPainfully(pid_t pid, bool force)
} else if ((i == 50) & force) {
VIR_DEBUG("Timed out waiting after SIGTERM to process %d, "
"sending SIGKILL", pid);
+ /* No SIGKILL kill on Win32 ! Use SIGABRT instead which our
+ * virProcessKill proc will handle more or less lik SIGKILL */
+#ifdef WIN32
+ signum = SIGABRT; /* kill it after a grace period */
+ signame = "ABRT";
+#else
signum = SIGKILL; /* kill it after a grace period */
signame = "KILL";
+#endif
} else {
signum = 0; /* Just check for existence */
}
--
1.7.11.2
12 years, 1 month
[libvirt] [PATCH] [libvirt-snmp] List inactive domains
by Jorge Boncompte [DTI2]
From: "Jorge Boncompte [DTI2]" <jorge(a)dti2.net>
Monitoring app can't otherwise differentiate between a stopped domain
or a nonexistent one.
Signed-off-by: Jorge Boncompte [DTI2] <jorge(a)dti2.net>
---
src/libvirtSnmp.c | 186 +++++++++++++++++++++++++++++++++++------------------
1 file changed, 123 insertions(+), 63 deletions(-)
diff --git a/src/libvirtSnmp.c b/src/libvirtSnmp.c
index a9fa185..2bd8f01 100644
--- a/src/libvirtSnmp.c
+++ b/src/libvirtSnmp.c
@@ -113,6 +113,82 @@ out:
return;
}
+
+static int
+insertGuest(netsnmp_container *container, virDomainPtr domain)
+{
+ int ret = 0;
+ virDomainInfo info;
+ libvirtGuestTable_rowreq_ctx *row_ctx = NULL;
+ const char *name = NULL;
+ unsigned char uuid[16];
+
+ if (-1 == virDomainGetInfo(domain, &info)) {
+ printf("Failed to get domain info\n");
+ showError(conn);
+ ret = -1;
+ goto out;
+ }
+
+ /* create new row in the container */
+ row_ctx = libvirtGuestTable_allocate_rowreq_ctx(NULL);
+ if (!row_ctx) {
+ snmp_log(LOG_ERR, "Error creating row");
+ ret = -1;
+ goto out;
+ }
+
+ /* set the index of the row */
+ ret = virDomainGetUUID(domain, uuid);
+ if (ret) {
+ snmp_log(LOG_ERR, "Cannot get UUID");
+ libvirtGuestTable_release_rowreq_ctx(row_ctx);
+ ret = -1;
+ goto out;
+ }
+ if (MFD_SUCCESS != libvirtGuestTable_indexes_set(row_ctx, (char*) uuid,
+ sizeof(uuid))) {
+ snmp_log(LOG_ERR, "Error setting row index");
+ libvirtGuestTable_release_rowreq_ctx(row_ctx);
+ ret = -1;
+ goto out;
+ }
+
+ /* set the data */
+ name = virDomainGetName(domain);
+ if (name)
+ row_ctx->data.libvirtGuestName = strdup(name);
+ else
+ row_ctx->data.libvirtGuestName = strdup("");
+ if (!row_ctx->data.libvirtGuestName) {
+ snmp_log(LOG_ERR, "Not enough memory for domain name '%s'", name);
+ libvirtGuestTable_release_rowreq_ctx(row_ctx);
+ ret = -1;
+ goto out;
+ }
+
+ row_ctx->data.libvirtGuestState = info.state;
+ row_ctx->data.libvirtGuestCpuCount = info.nrVirtCpu;
+ /* convert the memory to MiB */
+ row_ctx->data.libvirtGuestMemoryCurrent = info.memory / 1024;
+ row_ctx->data.libvirtGuestMemoryLimit = info.maxMem / 1024;
+ row_ctx->data.libvirtGuestCpuTime.high = info.cpuTime >> 32;
+ row_ctx->data.libvirtGuestCpuTime.low = info.cpuTime & 0xFFFFFFFF;
+
+ row_ctx->data.libvirtGuestRowStatus = ROWSTATUS_ACTIVE;
+
+ ret = CONTAINER_INSERT(container, row_ctx);
+ if (ret) {
+ snmp_log(LOG_ERR, "Cannot insert domain '%s' to container", name);
+ libvirtGuestTable_release_rowreq_ctx(row_ctx);
+ ret = -1;
+ goto out;
+ }
+
+out:
+ return ret;
+}
+
/*
* Populate libvirtGuestTable into given container.
*/
@@ -120,11 +196,10 @@ int
libvirtSnmpLoadGuests(netsnmp_container *container)
{
int ret = 0, i, numIds, numActiveDomains;
+ int numNames, numDefinedDomains;
int *idList = NULL;
+ char **nameList = NULL;
virDomainPtr domain = NULL;
- virDomainInfo info;
- libvirtGuestTable_rowreq_ctx *row_ctx = NULL;
- const char *name = NULL;
numActiveDomains = virConnectNumOfDomains(conn);
if (-1 == numActiveDomains) {
@@ -154,8 +229,6 @@ libvirtSnmpLoadGuests(netsnmp_container *container)
}
for (i = 0 ; i < numIds ; i++) {
- unsigned char uuid[16];
-
domain = virDomainLookupByID(conn, *(idList + i));
if (NULL == domain) {
printf("Failed to lookup domain\n");
@@ -164,74 +237,61 @@ libvirtSnmpLoadGuests(netsnmp_container *container)
goto out;
}
- if (-1 == virDomainGetInfo(domain, &info)) {
- printf("Failed to get domain info\n");
- showError(conn);
- virDomainFree(domain);
- ret = -1;
+ ret = insertGuest(container, domain);
+
+ virDomainFree(domain);
+
+ if (-1 == ret)
goto out;
- }
+ }
- /* create new row in the container */
- row_ctx = libvirtGuestTable_allocate_rowreq_ctx(NULL);
- if (!row_ctx) {
- virDomainFree(domain);
- snmp_log(LOG_ERR, "Error creating row");
- ret = -1;
- goto out;
- }
- /* set the index of the row */
- ret = virDomainGetUUID(domain, uuid);
- if (ret) {
- virDomainFree(domain);
- snmp_log(LOG_ERR, "Cannot get UUID");
- libvirtGuestTable_release_rowreq_ctx(row_ctx);
- ret = -1;
- goto out;
- }
- if (MFD_SUCCESS != libvirtGuestTable_indexes_set(row_ctx, (char*) uuid,
- sizeof(uuid))) {
- virDomainFree(domain);
- snmp_log(LOG_ERR, "Error setting row index");
- libvirtGuestTable_release_rowreq_ctx(row_ctx);
- ret = -1;
- goto out;
- }
+ /* Inactive domains */
+ numDefinedDomains = virConnectNumOfDefinedDomains(conn);
+ if (-1 == numDefinedDomains) {
+ ret = -1;
+ printf("Failed to get number of defined domains\n");
+ showError(conn);
+ goto out;
+ }
- /* set the data */
- name = virDomainGetName(domain);
- if (name)
- row_ctx->data.libvirtGuestName = strdup(name);
- else
- row_ctx->data.libvirtGuestName = strdup("");
- if (!row_ctx->data.libvirtGuestName) {
- snmp_log(LOG_ERR, "Not enough memory for domain name '%s'", name);
- libvirtGuestTable_release_rowreq_ctx(row_ctx);
- ret = -1;
- goto out;
+ nameList = malloc(sizeof(*nameList) * numDefinedDomains);
+
+ if (NULL == nameList) {
+ ret = -1;
+ printf("Could not allocate memory for list of defined domains\n");
+ goto out_inact;
+ }
+
+ numNames = virConnectListDefinedDomains(conn,
+ nameList,
+ numDefinedDomains);
+
+ if (-1 == numNames) {
+ ret = -1;
+ printf("Could not get list of defined domains from hypervisor\n");
+ showError(conn);
+ goto out_inact;
+ }
+
+ for (i = 0 ; i < numNames ; i++) {
+ domain = virDomainLookupByName(conn, *(nameList + i));
+ if (NULL == domain) {
+ printf("Failed to lookup domain\n");
+ showError(conn);
+ ret = -1;
+ goto out_inact;
}
- row_ctx->data.libvirtGuestState = info.state;
- row_ctx->data.libvirtGuestCpuCount = info.nrVirtCpu;
- /* convert the memory to MiB */
- row_ctx->data.libvirtGuestMemoryCurrent = info.memory / 1024;
- row_ctx->data.libvirtGuestMemoryLimit = info.maxMem / 1024;
- row_ctx->data.libvirtGuestCpuTime.high = info.cpuTime >> 32;
- row_ctx->data.libvirtGuestCpuTime.low = info.cpuTime & 0xFFFFFFFF;
+ ret = insertGuest(container, domain);
- row_ctx->data.libvirtGuestRowStatus = ROWSTATUS_ACTIVE;
virDomainFree(domain);
- ret = CONTAINER_INSERT(container, row_ctx);
- if (ret) {
- snmp_log(LOG_ERR, "Cannot insert domain '%s' to container", name);
- libvirtGuestTable_release_rowreq_ctx(row_ctx);
- ret = -1;
- goto out;
- }
-
+ if (-1 == ret)
+ goto out_inact;
}
+out_inact:
+ free(nameList);
out:
free(idList);
return ret;
--
1.7.10.4
12 years, 1 month
[libvirt] [PATCH] tests: Fix domain-events python test
by Martin Kletzander
There was a missing method in python implementation of domain-events
test and this patch adds that.
---
examples/domain-events/events-python/event-test.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/examples/domain-events/events-python/event-test.py b/examples/domain-events/events-python/event-test.py
index 813b1c2..2bb5195 100644
--- a/examples/domain-events/events-python/event-test.py
+++ b/examples/domain-events/events-python/event-test.py
@@ -492,6 +492,9 @@ def myDomainEventPMSuspendCallback(conn, dom, reason, opaque):
dom.name(), dom.ID())
def myDomainEventBalloonChangeCallback(conn, dom, utcoffset, actual):
print "myDomainEventBalloonChangeCallback: Domain %s(%s) %d" % (dom.name(), dom.ID(), actual)
+def myDomainEventPMSuspendDiskCallback(conn, dom, reason, opaque):
+ print "myDomainEventPMSuspendDiskCallback: Domain %s(%s) system pmsuspend_disk" % (
+ dom.name(), dom.ID())
def usage(out=sys.stderr):
print >>out, "usage: "+os.path.basename(sys.argv[0])+" [-hdl] [uri]"
print >>out, " uri will default to qemu:///system"
--
1.7.12.3
12 years, 1 month
[libvirt] [PATCH] maint: prepare for next release number
by Eric Blake
Given Daniel's announcement[1], code targetting the next release will
be in 1.0.0, not 0.10.3. Changed mechanically with:
for f in $(git grep -l '0\(.\)10\13\b') ; do
sed -i -e 's/0\(.\)10\13/1\10\10/g' $f
done
[1]https://www.redhat.com/archives/libvir-list/2012-October/msg00403.html
* docs/formatdomain.html.in: Use 1.0.0 for next release.
* src/interface/interface_backend_udev.c: Likewise.
---
Any objections?
docs/formatdomain.html.in | 4 ++--
src/interface/interface_backend_udev.c | 20 ++++++++++----------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 1ae8cf4..ad8a41b 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -989,7 +989,7 @@
<p>
The <code>on_lockfailure</code> element (<span class="since">since
- 0.10.3</span>) may be used to configure what action should be
+ 1.0.0</span>) may be used to configure what action should be
taken when a lock manager loses resource locks. The following
actions are recognized by libvirt, although not all of them need
to be supported by individual lock managers. When no action is
@@ -2140,7 +2140,7 @@
address on the hosts using the <code>address</code> element. PCI devices
on the other hand can only be described by their <code>address</code>.
- <span class="since">Since 0.10.3</span>, the <code>source</code> element
+ <span class="since">Since 1.0.0</span>, the <code>source</code> element
of USB devices may contain <code>startupPolicy</code> attribute which can
be used to define policy what to do if the specified host USB device is
not found. The attribute accepts the following values:
diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
index 1cb6dfe..0cb344e 100644
--- a/src/interface/interface_backend_udev.c
+++ b/src/interface/interface_backend_udev.c
@@ -520,16 +520,16 @@ cleanup:
static virInterfaceDriver udevIfaceDriver = {
"udev",
- .open = udevIfaceOpenInterface, /* 0.10.3 */
- .close = udevIfaceCloseInterface, /* 0.10.3 */
- .numOfInterfaces = udevIfaceNumOfInterfaces, /* 0.10.3 */
- .listInterfaces = udevIfaceListInterfaces, /* 0.10.3 */
- .numOfDefinedInterfaces = udevIfaceNumOfDefinedInterfaces, /* 0.10.3 */
- .listDefinedInterfaces = udevIfaceListDefinedInterfaces, /* 0.10.3 */
- .listAllInterfaces = udevIfaceListAllInterfaces, /* 0.10.3 */
- .interfaceLookupByName = udevIfaceLookupByName, /* 0.10.3 */
- .interfaceLookupByMACString = udevIfaceLookupByMACString, /* 0.10.3 */
- .interfaceIsActive = udevIfaceIsActive, /* 0.10.3 */
+ .open = udevIfaceOpenInterface, /* 1.0.0 */
+ .close = udevIfaceCloseInterface, /* 1.0.0 */
+ .numOfInterfaces = udevIfaceNumOfInterfaces, /* 1.0.0 */
+ .listInterfaces = udevIfaceListInterfaces, /* 1.0.0 */
+ .numOfDefinedInterfaces = udevIfaceNumOfDefinedInterfaces, /* 1.0.0 */
+ .listDefinedInterfaces = udevIfaceListDefinedInterfaces, /* 1.0.0 */
+ .listAllInterfaces = udevIfaceListAllInterfaces, /* 1.0.0 */
+ .interfaceLookupByName = udevIfaceLookupByName, /* 1.0.0 */
+ .interfaceLookupByMACString = udevIfaceLookupByMACString, /* 1.0.0 */
+ .interfaceIsActive = udevIfaceIsActive, /* 1.0.0 */
};
int
--
1.7.11.7
12 years, 1 month
[libvirt] [PATCH] maint: fix license on polkit script
by Eric Blake
As approved here:
https://www.redhat.com/archives/libvir-list/2012-October/msg00701.html
* daemon/libvirtd.policy.in: Use LGPLv2+ license.
---
I'm waiting for an ack on this one - even though the change is only to
comments, I am taking due caution to ensure no one was trying to use
this in an exact LGPLv2.0 setup, where changing to LGPLv2.1+ to match
the rest of libvirt would hurt them.
daemon/libvirtd.policy.in | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/daemon/libvirtd.policy.in b/daemon/libvirtd.policy.in
index 000c17e..2ec7716 100644
--- a/daemon/libvirtd.policy.in
+++ b/daemon/libvirtd.policy.in
@@ -6,10 +6,22 @@
<!--
Policy definitions for libvirt daemon
-Copyright (c) 2007 Daniel P. Berrange <berrange redhat com>
+Copyright (C) 2012 Red Hat, Inc.
+Copyright (C) 2007 Daniel P. Berrange <berrange redhat com>
-libvirt is licensed to you under the GNU Lesser General Public License
-version 2. See COPYING for details.
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library. If not, see
+<http://www.gnu.org/licenses/>.
-->
<policyconfig>
--
1.7.11.7
12 years, 1 month
[libvirt] [PATCH 00/12]
by Daniel P. Berrange
An update of
https://www.redhat.com/archives/libvir-list/2012-August/msg00618.html
Mostly this is a rebase to latest GIT. Alot of the questions raised
with review last time bogged down on whether the APIs were design
in the right way. I think I clarified their intended usage, so
hopefully we can do code review this time :-)
There are still a few more patches to add on to this
- Serialize the tx/rx message queues so we don't loose
partially sent/received messages across re-exec()
- Make fcntl driver more configurable in its behaviour
- Add support for leases based on LVM UUID and SCSI
WWN
12 years, 1 month
[libvirt] [PATCH] conf: add test for boot dev and order
by Martin Kletzander
Add test for 280b8c9e7c94db1decdca08d169c88554c09fa19.
---
.../qemuxml2argv-boot-dev+order.xml | 56 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 3 ++
2 files changed, 59 insertions(+)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-boot-dev+order.xml
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-dev+order.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-dev+order.xml
new file mode 100644
index 0000000..ad3d88c
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-dev+order.xml
@@ -0,0 +1,56 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ <boot dev='cdrom'/>
+ <boot dev='network'/>
+ </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'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <source file='/root/boot.iso'/>
+ <target dev='hdc' bus='ide'/>
+ <readonly/>
+ <boot order='1'/>
+ <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='sheepdog' name='image'>
+ <host name='example.org' port='6000'/>
+ </source>
+ <target dev='vda' bus='virtio'/>
+ <boot order='3'/>
+ </disk>
+ <disk type='file' device='floppy'>
+ <driver name='qemu' type='raw'/>
+ <source file='/dev/null'/>
+ <target dev='fdb' bus='fdc'/>
+ <boot order='4'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='1'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <controller type='fdc' index='0'/>
+ <interface type='user'>
+ <mac address='00:11:22:33:44:55'/>
+ <model type='virtio'/>
+ <boot order='2'/>
+ </interface>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 7732ae1..3ecd957 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -375,6 +375,9 @@ mymain(void)
DO_TEST("boot-menu-disable-drive-bootindex",
QEMU_CAPS_BOOT_MENU, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
QEMU_CAPS_BOOTINDEX);
+ DO_TEST_PARSE_ERROR("boot-dev+order",
+ QEMU_CAPS_BOOTINDEX, QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE,
+ QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
DO_TEST("boot-order",
QEMU_CAPS_BOOTINDEX, QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE,
QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
--
1.7.12.3
12 years, 1 month
[libvirt] [RFC][PATCH] change the meaning of vnc port in xml
by Hu Tao
Now the vnc port in xml file reflects the REAL port hypervisor will
listen on for vnc connection. But vnc ports usually start from 5900,
it's common to say 0 for 5900, 1 for 5901, and so on.
This patch forbids negative vnc port number in xml, and maps port
number below 5900 to 5900+port, but no change to those greater than
5900.
---
I have no idea whether this behaviour is sane or not. But my vnc
client(vinagre) has the same behaviour, i.e., treats port 0 as 5900,
1 as 5901, but 5900 as 5900, 5901 as 5901.
src/conf/domain_conf.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0cea8eb..b3cbc34 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6423,6 +6423,12 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
if (flags & VIR_DOMAIN_XML_INACTIVE)
def->data.vnc.port = 0;
def->data.vnc.autoport = 1;
+ } else if (def->data.vnc.port < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("invalid vnc port %s"), port);
+ goto error;
+ } else if (def->data.vnc.port < 5900) {
+ def->data.vnc.port += 5900;
}
} else {
def->data.vnc.port = 0;
--
1.7.10.2
12 years, 1 month