[libvirt] [PATCH 00/40] Refactor Xen driver to support ACL work
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The Xen driver currently is a really horrible mess, in particular
with the way iterates over sub-drivers calling each one in turn,
until one magically works. For each operation there is always a
clear rule for which sub-driver must be used. Thus instead of
blindly iterating over all drivers, we can directly invoke the
correct sub-driver. This highlights that quite alot of code is
in fact completely unreachable / used & can be deleted.
The second big issue is that the Xen sub-drivers will randomly
use either the 'id', 'name' or 'uuid' from the virDomainPtr object.
If the user provides a malicious virDomainPtr instance, it is
possible to have a 'id' referring to domain A, a 'name' referring
to domain B and a 'uuid' referring to domain C. This makes doing
reliable access control checks difficult. To ensure we have a
consistent triple, use the 'uuid' from virDomainPtr to lookup the
guest with the hypervisor and return a virDomainDefPtr where only
the name/id/uuid are filled out. Use this in the all the subdrivers
isolating them from the public virDomainPtr object. The top level
Xen driver will then be able to do access control checks on the
virDomainDefPtr instances.
Daniel P. Berrange (40):
Remove xen driver checks for priv->handle < 0
Remove VIR_CONNECT_RO checks from xen drivers
Remove pointless GET_PRIVATE macro from Xen driver
Simplify opening of Xen drivers
Simplify the Xen get type driver method
Simplify the Xen get version driver method
Simplify the Xen get max vcpus / node get info driver methods
Simplify the Xen count/list domains driver methods
Simplify the Xen domain create driver method
Simplify the Xen domain lookup driver methods
Simplify the Xen domain is persistent driver method
Simplify the Xen domain suspend/resume driver methods
Simplify the Xen domain shutdown/reboot driver methods
Simplify the Xen domain destroy driver method
Simplify the Xen domain get OS type driver method
Remove Xen get hostname driver method
Simplify the Xen domain get/set (max) memory driver methods
Simplify the Xen domain get info/state driver methods
Simplify the Xen domain save/restore driver methods
Simplify the Xen domain VCPU driver methods
Simplify the Xen domain get XML driver method
Simplify the Xen domain migration driver methods
Simplify the Xen driver define domain driver methods
Simplify the Xen domain start driver method
Simplify the Xen domain define/undefine driver methods
Simplify the Xen domain attach/dettach driver methods
Simplify the Xen domain scheduler parameter driver methods
Simplify the Xen domain autostart driver method
Simplify the Xen domain stats/peek / node memory driver methods
Convert Xen domain lookup driver methods to use virDomainDefPtr
Convert Xen domain lifecycle driver methods to use virDomainDefPtr
Convert Xen domain property driver methods to use virDomainDefPtr
Convert Xen domain managed save driver methods to use virDomainDefPtr
Convert Xen domain start/migration APIs to use virDomainDefPtr
Convert Xen domain VCPU driver methods to use virDomainDefPtr
Convert Xen domain device hotplug driver methods to use
virDomainDefPtr
Convert Xen domain autostart driver methods to use virDomainDefPtr
Convert Xen domain scheduler driver methods to use virDomainDefPtr
Convert Xen domain stats/peek driver methods to use virDomainDefPtr
Convert Xen domain core dump driver methods to use virDomainDefPtr
src/conf/domain_conf.c | 23 +
src/conf/domain_conf.h | 4 +
src/libvirt_private.syms | 1 +
src/xen/block_stats.c | 6 +-
src/xen/block_stats.h | 2 +-
src/xen/xen_driver.c | 1542 ++++++++++++++++++++++++----------------------
src/xen/xen_driver.h | 37 --
src/xen/xen_hypervisor.c | 668 +++-----------------
src/xen/xen_hypervisor.h | 83 ++-
src/xen/xen_inotify.c | 22 +-
src/xen/xen_inotify.h | 11 +-
src/xen/xend_internal.c | 855 ++++++++-----------------
src/xen/xend_internal.h | 164 +++--
src/xen/xm_internal.c | 312 ++++------
src/xen/xm_internal.h | 84 ++-
src/xen/xs_internal.c | 427 +------------
src/xen/xs_internal.h | 20 +-
17 files changed, 1492 insertions(+), 2769 deletions(-)
--
1.8.1.4
11 years, 6 months
[libvirt] [PATCH] Cope with missing swap cgroup controls
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
It is possible to build a kernel without swap cgroup controls
present. This causes a fatal error when querying memory
parameters. Treat missing swap controls as meaning "unlimited".
The fatal error remains if the user tries to actually change
the limit.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/qemu/qemu_driver.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6a23573..693b637 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7612,9 +7612,12 @@ qemuDomainGetMemoryParameters(virDomainPtr dom,
case 2: /* fill swap hard limit here */
rc = virCgroupGetMemSwapHardLimit(priv->cgroup, &val);
if (rc != 0) {
- virReportSystemError(-rc, "%s",
- _("unable to get swap hard limit"));
- goto cleanup;
+ if (rc != -ENOENT) {
+ virReportSystemError(-rc, "%s",
+ _("unable to get swap hard limit"));
+ goto cleanup;
+ }
+ val = VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
}
if (virTypedParameterAssign(param,
VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT,
--
1.8.2.1
11 years, 6 months
[libvirt] [PATCH] Skip virNWFilterTechDriver when validating API naming
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The virNWFilterTechDriver struct is an internal only driver
API with no public API equivalent. It should be skipped by
the 'check-driverimpls' test case
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/check-driverimpls.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/check-driverimpls.pl b/src/check-driverimpls.pl
index e385de0..17e2b48 100755
--- a/src/check-driverimpls.pl
+++ b/src/check-driverimpls.pl
@@ -68,7 +68,8 @@ while (<>) {
}
}
} elsif (/^(?:static\s+)?(vir(?:\w+)?Driver)\s+/) {
- next if $1 eq "virNWFilterCallbackDriver";
+ next if $1 eq "virNWFilterCallbackDriver" ||
+ $1 eq "virNWFilterTechDriver";
$intable = 1;
$table = $1;
}
--
1.8.1.4
11 years, 6 months
[libvirt] [PATCH] Replace list of driver source files with variables
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Update the DRIVER_SOURCE_FILES variable to reference the
other various XXX_SOURCES variables, instead of duplicating
the filename lists. This results in a bunch of extra files
being processed, but the test scripts can easily skip those
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/Makefile.am | 58 +++++++++++++++++++++------------------------------------
1 file changed, 21 insertions(+), 37 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 6c2788c..6175b84 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -438,44 +438,28 @@ check-drivername:
EXTRA_DIST += check-drivername.pl
DRIVER_SOURCE_FILES = \
- esx/esx_device_monitor.c \
- esx/esx_driver.c \
- esx/esx_interface_driver.c \
- esx/esx_network_driver.c \
- esx/esx_nwfilter_driver.c \
- esx/esx_secret_driver.c \
- esx/esx_storage_driver.c \
- hyperv/hyperv_device_monitor.c \
- hyperv/hyperv_driver.c \
- hyperv/hyperv_interface_driver.c \
- hyperv/hyperv_network_driver.c \
- hyperv/hyperv_nwfilter_driver.c \
- hyperv/hyperv_secret_driver.c \
- hyperv/hyperv_storage_driver.c \
- interface/interface_backend_netcf.c \
- interface/interface_backend_udev.c \
- libxl/libxl_driver.c \
- lxc/lxc_driver.c \
- network/bridge_driver.c \
- node_device/node_device_hal.c \
- node_device/node_device_udev.c \
- nwfilter/nwfilter_driver.c \
- openvz/openvz_driver.c \
- parallels/parallels_driver.c \
- parallels/parallels_network.c \
- parallels/parallels_storage.c \
- phyp/phyp_driver.c \
- qemu/qemu_driver.c \
- remote/remote_driver.c \
- secret/secret_driver.c \
- storage/storage_driver.c \
- test/test_driver.c \
- uml/uml_driver.c \
- vbox/vbox_driver.c \
+ $(ESX_DRIVER_SOURCES) \
+ $(HYPERV_DRIVER_SORUCES) \
+ $(INTERFACE_DRIVER_SOURCES) \
+ $(LIBXL_DRIVER_SOURCES) \
+ $(LXC_DRIVER_SOURCES) \
+ $(NETWORK_DRIVER_SOURCES) \
+ $(NODE_DEVICE_DRIVER_SOURCES) \
+ $(NWFILTER_DRIVER_SOURCES) \
+ $(OPENVZ_DRIVER_SOURCES) \
+ $(PARALLELS_DRIVER_SOURCES) \
+ $(PHYP_DRIVER_SOURCES) \
+ $(QEMU_DRIVER_SOURCES) \
+ $(REMOTE_DRIVER_SOURCES) \
+ $(SECRET_DRIVER_SOURCES) \
+ $(STORAGE_DRIVER_SOURCES) \
+ $(TEST_DRIVER_SOURCES) \
+ $(UML_DRIVER_SOURCES) \
+ $(VBOX_DRIVER_SOURCES) \
vbox/vbox_tmpl.c \
- vmware/vmware_driver.c \
- xen/xen_driver.c \
- xenapi/xenapi_driver.c \
+ $(VMWARE_DRIVER_SOURCES) \
+ $(XEN_DRIVER_SOURCES) \
+ $(XENAPI_DRIVER_SOURCES) \
$(NULL)
--
1.8.1.4
11 years, 6 months
[libvirt] [PATCH] Disable some URI tests on older libxml2
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Older versions of libxml2 could not correctly parse certain
URIs. This causes test failures. There's nothing libvirt can
do about this, so disable the problem tests on old libxml2
versions
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
tests/viruritest.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tests/viruritest.c b/tests/viruritest.c
index 0bcd78d..6339d17 100644
--- a/tests/viruritest.c
+++ b/tests/viruritest.c
@@ -182,19 +182,23 @@ mymain(void)
{ (char*)"foo", (char*)"two", false },
{ NULL, NULL, false },
};
+#ifdef HAVE_XMLURI_QUERY_RAW
virURIParam params3[] = {
{ (char*)"foo", (char*)"&one", false },
{ (char*)"bar", (char*)"&two", false },
{ NULL, NULL, false },
};
+#endif
virURIParam params4[] = {
{ (char*)"foo", (char*)"", false },
{ NULL, NULL, false },
};
+#ifdef HAVE_XMLURI_QUERY_RAW
virURIParam params5[] = {
{ (char*)"foo", (char*)"one two", false },
{ NULL, NULL, false },
};
+#endif
virURIParam params6[] = {
{ (char*)"foo", (char*)"one", false },
{ NULL, NULL, false },
@@ -204,12 +208,16 @@ mymain(void)
TEST_PARAMS("foo=one&foo=two", "", params2);
TEST_PARAMS("foo=one&&foo=two", "foo=one&foo=two", params2);
TEST_PARAMS("foo=one;foo=two", "foo=one&foo=two", params2);
+#ifdef HAVE_XMLURI_QUERY_RAW
TEST_PARAMS("foo=%26one&bar=%26two", "", params3);
+#endif
TEST_PARAMS("foo", "foo=", params4);
TEST_PARAMS("foo=", "", params4);
TEST_PARAMS("foo=&", "foo=", params4);
TEST_PARAMS("foo=&&", "foo=", params4);
+#ifdef HAVE_XMLURI_QUERY_RAW
TEST_PARAMS("foo=one%20two", "", params5);
+#endif
TEST_PARAMS("=bogus&foo=one", "foo=one", params6);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
--
1.8.1.4
11 years, 6 months
[libvirt] [PATCH] Fix build of python bindings on Python 2.4
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The PyDict_Next method on Python <= 2.4 used 'int' instead
of "Py_ssize_t" for the 'pos' parameter
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
python/libvirt-override.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index 856789a..fd9ebb8 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -152,7 +152,11 @@ setPyVirTypedParameter(PyObject *info,
const virTypedParameterPtr params, int nparams)
{
PyObject *key, *value;
+#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION <= 4
+ int pos = 0;
+#else
Py_ssize_t pos = 0;
+#endif
virTypedParameterPtr temp = NULL, ret = NULL;
Py_ssize_t size;
int i;
--
1.8.1.4
11 years, 6 months
[libvirt] [PATCH] don't mention disk controllers in generic controller errors
by Ján Tomko
The controller element supports non-disk controller types too.
https://bugzilla.redhat.com/show_bug.cgi?id=960958
---
src/conf/domain_conf.c | 2 +-
src/qemu/qemu_driver.c | 4 ++--
src/qemu/qemu_hotplug.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d55ce6b..6b71727 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12667,7 +12667,7 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
if (src->ncontrollers != dst->ncontrollers) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Target domain disk controller count %zu "
+ _("Target domain controller count %zu "
"does not match source %zu"),
dst->ncontrollers, src->ncontrollers);
return false;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5005afa..6a23573 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5808,7 +5808,7 @@ qemuDomainAttachDeviceControllerLive(virQEMUDriverPtr driver,
break;
default:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("disk controller bus '%s' cannot be hotplugged."),
+ _("'%s' controller cannot be hotplugged."),
virDomainControllerTypeToString(cont->type));
break;
}
@@ -5923,7 +5923,7 @@ qemuDomainDetachDeviceControllerLive(virQEMUDriverPtr driver,
break;
default :
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("disk controller bus '%s' cannot be hotunplugged."),
+ _("'%s' controller cannot be hotunplugged."),
virDomainControllerTypeToString(cont->type));
}
return ret;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index a4f48b0..4d8ac52 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2273,7 +2273,7 @@ int qemuDomainDetachPciControllerDevice(virQEMUDriverPtr driver,
dev->data.controller->type,
dev->data.controller->idx)) < 0) {
virReportError(VIR_ERR_OPERATION_FAILED,
- _("disk controller %s:%d not found"),
+ _("controller %s:%d not found"),
virDomainControllerTypeToString(dev->data.controller->type),
dev->data.controller->idx);
goto cleanup;
--
1.8.1.5
11 years, 6 months
[libvirt] [PATCH] iscsi: don't leak portal string when starting a pool
by Ján Tomko
---
src/storage/storage_backend_iscsi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index cf25919..3b48f44 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -772,6 +772,7 @@ virStorageBackendISCSIStartPool(virConnectPtr conn ATTRIBUTE_UNUSED,
ret = 0;
cleanup:
+ VIR_FREE(portal);
VIR_FREE(session);
return ret;
}
--
1.8.1.5
11 years, 6 months
[libvirt] "virsh edit" failed to take effect on KVM
by Gonglei (Arei)
Hi all,
we use the command "virsh edit" to modify the VM configuration information online on KVM Platform(libvirt-1.0.0 and qemu-1.4),
but it does not take effect after reboot. However, it works fine on Xen Platform.
for an example,a VM is running with the following configuration information:
...
<os>
<type arch='x86_64'>hvm</type>
<boot dev='hd'/>
<bootmenu enable='yes'/>
</os>
...
use command "virsh edit " to modify it:
...
<os>
<type arch='x86_64'>hvm</type>
<boot dev='cdrom'/>
<bootmenu enable='yes'/>
</os>
...
With the changing, the VM is expected to start from cdrom, when execute the command "virsh reboot".
But the fact is that the modify does not take effect, the VM is still start from hd.
Well, it will take effect if I use command "virsh shutdown" and "virsh start" instesad of "virsh reboot".
We are wondering if there have any other ways to take the online modify effect.
What is the next step going on with the command "virsh edit" on KVM Platform? Any ideas?
Thanks!
-Gonglei
11 years, 6 months
[libvirt] [PATCH] conf: don't crash on a tpm device with no backends
by Ján Tomko
Print an error instead of crashing when a TPM device without
a backend is specified.
https://bugzilla.redhat.com/show_bug.cgi?id=961252
---
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 d55ce6b..eb579c6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6988,6 +6988,12 @@ virDomainTPMDefParseXML(const xmlNodePtr node,
goto error;
}
+ if (nbackends == 0) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("missing TPM device backend"));
+ goto error;
+ }
+
if (!(backend = virXMLPropString(backends[0], "type"))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("missing TPM device backend type"));
--
1.8.1.5
11 years, 6 months