[libvirt]: Not able to login to container when cgroup is enabled
by Rishikesh
Hi All,
On F12 i was playing with libvirt support for container.
I am seeing two issue over here:
1> Not able to create a container when start cgconfig services.
2> When i stop cgconfig, then able to create a container, but seeing
few error messages to libvirtd daemon.
3> After creation of container through libvirt, i am not able to
touch any file or directory.
Attached: vm1.xml , through which i created container. I referred
following link:
http://libvirt.org/drvlxc.html
http://openvz.org/pipermail/devel/2008-September/014314.html
Detailed Bug Report:
When i create a container without starting "cgconfig" service, i am able
to create but getting some error message in libvirtd daemon:
[root@mx3950 ~]# libvirtd
14:47:24.556: warning : qemudStartup:565 : Unable to create cgroup for
driver: No such device or address
14:47:24.647: warning : lxcStartup:1462 : Unable to create cgroup for
driver: No such device or address
libvir: Linux Container error : failed to connect to client socket: No
such file or directory
libvir: Linux Container error : failed to connect to client socket: No
such file or directory
libvir: Linux Container error : failed to connect to client socket: No
such file or directory
But when i start cgconfig service, then i am not able to open console
for my container. Below is the detailed steps which i executed.
[root@mx3950 ~]# /etc/init.d/cgconfig stop
Stopping cgconfig service: [ OK ]
[root@mx3950 ~]# virsh -c lxc:/// define vm1.xml
error: Failed to define domain from vm1.xml
error: operation failed: domain 'vm1' is already defined with uuid
ef558ab3-54ea-5b95-205d-8c0096ae9a4f
[root@mx3950 ~]# virsh -c lxc:/// start vm1
Domain vm1 started
[root@mx3950 ~]# virsh -c lxc:/// console vm1
Connected to domain vm1
Escape character is ^]
sh-4.0# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 15:23 pts/4 00:00:00 /bin/sh
root 4 1 0 15:23 pts/4 00:00:00 ps -ef
sh-4.0# touch rishi
touch: cannot touch `rishi': Permission denied
sh-4.0# exit
exit
[root@mx3950 ~]# /etc/init.d/cgconfig start
Starting cgconfig service: [ OK ]
[root@mx3950 ~]# virsh -c lxc:/// start vm1
Domain vm1 started
[root@mx3950 ~]# virsh -c lxc:/// console vm1
Connected to domain vm1
Escape character is ^]
15:24:12.869: error : vshRunConsole:77 : unable to open tty /dev/pts/3:
No such file or directory
[root@mx3950 ~]#
Package List:
[root@mx3950 ~]# rpm -qa | grep -e libcgroup -e libvirt
libcgroup-0.34-2.fc12.x86_64
libvirt-0.7.1-1.fc12.x86_64
libvirt-client-0.7.1-1.fc12.x86_64
libvirt-python-0.7.1-1.fc12.x86_64
[root@mx3950 ~]# uname -a
Linux mx3950.in.ibm.com 2.6.31-14.fc12.x86_64 #1 SMP Tue Sep 15 03:48:57
EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
15 years, 8 months
[libvirt] Execute script on migration
by Radek Hladík
Short question: What is the best way to run some script on VM migration?
Detailed description:
We use own system for volume management. Its based on md and we found it very
flexible. Basic idea is that we have md mirror everywhere we can. This suits
great for libvirt: We have a disk on iSCSI server, its "partioned" using
device mapper, the resulting "partition" is member of md raid1, that raid is
exported via iSCSI to the libvirt node, it is on the node included in another
md raid1 and that "final" md raid is used as storage by the VM. This provides
high level of abstraction that allows us to migrate the storage to another
disk, another iSCSI server, etc...
The only glitch is on live migration of the VM. It is possible to assemble and
run the array on two nodes. Also all superblock modifications are done on
first write to the array. However it would be more secure to stop the array
after the source vm stops and before destination vm starts.
What is the best way to run some script in this particular moment? I know we
could create a new storage driver but I am not sure that it is the best option.
--
Open WebMail Project (http://openwebmail.org)
15 years, 8 months
[libvirt] [PATCH] test: Activate interfaces specified through driver config file.
by Cole Robinson
This matches the behavior of domains, storage, etc. Also, fix up some
whitespace issues in the area.
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/test/test_driver.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 0b866d2..0541a73 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -779,13 +779,16 @@ static int testOpenFromFile(virConnectPtr conn,
if (!def)
goto error;
} else {
- if ((def = virInterfaceDefParseNode(conn, xml, ifaces[i])) == NULL)
+ if ((def = virInterfaceDefParseNode(conn, xml, ifaces[i])) == NULL)
goto error;
}
+
if (!(iface = virInterfaceAssignDef(conn, &privconn->ifaces, def))) {
virInterfaceDefFree(def);
goto error;
}
+
+ iface->active = 1;
virInterfaceObjUnlock(iface);
}
VIR_FREE(ifaces);
--
1.6.5.rc2
15 years, 8 months
[libvirt] [PATCH] storage: Report errors in FindPoolSources
by Cole Robinson
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/storage/storage_driver.c | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 9ab53e1..4f8949b 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -440,15 +440,24 @@ storageFindPoolSources(virConnectPtr conn,
char *ret = NULL;
backend_type = virStoragePoolTypeFromString(type);
- if (backend_type < 0)
+ if (backend_type < 0) {
+ virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("unknown storage pool type %s"), type);
goto cleanup;
+ }
backend = virStorageBackendForType(backend_type);
if (backend == NULL)
goto cleanup;
- if (backend->findPoolSources)
- ret = backend->findPoolSources(conn, srcSpec, flags);
+ if (!backend->findPoolSources) {
+ virStorageReportError(conn, VIR_ERR_NO_SUPPORT,
+ _("pool type '%s' does not support source "
+ "discovery"), type);
+ goto cleanup;
+ }
+
+ ret = backend->findPoolSources(conn, srcSpec, flags);
cleanup:
return ret;
--
1.6.5.rc2
15 years, 8 months
[libvirt] [PATCH] remote: Don't print a warning every time a remote call fails
by Cole Robinson
$ sudo virsh pool-start idontexist
10:58:18.716: warning : processCallDispatchReply:7612 : Method call error
error: failed to get pool 'idontexist'
error: Storage pool not found: no pool with matching name 'idontexist'
That warning doesn't server much purpose being printed via a virsh call. Change
the warning to a debug message.
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/remote/remote_driver.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 284593a..162d682 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -7606,7 +7606,7 @@ processCallDispatchReply(virConnectPtr conn, struct private_data *priv,
return 0;
case REMOTE_ERROR:
- VIR_WARN0("Method call error");
+ VIR_DEBUG0("Method call error");
memset (&thecall->err, 0, sizeof thecall->err);
if (!xdr_remote_error (xdr, &thecall->err)) {
error (in_open ? NULL : conn,
--
1.6.5.rc2
15 years, 8 months
[libvirt] [PATCH] LXC fix rc handling in lxcVmStart
by Ryota Ozaki
Hi,
In lxcVmStart we have to set rc = -1 before jumping to the cleanup
code when a local procedure call fails and the rc is overwritten,
however, some codes don't observe the rule and so invalid cleanups
are likely to happen.
A simple solution for the defect is to add rc = -1 before every
jumping if needed, however, IMHO, we first should not reuse rc for
another purpose rather than the return value of lxcVmStart. Instead
the patch introduces yet another variable for storing only the
return value of the local procedure calls. By doing so, we don't
need to care about resetting rc anymore.
Thanks,
ozaki-r
>From c3eb2cfa1280b220d5b92ad2ad8bbf6cf6ca0a04 Mon Sep 17 00:00:00 2001
From: Ryota Ozaki <ozaki.ryota(a)gmail.com>
Date: Tue, 13 Oct 2009 00:36:41 +0900
Subject: [PATCH] LXC fix rc handling in lxcVmStart
* src/lxc/lxc_driver.c: don't reuse rc for local procedure calls
---
src/lxc/lxc_driver.c | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index ef0d368..0b614e3 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1117,7 +1117,7 @@ static int lxcVmStart(virConnectPtr conn,
lxc_driver_t * driver,
virDomainObjPtr vm)
{
- int rc = -1;
+ int rc = -1, r;
unsigned int i;
int parentTty;
char *parentTtyPath = NULL;
@@ -1126,8 +1126,8 @@ static int lxcVmStart(virConnectPtr conn,
unsigned int nveths = 0;
char **veths = NULL;
- if ((rc = virFileMakePath(driver->logDir)) < 0) {
- virReportSystemError(conn, rc,
+ if ((r = virFileMakePath(driver->logDir)) < 0) {
+ virReportSystemError(conn, r,
_("cannot create log directory '%s'"),
driver->logDir);
return -1;
@@ -1157,10 +1157,8 @@ static int lxcVmStart(virConnectPtr conn,
goto cleanup;
/* Persist the live configuration now we have veth & tty info */
- if (virDomainSaveConfig(conn, driver->stateDir, vm->def) < 0) {
- rc = -1;
+ if (virDomainSaveConfig(conn, driver->stateDir, vm->def) < 0)
goto cleanup;
- }
if ((logfd = open(logfile, O_WRONLY | O_APPEND | O_CREAT,
S_IRUSR|S_IWUSR)) < 0) {
@@ -1183,11 +1181,10 @@ static int lxcVmStart(virConnectPtr conn,
goto cleanup;
/* And get its pid */
- if ((rc = virFileReadPid(driver->stateDir, vm->def->name,
&vm->pid)) != 0) {
- virReportSystemError(conn, rc,
+ if ((r = virFileReadPid(driver->stateDir, vm->def->name, &vm->pid)) != 0) {
+ virReportSystemError(conn, r,
_("Failed to read pid file %s/%s.pid"),
driver->stateDir, vm->def->name);
- rc = -1;
goto cleanup;
}
--
1.6.2.5
15 years, 8 months
[libvirt] feature request: virDomainSendkeys API
by Dan Kenigsberg
Our QA team makes use of qemu's sendkeys monitor command to test
interesting things such as Windows guest installation-from-scratch.
When we move to libvirt, we loose this ability.
On irc, dpb suggested using vnc to send the required keys. Are you aware
of a command-line tool for that, or should we build our own? If we go
down this path, we would have to build a similar tool for testing VMs
with SPICE. (and have nothing to do for VMs with no graphics support,
but these are not used in the product anyway)
Alternatively, libvirt can supply a new API for injecting key strokes
into a domain. Surely it's useful only for debug and qa, but so is
virDomainMemoryPeek.
Is that reasonable?
Dan.
15 years, 8 months
[libvirt] cannot set ownership on /nfs/mounted/image.iso: Operation not permitted
by Dan Kenigsberg
I having libvirt run qemu as non-root, but I don't think libvirt should
try chowning image files. Cerntainly not if they sit on a root_squashing
nfs server.
Also, the behavior of libvirt in this regard is a bit surprising
for local image files and even for host devices. It should be enough
that an image is accessible to qemu; it does not have to be owned by it.
The fact that qemuDomainSetAllDeviceOwnership() with restore=1 does not
really restore ownership of device/file but force-chowns it to root:root
is anouther surprise.
Dan
15 years, 8 months