On 25.6.2014 08:45, Jincheng Miao wrote:
Currently, only LXC has hostdev mode 'capabilities' support,
so the other drivers should forbid to define it in XML.
The hostdev mode check is added to devicesPostParseCallback()
for each hypervisor driver.
But there are some drivers lack function devicesPostParseCallback(),
so only add check for qemu, libxl, openvz, uml, xen, xenapi.
Signed-off-by: Jincheng Miao <jmiao(a)redhat.com>
---
src/libxl/libxl_domain.c | 9 +++++++++
src/openvz/openvz_driver.c | 10 ++++++++++
src/qemu/qemu_domain.c | 10 ++++++++++
src/uml/uml_driver.c | 10 ++++++++++
src/xen/xen_driver.c | 10 ++++++++++
src/xenapi/xenapi_driver.c | 10 ++++++++++
6 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 73242ac..3bcbd3d 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -485,6 +485,15 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
virDomainHostdevDefPtr hostdev = dev->data.hostdev;
+ /* forbid capabilities mode hostdev in this kind of hypervisor */
+ if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("hostdev mode 'capabilities' mode is not
"
+ "supported in %s"),
+ virDomainVirtTypeToString(def->virtType));
I've fixed the error message with s/mode is not/is not/ and pushed it.
Thanks, Pavel.