[libvirt] [PATCHv3 0/3] Add usb controller model="none"
by Peter Krempa
This series adds support for completely disabling USB bus for a host if a user
requires this. For this to work a new USB controller model "none" was added
that removes the USB bus.
This series incorporates fixes for comments of Dan's and Eric's review and
is rebased on top of Dan's error handling cleanup.
Peter Krempa (3):
domain_conf: Add USB controler model "none"
domain_conf: Add helpers to verify if device configuration is valid
qemu: Add support for "none" USB controller
docs/formatdomain.html.in | 6 +-
docs/schemas/domaincommon.rng | 1 +
src/conf/domain_conf.c | 107 +++++++++++++++++++-
src/conf/domain_conf.h | 4 +
src/libvirt_private.syms | 1 +
src/qemu/qemu_command.c | 10 ++-
src/qemu/qemu_driver.c | 6 +
.../qemuxml2argvdata/qemuxml2argv-usb-none-hub.xml | 19 ++++
.../qemuxml2argv-usb-none-other.xml | 19 ++++
.../qemuxml2argv-usb-none-usbtablet.xml | 21 ++++
tests/qemuxml2argvdata/qemuxml2argv-usb-none.args | 5 +
tests/qemuxml2argvdata/qemuxml2argv-usb-none.xml | 16 +++
tests/qemuxml2argvtest.c | 10 ++
13 files changed, 221 insertions(+), 4 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-none-hub.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-none-other.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-none-usbtablet.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-none.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-none.xml
--
1.7.8.6
12 years, 3 months
[libvirt] [PATCH 00/49 v2] Atomic APIs to list objects
by Osier Yang
v1 - v2:
* Fix the stupid mistake - changing the public struct, error out
if the new option '--type' for pool-list is specified, and
the libvirt is old enough without listAllStoragePools supported.
Except the already supported APIs for domain and domain snapshot,
this series add the APIs for the left objects, including storage
pool, storage vol, network, interface, node device, nwfilter, and
secret.
* Storage pool:
- Support filtering the returned pool objects by active|inactive,
persistent|transient, autostart|no-autostart, and pool types.
- New options for virsh, --type to accept multiple pool types.
* Storage vol:
- Simply returns all the vol objects of a pool.
* Network:
- Support filtering the results using flags active|inactive,
persistent|transient, autostart|no-autostart
- New options for virsh.
* Interface:
- Support filtering the results using flags active|inactive.
It's still O(n) underlying, as interface driver doesn't manage
the objects itself, but using netcf lib instead. And netcf
APIs don't support returning the struct yet.
* Node Device:
- Support filtering the results using capabilities type of
the devices.
- Extend --cap to accept multiple capability type.
* Network Filter:
- Simply returns all the objects.
* Secret:
- Simply returns all the objects.
All the affected commands are tested with both new libvirt with the
APIs support, or old libvirt without the support. But I still may
lose some scenarios. Please review carefully.
Osier Yang (49):
Fix indentions
list: Rename virdomainlist.[ch] for common use
list: Define new API virStorageListALlStoragePools
list: Add helpers for listing storage pool objects
list: Implement the RPC calls for virConnectListAllStoragePools
list: Implement listAllStoragePools for storage driver
list: Implement listAllStoragePools for test driver
list: Add helper to convert strings separated by ',' to array
virsh: Fix the wrong doc for pool-list
list: Change MATCH for common use in virsh
list: Use virConnectListAllStoragePools in virsh
virsh: Use vshPrint instead of printf
python: Expose virStorageListAllStoragePools to python binding
list: Define new API virStoragePoolListAllVolumes
list: Implemente RPC calls for virStoragePoolListAllVolumes
list: Implement virStoragePoolListAllVolumes for storage driver
list: Implement virStoragePoolListAllVolumes for test driver
list: Use virStoragePoolListAllVolumes in virsh
list: Expose virStoragePoolListAllVolumes to Python binding
list: Define new API virConnectListAllNetworks
list: Implement RPC calls for virConnectListAllNetworks
list: Add helpers to list network objects
list: Implement listAllNetworks for network driver
list: Implement listAllNetworks for test driver
list: Use virConnectListAllNetworks in virsh
list: Expose virConnectListAllNetworks to Python binding
daemon: Fix the wrong macro name
list: Define new API virConnectListAllInterfaces
list: Implemente RPC calls for virConnectListAllInterfaces
list: Implement listAllInterfaces
list: Use virConnectListAllInterfaces in virsh
list: Expose virConnectListAllInterfaces to Python binding
list: Define new API virConnectListAllNodeDevices
list: Implemente RPC calls for virConnectListAllNodeDevices
list: Add helpers for listing node devices
list: Implement listAllNodeDevices
list: Expose virConnectListAllNodeDevices to Python binding
virsh: Fix a bug of nodedev-list
list: Use virConnectListAllNodeDevices in virsh
list: Define new API virConnectListAllNWFilters
list: Implement RPC calls for virConnectListAllNWFilters
list: Implement listAllNWFilters
list: Use virConnectListAllNWFilters in virsh
list: Expose virConnectListAllNWFilters to Python binding
list: Define new API virConnectListAllSecrets
list: Implement RPC calls for virConnectListAllSecrets
list: Implement listAllSecrets
list: Use virConnectListAllSecrets in virsh
list: Expose virConnectListAllSecrets to Python binding
daemon/libvirtd.c | 2 +-
daemon/remote.c | 382 +++++
include/libvirt/libvirt.h.in | 100 ++-
python/generator.py | 11 +-
python/libvirt-override-api.xml | 44 +-
python/libvirt-override-virConnect.py | 72 +
python/libvirt-override-virStoragePool.py | 11 +
python/libvirt-override.c | 337 +++++
src/Makefile.am | 8 +-
src/conf/domain_conf.c | 2 +-
src/conf/virdomainlist.c | 222 ---
src/conf/virdomainlist.h | 84 --
src/conf/virobjectlist.c | 535 +++++++
src/conf/virobjectlist.h | 162 +++
src/datatypes.h | 86 +-
src/driver.h | 35 +-
src/interface/netcf_driver.c | 135 ++
src/libvirt.c | 429 ++++++-
src/libvirt_private.syms | 6 +-
src/libvirt_public.syms | 11 +
src/libxl/libxl_driver.c | 4 +-
src/lxc/lxc_driver.c | 4 +-
src/network/bridge_driver.c | 18 +
src/node_device/node_device_driver.c | 16 +
src/node_device/node_device_driver.h | 3 +
src/node_device/node_device_hal.c | 1 +
src/node_device/node_device_udev.c | 1 +
src/nwfilter/nwfilter_driver.c | 57 +
src/openvz/openvz_driver.c | 4 +-
src/qemu/qemu_driver.c | 4 +-
src/remote/remote_driver.c | 449 ++++++
src/remote/remote_protocol.x | 78 +-
src/remote_protocol-structs | 85 ++
src/secret/secret_driver.c | 58 +-
src/storage/storage_driver.c | 86 ++
src/test/test_driver.c | 105 ++-
src/uml/uml_driver.c | 4 +-
src/vbox/vbox_tmpl.c | 10 +-
src/vmware/vmware_driver.c | 4 +-
tests/virdrivermoduletest.c | 2 +-
tools/virsh.c | 2171 ++++++++++++++++++++++-------
tools/virsh.pod | 51 +-
42 files changed, 4952 insertions(+), 937 deletions(-)
create mode 100644 python/libvirt-override-virStoragePool.py
delete mode 100644 src/conf/virdomainlist.c
delete mode 100644 src/conf/virdomainlist.h
create mode 100644 src/conf/virobjectlist.c
create mode 100644 src/conf/virobjectlist.h
Regards,
Osier
12 years, 3 months
[libvirt] [PATCH v4] storage: netfs and iscsi need option srcSpec for resource discovery
by Guannan Ren
The option 'srcSpec' to virsh command find-storage-pool-sources
is optional for logical type of storage pool, but mandatory for
netfs and iscsi type.
When missing the option for netfs and iscsi, libvirt reports XML
parsing error due to null string option srcSpec.
before
error: Failed to find any netfs pool sources
error: (storage_source_specification):1: Document is empty
(null)
after:
error: pool type 'iscsi' requires option --srcSpec for source discovery
---
src/remote/remote_driver.c | 14 +-------------
src/storage/storage_backend_fs.c | 13 +++++++++----
src/storage/storage_backend_iscsi.c | 7 +++++++
tools/virsh-pool.c | 6 ++++++
4 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 9ac27b2..9354cb4 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2648,23 +2648,11 @@ remoteFindStoragePoolSources (virConnectPtr conn,
remote_find_storage_pool_sources_args args;
remote_find_storage_pool_sources_ret ret;
struct private_data *priv = conn->storagePrivateData;
- const char *emptyString = "";
remoteDriverLock(priv);
args.type = (char*)type;
- /*
- * I'd think the following would work here:
- * args.srcSpec = (char**)&srcSpec;
- * since srcSpec is a remote_string (not a remote_nonnull_string).
- *
- * But when srcSpec is NULL, this yields:
- * libvir: Remote error : marshaling args
- *
- * So for now I'm working around this by turning NULL srcSpecs
- * into empty strings.
- */
- args.srcSpec = srcSpec ? (char **)&srcSpec : (char **)&emptyString;
+ args.srcSpec = srcSpec ? (char **)&srcSpec : NULL;
args.flags = flags;
memset (&ret, 0, sizeof(ret));
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 01b517a..92a3228 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -258,10 +258,15 @@ virStorageBackendFileSystemNetFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSE
virCheckFlags(0, NULL);
- source = virStoragePoolDefParseSourceString(srcSpec,
- VIR_STORAGE_POOL_NETFS);
- if (!source)
- goto cleanup;
+ if (!srcSpec) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ "%s", _("hostname must be specified for netfs sources"));
+ return NULL;
+ }
+
+ if (!(source = virStoragePoolDefParseSourceString(srcSpec,
+ VIR_STORAGE_POOL_NETFS)))
+ return NULL;
if (source->nhost != 1) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index b2f0c6c..75c2e52 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -582,6 +582,13 @@ virStorageBackendISCSIFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED,
virCheckFlags(0, NULL);
+ if (!srcSpec) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ "%s", _("hostname and device path "
+ "must be specified for iscsi sources"));
+ return NULL;
+ }
+
if (!(source = virStoragePoolDefParseSourceString(srcSpec,
list.type)))
return NULL;
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index af80427..0f0b21e 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -1093,6 +1093,12 @@ cmdPoolDiscoverSources(vshControl * ctl, const vshCmd * cmd ATTRIBUTE_UNUSED)
if (srcSpecFile && virFileReadAll(srcSpecFile, VIRSH_MAX_XML_FILE, &srcSpec) < 0)
return false;
+ if (!srcSpec && (STREQ(type, "netfs") || STREQ(type, "iscsi"))) {
+ vshError(ctl, _("pool type '%s' requires option --srcSpec "
+ "for source discovery"), type);
+ return false;
+ }
+
srcList = virConnectFindStoragePoolSources(ctl->conn, type, srcSpec, 0);
VIR_FREE(srcSpec);
if (srcList == NULL) {
--
1.7.7.6
12 years, 3 months
[libvirt] [PATCH v4 0/3] ESX: Add routines to interface driver
by Ata E Husain Bohra
Updated the patch against review comments from Laine and Matthias.
Ata E Husain Bohra (3):
ESX: Add routines to interface driver
ESX: Add routines to interface driver
ESX: Add routines to interface driver
src/esx/esx_interface_driver.c | 499 +++++++++++++++++++++++++++++++++++++++-
src/esx/esx_vi.c | 126 ++++++++++
src/esx/esx_vi.h | 10 +
src/esx/esx_vi_generator.input | 227 ++++++++++++++++++
src/esx/esx_vi_generator.py | 31 ++-
src/esx/esx_vi_types.c | 18 +-
6 files changed, 906 insertions(+), 5 deletions(-)
--
1.7.9.5
12 years, 3 months
[libvirt] [PATCH] shutting down guest vms on host shutdown does not work
by Gerd v. Egidy
Hi,
I originally postet this into the Fedora bugzilla
https://bugzilla.redhat.com/show_bug.cgi?id=843836
but was asked by Eric to post it here for review.
Currently gracefully shutting down guest vms on host shutdown does not work on
Fedora 17, the guests are killed hard on system shutdown.
I use:
fedora-release-17-1.noarch
libvirt-client-0.9.11.4-3.fc17.x86_64
systemd-44-17.fc17.x86_64
But I have looked into current libvirt git and see the same code there so I
don't think it is any different with current git, but I have not verified this.
The reason is systemd considers libvirt-guests.service to be stopped when the
system is running:
$ systemctl status libvirt-guests.service
libvirt-guests.service - Suspend Active Libvirt Guests
Loaded: loaded (/usr/lib/systemd/system/libvirt-guests.service;
enabled)
Active: deactivating (stop) since Fri, 27 Jul 2012 15:47:31 +0200;
2min 48s ago
Process: 1085 ExecStart=/etc/init.d/libvirt-guests start
(code=exited, status=0/SUCCESS)
Control: 1150 (libvirt-guests)
CGroup: name=systemd:/system/libvirt-guests.service
└ control
├ 1150 /bin/sh /etc/init.d/libvirt-guests stop
└ 2257 sleep 1
libvirt-guests.service is defined as type "simple" in systemd (the default).
That means systemd will shut down the service when the start executable is
terminated after starting is done. Systemd will not call stop again on system
shutdown because it thinks it is already stopped.
The solution is to define it as type "oneshot" and set the flag
"RemainAfterExit". Then systemd will consider the service as active after
startup and will call the stop function on host shutdown.
With the attached patch everything works as expected. Please consider merging.
Kind regards,
Gerd
12 years, 3 months
[libvirt] [PATCH] daemon: Fix crash in virTypedParameterArrayClear
by Jiri Denemark
Daemon uses the following pattern when dispatching APIs with typed
parameters:
VIR_ALLOC_N(params, nparams);
virDomain*(dom, params, &nparams, flags);
virTypedParameterArrayClear(params, nparams);
In case nparams was originally set to 0, virDomain* API would fill it
with the number of typed parameters it can provide and we would use this
number (rather than zero) to clear params. Because VIR_ALLOC* returns
non-NULL pointer even if size is 0, the code would end up walking
through random memory. If we were lucky enough and the memory contained
7 (VIR_TYPED_PARAM_STRING) at the right place, we would try to free a
random pointer and crash.
Let's make sure params stays NULL when nparams is 0.
---
daemon/remote.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 80626a2..d25717c 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -989,7 +989,7 @@ remoteDispatchDomainGetSchedulerParameters(virNetServerPtr server ATTRIBUTE_UNUS
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (VIR_ALLOC_N(params, nparams) < 0)
+ if (nparams && VIR_ALLOC_N(params, nparams) < 0)
goto no_memory;
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
@@ -1098,7 +1098,7 @@ remoteDispatchDomainGetSchedulerParametersFlags(virNetServerPtr server ATTRIBUTE
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (VIR_ALLOC_N(params, nparams) < 0)
+ if (nparams && VIR_ALLOC_N(params, nparams) < 0)
goto no_memory;
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
@@ -1279,7 +1279,7 @@ remoteDispatchDomainBlockStatsFlags(virNetServerPtr server ATTRIBUTE_UNUSED,
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (VIR_ALLOC_N(params, nparams) < 0) {
+ if (nparams && VIR_ALLOC_N(params, nparams) < 0) {
virReportOOMError();
goto cleanup;
}
@@ -1753,7 +1753,7 @@ remoteDispatchDomainGetMemoryParameters(virNetServerPtr server ATTRIBUTE_UNUSED,
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (VIR_ALLOC_N(params, nparams) < 0) {
+ if (nparams && VIR_ALLOC_N(params, nparams) < 0) {
virReportOOMError();
goto cleanup;
}
@@ -1818,7 +1818,7 @@ remoteDispatchDomainGetNumaParameters(virNetServerPtr server ATTRIBUTE_UNUSED,
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (VIR_ALLOC_N(params, nparams) < 0) {
+ if (nparams && VIR_ALLOC_N(params, nparams) < 0) {
virReportOOMError();
goto cleanup;
}
@@ -1883,7 +1883,7 @@ remoteDispatchDomainGetBlkioParameters(virNetServerPtr server ATTRIBUTE_UNUSED,
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (VIR_ALLOC_N(params, nparams) < 0) {
+ if (nparams && VIR_ALLOC_N(params, nparams) < 0) {
virReportOOMError();
goto cleanup;
}
@@ -2143,7 +2143,7 @@ remoteDispatchDomainGetBlockIoTune(virNetServerPtr server ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (VIR_ALLOC_N(params, nparams) < 0) {
+ if (nparams && VIR_ALLOC_N(params, nparams) < 0) {
virReportOOMError();
goto cleanup;
}
@@ -3646,7 +3646,7 @@ remoteDispatchDomainGetInterfaceParameters(virNetServerPtr server ATTRIBUTE_UNUS
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (VIR_ALLOC_N(params, nparams) < 0) {
+ if (nparams && VIR_ALLOC_N(params, nparams) < 0) {
virReportOOMError();
goto cleanup;
}
--
1.7.11.1
12 years, 3 months
[libvirt] [PATCH 0/3] Fix check-symfile test case & some linkage bugs
by Daniel P. Berrange
The check-symfile test case was causing problems for people
depending on how they configured libvirt. This turns out to
be mostly due to a flaw in linking the nwfilter, network and
secrets driver. Once those flaws are fixed, the symfile test
works in the same way regardless of whether driver modules
are enabled
12 years, 3 months
[libvirt] QEMU CPU model versioning/compatibility (was Re: KVM call minutes July 31th)
by Eduardo Habkost
On Tue, Jul 31, 2012 at 04:32:05PM +0200, Juan Quintela wrote:
> - 1.2 plans for CPU model versioning/compatibility (eduardo)
> (global properties vs QOM vs qdev)
> how to do it ? configuration file? moving back to the code?
> different external interface from internal one
(CCing libvir-list)
So, the problem is (please correct me if I am wrong):
- libvirt expects the CPU models from the current config file to be
provided by QEMU. libvirt won't write a cpudef config file.
- Fixing compatibility problems on the CPU models (even the ones that
are in config files) are expected to be QEMU's responsibility.
Moving the CPU models inside the code is a step backwards, IMO. I don't
think loading some kind of data from an external file (provided and
maintained by QEMU itself) should be considered something special and
magic, and make the data there a second-class citizen (that QEMU refuses
to give proper support and keep compatibility).
But if it will make us stop running in circles every time something
related to those files needs to be changed (remember the -no-user-config
discussion?), I think I will accept that.
--
Eduardo
12 years, 3 months
[libvirt] [test-API][PATCH 1/2] Fix the undefined local variable problem in remote_exec
by Wayne Sun
* subproc_flag should be global when used between functions
* print error msg when exception happened
Signed-off-by: Wayne Sun <gsun(a)redhat.com>
---
utils/utils.py | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/utils/utils.py b/utils/utils.py
index 455e9cf..be87cdc 100644
--- a/utils/utils.py
+++ b/utils/utils.py
@@ -32,6 +32,8 @@ import subprocess
from xml.dom import minidom
from urlparse import urlparse
+subproc_flag = 0
+
def get_hypervisor():
if commands.getoutput("lsmod | grep kvm"):
return 'kvm'
@@ -439,10 +441,12 @@ def support_virt(self):
return True
def subproc(a, b):
+ global subproc_flag
subproc_flag = 1
def remote_exec(hostname, username, password, cmd):
"""Remote execution on specified host"""
+ global subproc_flag
pid, fd = pty.fork()
if pid == 0:
try:
@@ -479,6 +483,7 @@ def remote_exec(hostname, username, password, cmd):
subproc_flag = 0
return ret
except Exception, e:
+ print e
subproc_flag = 0
return -1
--
1.7.1
12 years, 3 months