[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, 1 month
[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, 1 month
[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, 1 month
[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, 1 month
[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, 1 month
[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, 1 month
[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, 1 month
[libvirt] [PATCH] Fix QEMU restore from file in raw format
by Daniel P. Berrange
The logic for running the decompression programs was broken in
commit f238709304f9f6c57204cdd943e542cbae38fa5f, so that for
non-raw formats the decompression program was never run, and
for raw formats, it tried to exec an argv[] with initial NULL
in the program name.
* src/qemu/qemu_driver.c: Fix logic in runing decompression program
---
src/qemu/qemu_driver.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1e23a9b..556984a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3781,9 +3781,8 @@ static int qemudDomainRestore(virConnectPtr conn,
goto cleanup;
}
- if (header.compressed != QEMUD_SAVE_FORMAT_RAW)
+ if (header.compressed != QEMUD_SAVE_FORMAT_RAW) {
intermediate_argv[0] = prog;
- else {
intermediatefd = fd;
fd = -1;
if (virExec(conn, intermediate_argv, NULL, NULL,
--
1.6.2.5
15 years, 1 month