[libvirt] [PATCH 0/4] Plug some virsh leaks
by Ján Tomko
https://bugzilla.redhat.com/show_bug.cgi?id=1001536
Ján Tomko (4):
virsh: free messages after logging them to a file
virsh: free the list from ListAll APIs even for 0 items
virsh: free the formatting string when listing pool details
virsh: free the caps list properly if one of them is invalid
tools/virsh-interface.c | 2 +-
tools/virsh-network.c | 2 +-
tools/virsh-nodedev.c | 6 +++---
tools/virsh-nwfilter.c | 2 +-
tools/virsh-pool.c | 3 ++-
tools/virsh-secret.c | 2 +-
tools/virsh.c | 1 +
7 files changed, 10 insertions(+), 8 deletions(-)
--
1.8.1.5
11 years, 3 months
[libvirt] [PATCH] qemu: Add missing VIR_DOMAIN_BLOCK_COMMIT_DELETE flags
by Alex Jia
The flag "VIR_DOMAIN_BLOCK_COMMIT_DELETE" is missed by qemuDomainBlockCommit(),
and then will hit error "unsupported flags (0x2) in function
qemuDomainBlockCommit" if users run 'virsh blockcommit' with '--delete' option.
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1001475
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
src/qemu/qemu_driver.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ed29373..8863124 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14444,7 +14444,8 @@ qemuDomainBlockCommit(virDomainPtr dom, const char *path, const char *base,
const char *base_canon = NULL;
bool clean_access = false;
- virCheckFlags(VIR_DOMAIN_BLOCK_COMMIT_SHALLOW, -1);
+ virCheckFlags(VIR_DOMAIN_BLOCK_COMMIT_SHALLOW |
+ VIR_DOMAIN_BLOCK_COMMIT_DELETE, -1);
if (!(vm = qemuDomObjFromDomain(dom)))
goto cleanup;
--
1.7.1
11 years, 3 months
[libvirt] How about realize domainSetBlockIoTune by cgroup?
by hzguanqiang@corp.netease.com
Hello experts,
It seems that blkiotune of kvm domain is set through qemu now, and We found there are some throttle shaking problem when using this interface.
As you can do the same thing through blkio cgroup, and this sounds to show better performance, Can we realize domainSetBlockIoTune by cgroup just like interface domainSetBlkioParameters ? Or Add a new interface to support setting disk IOtune by blkio cgroup?
Thanks
------------------
Best regards!
GuanQiang
2013-08-27
11 years, 3 months
[libvirt] [PATCH] Use loop-control to allocate loopback device.
by Ian Main
This patch changes virFileLoopDeviceOpen() to use the new loop-control
device to allocate a new loop device. If this behavior is unsupported
or an error occurs while trying to do this it falls back to the previous
method of searching /dev for a free device.
With this patch you can start as many image based LXC domains as you
like (well almost).
Fixes bug https://bugzilla.redhat.com/show_bug.cgi?id=995543
Signed-off-by: Ian Main <imain(a)redhat.com>
---
configure.ac | 12 +++++++++++
src/util/virfile.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 72 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index ac8cfa1..10cd872 100644
--- a/configure.ac
+++ b/configure.ac
@@ -913,6 +913,18 @@ if test "$with_lxc" = "yes" || test "$with_lxc" = "check"; then
AC_MSG_ERROR([Required kernel features for LXC were not found])
fi
])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(
+ [[
+ #include <sched.h>
+ #include <linux/loop.h>
+ #include <sys/epoll.h>
+ ]], [[
+ unshare(!(LOOP_CTL_GET_FREE));
+ ]])], [
+ AC_DEFINE([HAVE_DECL_LOOP_CTL_GET_FREE], [1],
+ [Define to 1 if you have the declaration of `LOOP_CTL_GET_FREE',
+ and to 0 if you don't.])
+ ])
fi
if test "$with_lxc" = "yes" ; then
AC_DEFINE_UNQUOTED([WITH_LXC], 1, [whether LXC driver is enabled])
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 2b07ac9..f70f9fe 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -528,7 +528,47 @@ int virFileUpdatePerm(const char *path,
#if defined(__linux__) && HAVE_DECL_LO_FLAGS_AUTOCLEAR
-static int virFileLoopDeviceOpen(char **dev_name)
+
+#if HAVE_DECL_LOOP_CTL_GET_FREE
+static int virFileLoopDeviceOpenLoopCtl(char **dev_name)
+{
+ int fd = -1;
+ int devnr;
+ char *looppath = NULL;
+
+ VIR_DEBUG("Opening loop-control device");
+ if ((fd = open("/dev/loop-control", O_RDWR)) < 0) {
+ virReportSystemError(errno, "%s",
+ _("Unable to open /dev/loop-control"));
+ return -1;
+ }
+
+ if ((devnr = ioctl(fd, LOOP_CTL_GET_FREE)) < 0) {
+ virReportSystemError(errno, "%s",
+ _("Unable to get free loop device via ioctl"));
+ close(fd);
+ return -1;
+ }
+ close(fd);
+
+ VIR_DEBUG("Found free loop device number %i", devnr);
+
+ if (virAsprintf(&looppath, "/dev/loop%i", devnr) < 0)
+ return -1;
+
+ if ((fd = open(looppath, O_RDWR)) < 0) {
+ virReportSystemError(errno,
+ _("Unable to open %s"), looppath);
+ VIR_FREE(looppath);
+ return -1;
+ }
+
+ *dev_name = looppath;
+ return fd;
+}
+#endif /* HAVE_DECL_LOOP_CTL_GET_FREE */
+
+static int virFileLoopDeviceOpenSearch(char **dev_name)
{
int fd = -1;
DIR *dh = NULL;
@@ -601,6 +641,25 @@ cleanup:
return fd;
}
+static int virFileLoopDeviceOpen(char **dev_name)
+{
+ int loop_fd;
+
+#ifdef HAVE_DECL_LOOP_CTL_GET_FREE
+ loop_fd = virFileLoopDeviceOpenLoopCtl(dev_name);
+ VIR_DEBUG("Return from loop-control got fd %d\n", loop_fd);
+ if (loop_fd < 0) {
+ VIR_WARN("loop-control allocation failed, trying search technique.");
+ } else {
+ return loop_fd;
+ }
+#endif /* HAVE_DECL_LOOP_CTL_GET_FREE */
+
+ /* Without the loop control device we just use the old technique. */
+ loop_fd = virFileLoopDeviceOpenSearch(dev_name);
+
+ return loop_fd;
+}
int virFileLoopDeviceAssociate(const char *file,
char **dev)
--
1.8.1.4
11 years, 3 months
[libvirt] [PATCH v3 0/4] Add support for adjusting the 64-bit PCI hole size
by Ján Tomko
v3:
use <pcihole64> sub-element of the root PCI controller
with 'unit' attribute, defaulting to KiB
v2:
https://www.redhat.com/archives/libvir-list/2013-August/msg00565.html
Use 'pcihole64' attribute of the root PCI controller
instead of <pcihole64> element in domain features.
v1:
https://www.redhat.com/archives/libvir-list/2013-August/msg00510.html
https://bugzilla.redhat.com/show_bug.cgi?id=990418
Ján Tomko (4):
Move virDomainParseScaledValue earlier
Allow controller XML parsing to use XPath context
Add pcihole64 element to root PCI controllers
Build QEMU command line for pcihole64
docs/formatdomain.html.in | 9 ++
docs/schemas/domaincommon.rng | 32 +++--
src/conf/domain_conf.c | 140 +++++++++++++--------
src/conf/domain_conf.h | 8 ++
src/qemu/qemu_capabilities.c | 14 +++
src/qemu/qemu_capabilities.h | 2 +
src/qemu/qemu_command.c | 58 +++++++++
.../qemuxml2argv-pcihole64-gib.xml | 23 ++++
.../qemuxml2argv-pcihole64-none.args | 4 +
.../qemuxml2argv-pcihole64-none.xml | 23 ++++
.../qemuxml2argv-pcihole64-q35.args | 9 ++
.../qemuxml2argv-pcihole64-q35.xml | 33 +++++
tests/qemuxml2argvdata/qemuxml2argv-pcihole64.args | 5 +
tests/qemuxml2argvdata/qemuxml2argv-pcihole64.xml | 23 ++++
tests/qemuxml2argvtest.c | 10 ++
.../qemuxml2xmlout-pcihole64-gib.xml | 23 ++++
tests/qemuxml2xmltest.c | 5 +
17 files changed, 358 insertions(+), 63 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcihole64-gib.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcihole64-none.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcihole64-none.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcihole64.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcihole64.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-gib.xml
--
1.8.1.5
11 years, 3 months
[libvirt] [PATCHv4 0/5] Introduce API to query IP addresses for given domain
by Nehal J Wani
This feature has been requested for a very long time. Since qemu guest
agent gives us reliable results, now the wait is over.
The RFC was first proposed by Michal Privoznik:
http://www.mail-archive.com/libvir-list@redhat.com/msg51857.html
A patch was submitted, using structs:
http://www.mail-archive.com/libvir-list@redhat.com/msg57141.html
Another patch was submitted, using XML:
http://www.mail-archive.com/libvir-list@redhat.com/msg57829.html
Neither of the patches were accepted, probably due to lack of extensibility
and usability. Hence, we thought of using virTypedParameters for reporting
list of interfaces along with their MAC address and IP addresses. The RFC
can be found here:
http://www.mail-archive.com/libvir-list@redhat.com/msg79793.html
The idea of extensibility was rejected and rendered out of scope of
libvirt. Hence, we were back to structs.
This API is called virDomainInterfacesAddresses which returns a dynamically
allocated array of virDomainInterface struct. The great disadvantage is
once this gets released, it's written in stone and we cannot change
or add an item into it.
The API supports two methods:
* Return information (list of all associated interfaces with MAC address
and IP addresses) of all of the domain interfaces by default (if
no interface name is provided)
* Return information for the specified interface (if an interface name
is provided)
Nehal J Wani (5):
domifaddr: Implement the public API
domifaddr: Implement the remote protocol
domifaddr: Implement the API for qemu
domifaddr: Add virsh support
domifaddr: Expose python binding
daemon/remote.c | 127 +++++++++++++++++++++++++++++++++
examples/python/Makefile.am | 2 +-
examples/python/README | 1 +
examples/python/domipaddrs.py | 50 +++++++++++++
include/libvirt/libvirt.h.in | 33 +++++++++
python/generator.py | 3 +
python/libvirt-override-api.xml | 8 ++-
python/libvirt-override.c | 113 +++++++++++++++++++++++++++++
src/driver.h | 6 ++
src/libvirt.c | 109 ++++++++++++++++++++++++++++
src/libvirt_public.syms | 6 ++
src/qemu/qemu_agent.c | 153 ++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_agent.h | 3 +
src/qemu/qemu_driver.c | 55 +++++++++++++++
src/remote/remote_driver.c | 85 ++++++++++++++++++++++
src/remote/remote_protocol.x | 41 ++++++++++-
src/remote_protocol-structs | 24 +++++++
tests/qemuagenttest.c | 113 +++++++++++++++++++++++++++++
tools/virsh-domain-monitor.c | 101 ++++++++++++++++++++++++++
tools/virsh.pod | 10 +++
20 files changed, 1040 insertions(+), 3 deletions(-)
create mode 100755 examples/python/domipaddrs.py
--
1.7.11.7
11 years, 3 months
[libvirt] [PATCHv2 0/4] VMX: CD-ROM handling improvements
by Doug Goldstein
A user came into #virt the other day and was trying to get libvirtd
to work with VMWare Fusion 5, which is basically the Mac OS X version of
VMWare Workstation. In helping him out I noticed a few limitations of our
VMX parser so I've added support through this patchset. However I came
across the fact that we only support 2 types of CD-ROMs instead of the 3
types that VMWare has lead to adding support for a <driver> element to
CD-ROM drives. Additionally VMWare Fusion has a concept of auto detecting
your host CD-ROM drive at boot and we don't have a XML field for this so
I omitted a <source> element and added the tray to be opened.
Doug Goldstein (4):
VMX: Add cdrom-raw dev type from VMWare Fusion
VMX: Add support for 'auto detect' fileNames
VMX: Some serial ports are not actually connected
VMX: Add a VMWare Fusion 5 configuration for tests
docs/formatdomain.html.in | 3 +-
src/vmx/vmx.c | 61 ++++++++++++---
tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml | 1 +
.../vmx2xml-cdrom-ide-raw-auto-detect.vmx | 5 ++
.../vmx2xml-cdrom-ide-raw-auto-detect.xml | 24 ++++++
tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.vmx | 5 ++
tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml | 25 ++++++
tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml | 1 +
.../vmx2xml-cdrom-scsi-raw-auto-detect.vmx | 6 ++
.../vmx2xml-cdrom-scsi-raw-auto-detect.xml | 24 ++++++
.../vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.vmx | 6 ++
.../vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.xml | 25 ++++++
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml | 1 +
tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx | 88 ++++++++++++++++++++++
tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml | 39 ++++++++++
tests/vmx2xmltest.c | 6 ++
.../xml2vmxdata/xml2vmx-cdrom-ide-atapi-device.vmx | 13 ++++
.../xml2vmxdata/xml2vmx-cdrom-ide-atapi-device.xml | 15 ++++
.../xml2vmx-cdrom-ide-raw-auto-detect.vmx | 14 ++++
.../xml2vmx-cdrom-ide-raw-auto-detect.xml | 14 ++++
tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.vmx | 13 ++++
tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.xml | 15 ++++
.../xml2vmx-cdrom-scsi-atapi-device.vmx | 14 ++++
.../xml2vmx-cdrom-scsi-atapi-device.xml | 15 ++++
.../xml2vmx-cdrom-scsi-raw-auto-detect.vmx | 15 ++++
.../xml2vmx-cdrom-scsi-raw-auto-detect.xml | 14 ++++
.../xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.vmx | 14 ++++
.../xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.xml | 15 ++++
tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx | 30 ++++++++
tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml | 40 ++++++++++
tests/xml2vmxtest.c | 8 ++
31 files changed, 558 insertions(+), 11 deletions(-)
create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.xml
create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml
create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.xml
create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.xml
create mode 100644 tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml
create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-atapi-device.vmx
create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-atapi-device.xml
create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-auto-detect.vmx
create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-auto-detect.xml
create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.vmx
create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.xml
create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-atapi-device.vmx
create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-atapi-device.xml
create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-auto-detect.vmx
create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-auto-detect.xml
create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.vmx
create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.xml
create mode 100644 tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx
create mode 100644 tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml
--
1.8.1.5
11 years, 3 months
[libvirt] [RFC] Expose cpu_map.xml via API
by Giuseppe Scrivano
---
I have started working on:
https://bugzilla.redhat.com/show_bug.cgi?id=916786
Before I split it in a series of commits, test it better and then
proceed to virt-manager, are you ok with this idea?
include/libvirt/libvirt.h.in | 11 +++++++++++
src/driver.h | 4 ++++
src/libvirt.c | 38 ++++++++++++++++++++++++++++++++++++++
src/libvirt_private.syms | 1 +
src/libvirt_public.syms | 1 +
src/lxc/lxc_driver.c | 11 +++++++++++
src/qemu/qemu_driver.c | 10 ++++++++++
src/remote/remote_driver.c | 1 +
src/remote/remote_protocol.x | 12 +++++++++++-
src/remote_protocol-structs | 4 ++++
src/test/test_driver.c | 6 ++++++
src/uml/uml_driver.c | 11 +++++++++++
src/util/virutil.c | 23 +++++++++++++++++++++++
src/util/virutil.h | 3 +++
tools/virsh-host.c | 21 +++++++++++++++++++++
tools/virsh.pod | 5 +++++
16 files changed, 161 insertions(+), 1 deletion(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index a47e33c..d6e0d9a 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -4006,6 +4006,17 @@ int virConnectCompareCPU(virConnectPtr conn,
const char *xmlDesc,
unsigned int flags);
+/**
+ * virConnectGetCPUMapDesc:
+ *
+ * @conn: virConnect connection
+ *
+ * Get the content of the cpu_map.xml file used by the connection.
+ *
+ * Returns XML description of the cpu_map.xml file.
+ */
+char *virConnectGetCPUMapDesc(virConnectPtr conn);
+
/**
* virConnectBaselineCPUFlags
diff --git a/src/driver.h b/src/driver.h
index be64333..ab31262 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -681,6 +681,9 @@ typedef char *
unsigned int ncpus,
unsigned int flags);
+typedef char *
+(*virDrvConnectGetCPUMapDesc)(virConnectPtr conn);
+
typedef int
(*virDrvDomainGetJobInfo)(virDomainPtr domain,
virDomainJobInfoPtr info);
@@ -1332,6 +1335,7 @@ struct _virDriver {
virDrvDomainMigratePerform3Params domainMigratePerform3Params;
virDrvDomainMigrateFinish3Params domainMigrateFinish3Params;
virDrvDomainMigrateConfirm3Params domainMigrateConfirm3Params;
+ virDrvConnectGetCPUMapDesc connectGetCPUMapDesc;
};
diff --git a/src/libvirt.c b/src/libvirt.c
index 07a3fd5..5e5e594 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -18519,6 +18519,44 @@ error:
/**
+ * virConnectGetCPUMapDesc:
+ *
+ * @conn: virConnect connection
+ *
+ * Get the content of the cpu_map.xml file used by the connection.
+ *
+ * Returns the content of the cpu_map.xml file. The result must be freed
+ * by the caller of this function.
+ */
+char *
+virConnectGetCPUMapDesc(virConnectPtr conn)
+{
+ VIR_DEBUG("conn=%p", conn);
+
+ virResetLastError();
+
+ if (!VIR_IS_CONNECT(conn)) {
+ virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virDispatchError(NULL);
+ return NULL;
+ }
+
+ if (conn->driver->connectGetCPUMapDesc) {
+ char *ret = conn->driver->connectGetCPUMapDesc(conn);
+ if (ret == NULL)
+ goto error;
+ return ret;
+ }
+
+ virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+ virDispatchError(conn);
+ return NULL;
+}
+
+
+/**
* virConnectBaselineCPU:
*
* @conn: virConnect connection
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index c25a61f..ed6d2a0 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2074,6 +2074,7 @@ virSetUIDGID;
virSetUIDGIDWithCaps;
virStrIsPrint;
virValidateWWN;
+virGetCPUMapDesc;
# util/viruuid.h
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index bbdf78a..8023c7e 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -629,6 +629,7 @@ LIBVIRT_1.1.0 {
LIBVIRT_1.1.1 {
global:
+ virConnectGetCPUMapDesc;
virDomainCreateWithFiles;
virDomainCreateXMLWithFiles;
virDomainSetMemoryStatsPeriod;
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 9cb95ff..633248b 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -4590,6 +4590,16 @@ lxcNodeSuspendForDuration(virConnectPtr conn,
}
+static char *
+lxcConnectGetCPUMapDesc(virConnectPtr conn)
+{
+ if (virConnectGetCPUMapDescEnsureACL(conn) < 0)
+ return NULL;
+
+ return virGetCPUMapDesc();
+}
+
+
/* Function Tables */
static virDriver lxcDriver = {
.no = VIR_DRV_LXC,
@@ -4671,6 +4681,7 @@ static virDriver lxcDriver = {
.domainShutdownFlags = lxcDomainShutdownFlags, /* 1.0.1 */
.domainReboot = lxcDomainReboot, /* 1.0.1 */
.domainLxcOpenNamespace = lxcDomainLxcOpenNamespace, /* 1.0.2 */
+ .connectGetCPUMapDesc = lxcConnectGetCPUMapDesc, /* 1.1.0 */
};
static virStateDriver lxcStateDriver = {
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2ad236e..4a1d6fa 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16033,6 +16033,15 @@ qemuNodeSuspendForDuration(virConnectPtr conn,
return nodeSuspendForDuration(target, duration, flags);
}
+static char *
+qemuConnectGetCPUMapDesc(virConnectPtr conn)
+{
+ if (virConnectGetCPUMapDescEnsureACL(conn) < 0)
+ return NULL;
+
+ return virGetCPUMapDesc();
+}
+
static virDriver qemuDriver = {
.no = VIR_DRV_QEMU,
@@ -16220,6 +16229,7 @@ static virDriver qemuDriver = {
.domainMigratePerform3Params = qemuDomainMigratePerform3Params, /* 1.1.0 */
.domainMigrateFinish3Params = qemuDomainMigrateFinish3Params, /* 1.1.0 */
.domainMigrateConfirm3Params = qemuDomainMigrateConfirm3Params, /* 1.1.0 */
+ .connectGetCPUMapDesc = qemuConnectGetCPUMapDesc, /* 1.1.0 */
};
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 71d0034..017c7af 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -6811,6 +6811,7 @@ static virDriver remote_driver = {
.domainMigratePerform3Params = remoteDomainMigratePerform3Params, /* 1.1.0 */
.domainMigrateFinish3Params = remoteDomainMigrateFinish3Params, /* 1.1.0 */
.domainMigrateConfirm3Params = remoteDomainMigrateConfirm3Params, /* 1.1.0 */
+ .connectGetCPUMapDesc = remoteConnectGetCPUMapDesc, /* 1.1.0 */
};
static virNetworkDriver network_driver = {
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 7cfebdf..6e17b41 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -2837,6 +2837,10 @@ struct remote_domain_event_device_removed_msg {
remote_nonnull_string devAlias;
};
+struct remote_connect_get_cpu_map_desc_ret {
+ remote_nonnull_string xml;
+};
+
/*----- Protocol. -----*/
/* Define the program number, protocol version and procedure numbers here. */
@@ -5000,5 +5004,11 @@ enum remote_procedure {
* @generate: both
* @acl: none
*/
- REMOTE_PROC_DOMAIN_EVENT_DEVICE_REMOVED = 311
+ REMOTE_PROC_DOMAIN_EVENT_DEVICE_REMOVED = 311,
+
+ /**
+ * @generate: both
+ * @acl: connect:read
+ */
+ REMOTE_PROC_CONNECT_GET_CPU_MAP_DESC = 312
};
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index 4e27aae..ce1e9f5 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -2316,6 +2316,9 @@ struct remote_domain_event_device_removed_msg {
remote_nonnull_domain dom;
remote_nonnull_string devAlias;
};
+struct remote_connect_get_cpu_map_desc_ret {
+ remote_nonnull_string xml;
+};
enum remote_procedure {
REMOTE_PROC_CONNECT_OPEN = 1,
REMOTE_PROC_CONNECT_CLOSE = 2,
@@ -2628,4 +2631,5 @@ enum remote_procedure {
REMOTE_PROC_DOMAIN_CREATE_XML_WITH_FILES = 309,
REMOTE_PROC_DOMAIN_CREATE_WITH_FILES = 310,
REMOTE_PROC_DOMAIN_EVENT_DEVICE_REMOVED = 311,
+ REMOTE_PROC_CONNECT_GET_CPU_MAP_DESC = 312,
};
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index d7b2e40..82610b3 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -5801,6 +5801,11 @@ testDomainScreenshot(virDomainPtr dom ATTRIBUTE_UNUSED,
return ret;
}
+static char *
+testConnectGetCPUMapDesc(virConnectPtr conn ATTRIBUTE_UNUSED)
+{
+ return virGetCPUMapDesc();
+}
static virDriver testDriver = {
.no = VIR_DRV_TEST,
@@ -5872,6 +5877,7 @@ static virDriver testDriver = {
.connectIsAlive = testConnectIsAlive, /* 0.9.8 */
.nodeGetCPUMap = testNodeGetCPUMap, /* 1.0.0 */
.domainScreenshot = testDomainScreenshot, /* 1.0.5 */
+ .connectGetCPUMapDesc = testConnectGetCPUMapDesc, /* 1.1.0 */
};
static virNetworkDriver testNetworkDriver = {
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 9ca352f..2aa2c08 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -2831,6 +2831,16 @@ umlNodeSuspendForDuration(virConnectPtr conn,
}
+static char *
+umlConnectGetCPUMapDesc(virConnectPtr conn)
+{
+ if (virConnectGetCPUMapDescEnsureACL(conn) < 0)
+ return NULL;
+
+ return virGetCPUMapDesc();
+}
+
+
static virDriver umlDriver = {
.no = VIR_DRV_UML,
.name = "UML",
@@ -2892,6 +2902,7 @@ static virDriver umlDriver = {
.nodeSuspendForDuration = umlNodeSuspendForDuration, /* 0.9.8 */
.nodeGetMemoryParameters = umlNodeGetMemoryParameters, /* 0.10.2 */
.nodeSetMemoryParameters = umlNodeSetMemoryParameters, /* 0.10.2 */
+ .connectGetCPUMapDesc = umlConnectGetCPUMapDesc, /* 1.1.0 */
};
static virStateDriver umlStateDriver = {
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 34f5998..9d71a53 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -80,6 +80,7 @@
#include "virprocess.h"
#include "virstring.h"
#include "virutil.h"
+#include "configmake.h"
#ifndef NSIG
# define NSIG 32
@@ -2116,3 +2117,25 @@ cleanup:
return rc;
}
+
+char *
+virGetCPUMapDesc(void)
+{
+ char *data, *ret = NULL;
+ int len;
+ const char *cpumapfile = PKGDATADIR "/cpu_map.xml";
+ if ((len = virFileReadAll(cpumapfile, 1024 * 1024, &data)) < 0) {
+ goto cleanup;
+ }
+
+ if (VIR_ALLOC_N(ret, len + 1) < 0) {
+ goto cleanup;
+ }
+
+ memcpy(ret, data, len);
+ ret[len] = '\0';
+
+cleanup:
+ VIR_FREE(data);
+ return ret;
+}
diff --git a/src/util/virutil.h b/src/util/virutil.h
index 4b06992..11030c5 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -172,4 +172,7 @@ int virCompareLimitUlong(unsigned long long a, unsigned long b);
int virParseOwnershipIds(const char *label, uid_t *uidPtr, gid_t *gidPtr);
+
+char *virGetCPUMapDesc(void);
+
#endif /* __VIR_UTIL_H__ */
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 880ae4b..3bc4f73 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -626,6 +626,21 @@ cmdURI(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
return true;
}
+static bool
+cmdCPUMapDesc(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
+{
+ char *xml = virConnectGetCPUMapDesc(ctl->conn);
+ if (xml == NULL) {
+ vshError(ctl, "%s", _("failed to get CPU Map XML file"));
+ return false;
+ }
+
+ vshPrint(ctl, "%s\n", xml);
+ VIR_FREE(xml);
+
+ return true;
+}
+
/*
* "version" command
*/
@@ -851,6 +866,12 @@ const vshCmdDef hostAndHypervisorCmds[] = {
.info = info_capabilities,
.flags = 0
},
+ {.name = "cpu-map-desc",
+ .handler = cmdCPUMapDesc,
+ .opts = NULL,
+ .info = info_uri,
+ .flags = 0
+ },
{.name = "freecell",
.handler = cmdFreecell,
.opts = opts_freecell,
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 0ae5178..d705a54 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -163,6 +163,7 @@ group as an option. For example:
Host and Hypervisor (help keyword 'host'):
capabilities capabilities
+ cpu-map-desc print the content of the cpu_map.xml file
connect (re)connect to hypervisor
freecell NUMA free memory
hostname print the hypervisor hostname
@@ -358,6 +359,10 @@ current domain is in.
=over 4
+=item B<cpu-map-desc>
+
+Print the content of the cpu_map.xml file used by the hypervisor.
+
=item B<running>
The domain is currently running on a CPU
--
1.8.3.1
11 years, 3 months
[libvirt] [PATCH 0/2] Add http and ftp support for cdrom disk
by Aline Manera
From: Aline Manera <alinefm(a)br.ibm.com>
Aline Manera (2):
Add http protocol support for cdrom disk
Add ftp protocol support for cdrom disk
docs/formatdomain.html.in | 16 +++++++++
docs/schemas/domaincommon.rng | 2 ++
src/conf/domain_conf.c | 4 ++-
src/conf/domain_conf.h | 2 ++
src/qemu/qemu_command.c | 13 +++++++
.../qemuxml2argv-disk-cdrom-network-ftp.args | 6 ++++
.../qemuxml2argv-disk-cdrom-network-ftp.xml | 37 ++++++++++++++++++++
.../qemuxml2argv-disk-cdrom-network-http.args | 6 ++++
.../qemuxml2argv-disk-cdrom-network-http.xml | 37 ++++++++++++++++++++
tests/qemuxml2argvtest.c | 4 +++
10 files changed, 126 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-network-ftp.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-network-ftp.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-network-http.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-network-http.xml
--
1.7.10.4
11 years, 3 months
[libvirt] [PATCH] Don't free NULL network in cmdNetworkUpdate
by Ján Tomko
If the network has not been found, virNetworkFree(NULL)
was called, resulting in an extra error:
error: invalid network pointer in virNetworkFree
https://bugzilla.redhat.com/show_bug.cgi?id=1001094
---
tools/virsh-network.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index e1baf0b..06bf483 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -918,7 +918,7 @@ cmdNetworkUpdate(vshControl *ctl, const vshCmd *cmd)
const char *affected;
if (!(network = vshCommandOptNetwork(ctl, cmd, NULL)))
- goto cleanup;
+ return false;
if (vshCommandOptStringReq(ctl, cmd, "command", &commandStr) < 0)
goto cleanup;
--
1.8.1.5
11 years, 3 months