|
|
9119d9 |
From c8ef4373f815e030c3dd505b00bd9fffebe333f3 Mon Sep 17 00:00:00 2001
|
|
|
9119d9 |
Message-Id: <c8ef4373f815e030c3dd505b00bd9fffebe333f3@dist-git>
|
|
|
9119d9 |
From: Michal Privoznik <mprivozn@redhat.com>
|
|
|
9119d9 |
Date: Fri, 28 Nov 2014 15:15:06 +0100
|
|
|
9119d9 |
Subject: [PATCH] qemu: Don't track quiesced state of FSs
|
|
|
9119d9 |
|
|
|
9119d9 |
https://bugzilla.redhat.com/show_bug.cgi?id=1160084
|
|
|
9119d9 |
|
|
|
9119d9 |
As of b6d4dad11b (1.2.5) we are trying to keep the status of FSFreeze
|
|
|
9119d9 |
in the guest. Even though I've tried to fixed couple of corner cases
|
|
|
9119d9 |
(6ea54769ba18), it occurred to me just recently, that the approach is
|
|
|
9119d9 |
broken by design. Firstly, there are many other ways to talk to
|
|
|
9119d9 |
qemu-ga (even through libvirt) that filesystems can be thawed (e.g.
|
|
|
9119d9 |
qemu-agent-command) without libvirt noticing. Moreover, there are
|
|
|
9119d9 |
plenty of ways to thaw filesystems without even qemu-ga noticing (yes,
|
|
|
9119d9 |
qemu-ga keeps internal track of FSFreeze status). So, instead of
|
|
|
9119d9 |
keeping the track ourselves, or asking qemu-ga for stale state, it's
|
|
|
9119d9 |
the best to let qemu-ga deal with that (and possibly let guest kernel
|
|
|
9119d9 |
propagate an error).
|
|
|
9119d9 |
|
|
|
9119d9 |
Moreover, there's one bug with the following approach, if fsfreeze
|
|
|
9119d9 |
command failed, we've executed fsthaw subsequently. So issuing
|
|
|
9119d9 |
domfsfreeze in virsh gave the following result:
|
|
|
9119d9 |
|
|
|
9119d9 |
virsh # domfsfreeze gentoo
|
|
|
9119d9 |
Froze 1 filesystem(s)
|
|
|
9119d9 |
|
|
|
9119d9 |
virsh # domfsfreeze gentoo
|
|
|
9119d9 |
error: Unable to freeze filesystems
|
|
|
9119d9 |
error: internal error: unable to execute QEMU agent command 'guest-fsfreeze-freeze': The command guest-fsfreeze-freeze has been disabled for this instance
|
|
|
9119d9 |
|
|
|
9119d9 |
virsh # domfsfreeze gentoo
|
|
|
9119d9 |
Froze 1 filesystem(s)
|
|
|
9119d9 |
|
|
|
9119d9 |
virsh # domfsfreeze gentoo
|
|
|
9119d9 |
error: Unable to freeze filesystems
|
|
|
9119d9 |
error: internal error: unable to execute QEMU agent command 'guest-fsfreeze-freeze': The command guest-fsfreeze-freeze has been disabled for this instance
|
|
|
9119d9 |
|
|
|
9119d9 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
9119d9 |
(cherry picked from commit 6085d917d5c5839b7ed351e99fadbbb56f5178fe)
|
|
|
9119d9 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
9119d9 |
---
|
|
|
9119d9 |
src/qemu/qemu_domain.c | 5 -----
|
|
|
9119d9 |
src/qemu/qemu_domain.h | 2 --
|
|
|
9119d9 |
src/qemu/qemu_driver.c | 44 ++------------------------------------------
|
|
|
9119d9 |
src/qemu/qemu_process.c | 5 -----
|
|
|
9119d9 |
4 files changed, 2 insertions(+), 54 deletions(-)
|
|
|
9119d9 |
|
|
|
9119d9 |
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
|
|
9119d9 |
index d248d5b..01fa3ac 100644
|
|
|
9119d9 |
--- a/src/qemu/qemu_domain.c
|
|
|
9119d9 |
+++ b/src/qemu/qemu_domain.c
|
|
|
9119d9 |
@@ -564,9 +564,6 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf, void *data)
|
|
|
9119d9 |
virBufferAddLit(buf, "</devices>\n");
|
|
|
9119d9 |
}
|
|
|
9119d9 |
|
|
|
9119d9 |
- if (priv->quiesced)
|
|
|
9119d9 |
- virBufferAddLit(buf, "<quiesced/>\n");
|
|
|
9119d9 |
-
|
|
|
9119d9 |
return 0;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
|
|
|
9119d9 |
@@ -751,8 +748,6 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
|
|
|
9119d9 |
}
|
|
|
9119d9 |
VIR_FREE(nodes);
|
|
|
9119d9 |
|
|
|
9119d9 |
- priv->quiesced = virXPathBoolean("boolean(./quiesced)", ctxt) == 1;
|
|
|
9119d9 |
-
|
|
|
9119d9 |
return 0;
|
|
|
9119d9 |
|
|
|
9119d9 |
error:
|
|
|
9119d9 |
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
|
|
|
9119d9 |
index e4ea4ce..ebb282a 100644
|
|
|
9119d9 |
--- a/src/qemu/qemu_domain.h
|
|
|
9119d9 |
+++ b/src/qemu/qemu_domain.h
|
|
|
9119d9 |
@@ -187,8 +187,6 @@ struct _qemuDomainObjPrivate {
|
|
|
9119d9 |
char **qemuDevices; /* NULL-terminated list of devices aliases known to QEMU */
|
|
|
9119d9 |
|
|
|
9119d9 |
bool hookRun; /* true if there was a hook run over this domain */
|
|
|
9119d9 |
-
|
|
|
9119d9 |
- bool quiesced; /* true if filesystems are quiesced */
|
|
|
9119d9 |
};
|
|
|
9119d9 |
|
|
|
9119d9 |
typedef enum {
|
|
|
9119d9 |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
9119d9 |
index e096cee..a9a7d30 100644
|
|
|
9119d9 |
--- a/src/qemu/qemu_driver.c
|
|
|
9119d9 |
+++ b/src/qemu/qemu_driver.c
|
|
|
9119d9 |
@@ -12627,34 +12627,17 @@ qemuDomainPrepareDiskChainElement(virQEMUDriverPtr driver,
|
|
|
9119d9 |
* is sent but failed, and number of frozen filesystems on success. If -2 is
|
|
|
9119d9 |
* returned, FSThaw should be called revert the quiesced status. */
|
|
|
9119d9 |
static int
|
|
|
9119d9 |
-qemuDomainSnapshotFSFreeze(virQEMUDriverPtr driver,
|
|
|
9119d9 |
+qemuDomainSnapshotFSFreeze(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
|
|
|
9119d9 |
virDomainObjPtr vm,
|
|
|
9119d9 |
const char **mountpoints,
|
|
|
9119d9 |
unsigned int nmountpoints)
|
|
|
9119d9 |
{
|
|
|
9119d9 |
qemuDomainObjPrivatePtr priv = vm->privateData;
|
|
|
9119d9 |
- virQEMUDriverConfigPtr cfg;
|
|
|
9119d9 |
int frozen;
|
|
|
9119d9 |
|
|
|
9119d9 |
- if (priv->quiesced) {
|
|
|
9119d9 |
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
|
|
9119d9 |
- _("domain is already quiesced"));
|
|
|
9119d9 |
- return -1;
|
|
|
9119d9 |
- }
|
|
|
9119d9 |
-
|
|
|
9119d9 |
if (!qemuDomainAgentAvailable(priv, true))
|
|
|
9119d9 |
return -1;
|
|
|
9119d9 |
|
|
|
9119d9 |
- priv->quiesced = true;
|
|
|
9119d9 |
-
|
|
|
9119d9 |
- cfg = virQEMUDriverGetConfig(driver);
|
|
|
9119d9 |
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
|
|
|
9119d9 |
- priv->quiesced = false;
|
|
|
9119d9 |
- virObjectUnref(cfg);
|
|
|
9119d9 |
- return -1;
|
|
|
9119d9 |
- }
|
|
|
9119d9 |
- virObjectUnref(cfg);
|
|
|
9119d9 |
-
|
|
|
9119d9 |
qemuDomainObjEnterAgent(vm);
|
|
|
9119d9 |
frozen = qemuAgentFSFreeze(priv->agent, mountpoints, nmountpoints);
|
|
|
9119d9 |
qemuDomainObjExitAgent(vm);
|
|
|
9119d9 |
@@ -12664,24 +12647,17 @@ qemuDomainSnapshotFSFreeze(virQEMUDriverPtr driver,
|
|
|
9119d9 |
|
|
|
9119d9 |
/* Return -1 on error, otherwise number of thawed filesystems. */
|
|
|
9119d9 |
static int
|
|
|
9119d9 |
-qemuDomainSnapshotFSThaw(virQEMUDriverPtr driver,
|
|
|
9119d9 |
+qemuDomainSnapshotFSThaw(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
|
|
|
9119d9 |
virDomainObjPtr vm,
|
|
|
9119d9 |
bool report)
|
|
|
9119d9 |
{
|
|
|
9119d9 |
qemuDomainObjPrivatePtr priv = vm->privateData;
|
|
|
9119d9 |
- virQEMUDriverConfigPtr cfg;
|
|
|
9119d9 |
int thawed;
|
|
|
9119d9 |
virErrorPtr err = NULL;
|
|
|
9119d9 |
|
|
|
9119d9 |
if (!qemuDomainAgentAvailable(priv, report))
|
|
|
9119d9 |
return -1;
|
|
|
9119d9 |
|
|
|
9119d9 |
- if (!priv->quiesced && report) {
|
|
|
9119d9 |
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
|
|
9119d9 |
- _("domain is not quiesced"));
|
|
|
9119d9 |
- return -1;
|
|
|
9119d9 |
- }
|
|
|
9119d9 |
-
|
|
|
9119d9 |
qemuDomainObjEnterAgent(vm);
|
|
|
9119d9 |
if (!report)
|
|
|
9119d9 |
err = virSaveLastError();
|
|
|
9119d9 |
@@ -12692,18 +12668,6 @@ qemuDomainSnapshotFSThaw(virQEMUDriverPtr driver,
|
|
|
9119d9 |
|
|
|
9119d9 |
virFreeError(err);
|
|
|
9119d9 |
|
|
|
9119d9 |
- if (!report || thawed >= 0) {
|
|
|
9119d9 |
- priv->quiesced = false;
|
|
|
9119d9 |
-
|
|
|
9119d9 |
- cfg = virQEMUDriverGetConfig(driver);
|
|
|
9119d9 |
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
|
|
|
9119d9 |
- /* Revert the statuses when we failed to save them. */
|
|
|
9119d9 |
- priv->quiesced = true;
|
|
|
9119d9 |
- thawed = -1;
|
|
|
9119d9 |
- }
|
|
|
9119d9 |
- virObjectUnref(cfg);
|
|
|
9119d9 |
- }
|
|
|
9119d9 |
-
|
|
|
9119d9 |
return thawed;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
|
|
|
9119d9 |
@@ -17562,10 +17526,6 @@ qemuDomainFSFreeze(virDomainPtr dom,
|
|
|
9119d9 |
}
|
|
|
9119d9 |
|
|
|
9119d9 |
ret = qemuDomainSnapshotFSFreeze(driver, vm, mountpoints, nmountpoints);
|
|
|
9119d9 |
- if (ret == -2) {
|
|
|
9119d9 |
- qemuDomainSnapshotFSThaw(driver, vm, false);
|
|
|
9119d9 |
- ret = -1;
|
|
|
9119d9 |
- }
|
|
|
9119d9 |
|
|
|
9119d9 |
endjob:
|
|
|
9119d9 |
if (!qemuDomainObjEndJob(driver, vm))
|
|
|
9119d9 |
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
|
|
9119d9 |
index f384b33..1125f4c 100644
|
|
|
9119d9 |
--- a/src/qemu/qemu_process.c
|
|
|
9119d9 |
+++ b/src/qemu/qemu_process.c
|
|
|
9119d9 |
@@ -537,10 +537,6 @@ qemuProcessHandleReset(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
|
|
9119d9 |
priv = vm->privateData;
|
|
|
9119d9 |
if (priv->agent)
|
|
|
9119d9 |
qemuAgentNotifyEvent(priv->agent, QEMU_AGENT_EVENT_RESET);
|
|
|
9119d9 |
- /* Clear some domain runtime information. For instance,
|
|
|
9119d9 |
- * fsfreeze won't survive domain reset. This, however,
|
|
|
9119d9 |
- * required the domain status file to be rewritten onto disk. */
|
|
|
9119d9 |
- priv->quiesced = false;
|
|
|
9119d9 |
|
|
|
9119d9 |
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
|
|
|
9119d9 |
VIR_WARN("Failed to save status on vm %s", vm->def->name);
|
|
|
9119d9 |
@@ -4972,7 +4968,6 @@ void qemuProcessStop(virQEMUDriverPtr driver,
|
|
|
9119d9 |
|
|
|
9119d9 |
virPortAllocatorRelease(driver->migrationPorts, priv->nbdPort);
|
|
|
9119d9 |
priv->nbdPort = 0;
|
|
|
9119d9 |
- priv->quiesced = false;
|
|
|
9119d9 |
|
|
|
9119d9 |
if (priv->agent) {
|
|
|
9119d9 |
qemuAgentClose(priv->agent);
|
|
|
9119d9 |
--
|
|
|
9119d9 |
2.1.3
|
|
|
9119d9 |
|