[libvirt] [PATCH 0/1] Multipath pool support
by David Allan
The following patch implements multipath pool support. It's very
basic functionality, consisting of creating a pool that contains all
the multipath devices on the host. That will cover the common case of
users who just want to discover all the available multipath devices
and assign them to guests.
It doesn't currently allow configuration of multipathing, so for now
setting the multipath configuration will have to continue to be done
as part of the host system build.
Example XML to create the pool is:
<pool type="mpath">
<name>mpath</name>
<target>
<path>/dev/mapper</path>
</target>
</pool>
The target element is ignored, as it is by the disk pool, but the
config code rejects the XML if it does not exist. That behavior
should obviously be cleaned up, but I think that should be done in a
separate patch, as it's really a bug in the config code, not related
to the addition of the new pool type.
Dave
15 years, 4 months
[libvirt] OpenVZ : The restriction of domain name should be addressed
by Yuji NISHIDA
Hi,
"The current libvirt OpenVZ driver has a restriction that the domain
names must match the OpenVZ container VEID"
I really want to have domain name as character, not integer.
It could help me very much if any patch against this problem would be
released.
Is there anyone tackling this problem now?( or going to? )
Otherwise, any hint would help me.
Regards.
-----
Yuji Nishida
nishidy(a)nict.go.jp
15 years, 4 months
[libvirt] XenStore fix
by Jonas Eriksson
Hi,
I have been examining a bug where libvirtd (and virsh) does not show
all virtual machines on a xen host. This proved to be because of this
program flow:
1. virConnectNumOfDomains -> .. -> xenUnifiedNumOfDomains
-> xenHypervisorNumOfDomains => 3
2. virConnectListDomains(max=3) -> .. -> xenUnifiedListDomains(max=3)
-> xenStoreNumOfDomains(max=3) => { 0, 2, 7 }
The domain with ID 2 is then removed when it is discovered that it is
not a running domain, which leads to this:
xenhost# xm list
Name ID Mem VCPUs State Time(s)
Domain-0 0 14970 2 r----- 2544.7
vm1 7 512 1 -b---- 2191.7
vm4 512 1 28.0
vm5 12 512 1 -b---- 467.1
vm6 512 1 0.0
vm7 512 1 482.4
xenhost# virsh list
Id Name State
----------------------------------
0 Domain-0 running
7 vm1 idle
xenhost#
But where does "2" come from? If we check all "directories" in
/local/domain which is queried by the xenstore driver, it is apparent
that xenstore is not properly cleaned. We find the sequence {0, 2, 7}
as the first entries:
xenhost# xenstore ls /local/domain |grep '^[^ ]'
0 = ""
2 = ""
7 = ""
9 = ""
10 = ""
11 = ""
12 = ""
xenhost#
This patch checks that the path found in /local/domain/<domid>/vm
exists in xenstore before adding the domid to the return list. The
same thing is done for xenStoreNumOfDomains.
I use SLES11 with Xen 3.3.1_18546_12-3.1.
/Jonas
15 years, 4 months
[libvirt] [PATCH 0/5] Various logging cleanups
by Amy Griffis
The following patches fixup libvirt's logging code, to hopefully make it
a little more consistent and predictable.
---
Amy Griffis (5):
Tighten libvirt's parsing of logging environment variables
Several fixes to libvirtd's log setup
Cleanup VIR_LOG_DEBUG parsing in eventtest
Consolidate code for parsing the logging environment variables
Update logging documentation
docs/logging.html.in | 22 +++++++-
qemud/qemud.c | 90 +++++++++++++++++---------------
src/libvirt.c | 19 -------
src/libvirt_private.syms | 5 ++
src/logging.c | 129 +++++++++++++++++++++++++++++++++++++++-------
src/logging.h | 5 ++
tests/eventtest.c | 12 +---
7 files changed, 190 insertions(+), 92 deletions(-)
15 years, 4 months
[libvirt] PATCH: Add name uniqueness checking to LXC driver
by Daniel P. Berrange
The LXC driver define/create methods didn't yet have name uniqueness
checking enabled
Daniel
commit 4b23a44f34392b5c6d1c5aa483cbe81b010e47c4
Author: Daniel P. Berrange <berrange(a)redhat.com>
Date: Fri Jul 31 15:25:03 2009 +0100
Add uniqness checking for LXC define/create methods
* src/lxc_driver.c: Check for name & UUID uniqueness when
defining or creating domains
diff --git a/src/lxc_driver.c b/src/lxc_driver.c
index d62c2d7..a9c4f79 100644
--- a/src/lxc_driver.c
+++ b/src/lxc_driver.c
@@ -311,6 +311,35 @@ static virDomainPtr lxcDomainDefine(virConnectPtr conn, const char *xml)
VIR_DOMAIN_XML_INACTIVE)))
goto cleanup;
+ /* See if a VM with matching UUID already exists */
+ vm = virDomainFindByUUID(&driver->domains, def->uuid);
+ if (vm) {
+ /* UUID matches, but if names don't match, refuse it */
+ if (STRNEQ(vm->def->name, def->name)) {
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+ virUUIDFormat(vm->def->uuid, uuidstr);
+ lxcError(conn, NULL, VIR_ERR_OPERATION_FAILED,
+ _("domain '%s' is already defined with uuid %s"),
+ vm->def->name, uuidstr);
+ goto cleanup;
+ }
+
+ /* UUID & name match */
+ virDomainObjUnlock(vm);
+ newVM = 0;
+ } else {
+ /* UUID does not match, but if a name matches, refuse it */
+ vm = virDomainFindByName(&driver->domains, def->name);
+ if (vm) {
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+ virUUIDFormat(vm->def->uuid, uuidstr);
+ lxcError(conn, NULL, VIR_ERR_OPERATION_FAILED,
+ _("domain '%s' is already defined with uuid %s"),
+ def->name, uuidstr);
+ goto cleanup;
+ }
+ }
+
if ((def->nets != NULL) && !(driver->have_netns)) {
lxcError(conn, NULL, VIR_ERR_NO_SUPPORT,
"%s", _("System lacks NETNS support"));
@@ -1082,6 +1111,39 @@ lxcDomainCreateAndStart(virConnectPtr conn,
VIR_DOMAIN_XML_INACTIVE)))
goto cleanup;
+ /* See if a VM with matching UUID already exists */
+ vm = virDomainFindByUUID(&driver->domains, def->uuid);
+ if (vm) {
+ /* UUID matches, but if names don't match, refuse it */
+ if (STRNEQ(vm->def->name, def->name)) {
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+ virUUIDFormat(vm->def->uuid, uuidstr);
+ lxcError(conn, NULL, VIR_ERR_OPERATION_FAILED,
+ _("domain '%s' is already defined with uuid %s"),
+ vm->def->name, uuidstr);
+ goto cleanup;
+ }
+
+ /* UUID & name match, but if VM is already active, refuse it */
+ if (virDomainIsActive(vm)) {
+ lxcError(conn, NULL, VIR_ERR_OPERATION_FAILED,
+ _("domain is already active as '%s'"), vm->def->name);
+ goto cleanup;
+ }
+ virDomainObjUnlock(vm);
+ } else {
+ /* UUID does not match, but if a name matches, refuse it */
+ vm = virDomainFindByName(&driver->domains, def->name);
+ if (vm) {
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+ virUUIDFormat(vm->def->uuid, uuidstr);
+ lxcError(conn, NULL, VIR_ERR_OPERATION_FAILED,
+ _("domain '%s' is already defined with uuid %s"),
+ def->name, uuidstr);
+ goto cleanup;
+ }
+ }
+
if ((def->nets != NULL) && !(driver->have_netns)) {
lxcError(conn, NULL, VIR_ERR_NO_SUPPORT,
"%s", _("System lacks NETNS support"));
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
15 years, 4 months
[libvirt] PATCH: Fix cleanup of transient VMs
by Daniel P. Berrange
If a transient VM quit unexpectedly it would never be cleaned up, resulting
in a guest that's impossible to remove
Daniel
commit 7781032c3d870f5c9dacfc02baecc151689d9c57
Author: Daniel P. Berrange <berrange(a)redhat.com>
Date: Fri Jul 31 14:38:46 2009 +0100
Fix removal of transient VMs when LXC aborts
* src/lxc_driver.c: Remove transient VM after monitor triggered
shutdown
diff --git a/src/lxc_driver.c b/src/lxc_driver.c
index f37fc5d..d62c2d7 100644
--- a/src/lxc_driver.c
+++ b/src/lxc_driver.c
@@ -774,6 +774,10 @@ static void lxcMonitorEvent(int watch,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
}
+ if (!vm->persistent) {
+ virDomainRemoveInactive(&driver->domains, vm);
+ vm = NULL;
+ }
cleanup:
if (vm)
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
15 years, 4 months
[libvirt] PATCH: Fix startup of LXC vms without cgroups
by Daniel P. Berrange
If cgroups was not mounted at all, LXC would fail to start any VM, since
we missed an error code check
Daniel
commit 8713c7e8111e73879f8380b920995ff3d1f3f9e9
Author: Daniel P. Berrange <berrange(a)redhat.com>
Date: Fri Jul 31 14:37:25 2009 +0100
Don't try to activate cgroups if not present for LXC
* src/lxc_controller.c: Don't throw error in LXC startup if
the cgroups driver mount isn't available. Improve error
logging for resource setup
diff --git a/src/lxc_controller.c b/src/lxc_controller.c
index 9ad48a7..8d11238 100644
--- a/src/lxc_controller.c
+++ b/src/lxc_controller.c
@@ -84,25 +84,38 @@ static int lxcSetContainerResources(virDomainDefPtr def)
rc = virCgroupForDriver("lxc", &driver, 1, 0);
if (rc != 0) {
- lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
- _("Unable to get cgroup for driver"));
+ /* Skip all if no driver cgroup is configured */
+ if (rc == -ENXIO || rc == -ENOENT)
+ return 0;
+
+ virReportSystemError(NULL, -rc, "%s",
+ _("Unable to get cgroup for driver"));
return rc;
}
rc = virCgroupForDomain(driver, def->name, &cgroup, 1);
if (rc != 0) {
- lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Unable to create cgroup for domain %s"), def->name);
+ virReportSystemError(NULL, -rc,
+ _("Unable to create cgroup for domain %s"),
+ def->name);
goto cleanup;
}
rc = virCgroupSetMemory(cgroup, def->maxmem);
- if (rc != 0)
- goto out;
+ if (rc != 0) {
+ virReportSystemError(NULL, -rc,
+ _("Unable to set memory limit for domain %s"),
+ def->name);
+ goto cleanup;
+ }
rc = virCgroupDenyAllDevices(cgroup);
- if (rc != 0)
- goto out;
+ if (rc != 0) {
+ virReportSystemError(NULL, -rc,
+ _("Unable to deny devices for domain %s"),
+ def->name);
+ goto cleanup;
+ }
for (i = 0; devices[i].type != 0; i++) {
struct cgroup_device_policy *dev = &devices[i];
@@ -110,19 +123,27 @@ static int lxcSetContainerResources(virDomainDefPtr def)
dev->type,
dev->major,
dev->minor);
- if (rc != 0)
- goto out;
+ if (rc != 0) {
+ virReportSystemError(NULL, -rc,
+ _("Unable to allow device %c:%d:%d for domain %s"),
+ dev->type, dev->major, dev->minor, def->name);
+ goto cleanup;
+ }
}
rc = virCgroupAllowDeviceMajor(cgroup, 'c', LXC_DEV_MAJ_PTY);
- if (rc != 0)
- goto out;
+ if (rc != 0) {
+ virReportSystemError(NULL, -rc,
+ _("Unable to allow PYT devices for domain %s"),
+ def->name);
+ goto cleanup;
+ }
rc = virCgroupAddTask(cgroup, getpid());
-out:
if (rc != 0) {
- virReportSystemError(NULL, -rc, "%s",
- _("Failed to set lxc resources"));
+ virReportSystemError(NULL, -rc,
+ _("Unable to add task %d to cgroup for domain %s"),
+ getpid(), def->name);
}
cleanup:
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
15 years, 4 months
[libvirt] [PATCH] Allow libvirtd to RPC to external libvirtd.
by Chris Lalancette
Allow the daemon itself to make RPCs to an external libvirtd, but only if
the URI is fully specified. While this isn't used at the moment, it will
be for the tunnelled migration support in the future.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
src/remote_internal.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/remote_internal.c b/src/remote_internal.c
index ad0cbf0..ff4fb6c 100644
--- a/src/remote_internal.c
+++ b/src/remote_internal.c
@@ -997,7 +997,7 @@ remoteOpen (virConnectPtr conn,
int ret, rflags = 0;
const char *autostart = getenv("LIBVIRT_AUTOSTART");
- if (inside_daemon)
+ if (inside_daemon && (!conn->uri || (conn->uri && !conn->uri->server)))
return VIR_DRV_OPEN_DECLINED;
if (!(priv = remoteAllocPrivateData(conn)))
--
1.6.0.6
15 years, 4 months