mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 22:25:25 +00:00
qemu: Don't track quiesced state of FSs
https://bugzilla.redhat.com/show_bug.cgi?id=1160084 As ofb6d4dad11b
(1.2.5) we are trying to keep the status of FSFreeze in the guest. Even though I've tried to fixed couple of corner cases (6ea54769ba
), it occurred to me just recently, that the approach is broken by design. Firstly, there are many other ways to talk to qemu-ga (even through libvirt) that filesystems can be thawed (e.g. qemu-agent-command) without libvirt noticing. Moreover, there are plenty of ways to thaw filesystems without even qemu-ga noticing (yes, qemu-ga keeps internal track of FSFreeze status). So, instead of keeping the track ourselves, or asking qemu-ga for stale state, it's the best to let qemu-ga deal with that (and possibly let guest kernel propagate an error). Moreover, there's one bug with the following approach, if fsfreeze command failed, we've executed fsthaw subsequently. So issuing domfsfreeze in virsh gave the following result: virsh # domfsfreeze gentoo Froze 1 filesystem(s) virsh # domfsfreeze gentoo error: Unable to freeze filesystems error: internal error: unable to execute QEMU agent command 'guest-fsfreeze-freeze': The command guest-fsfreeze-freeze has been disabled for this instance virsh # domfsfreeze gentoo Froze 1 filesystem(s) virsh # domfsfreeze gentoo error: Unable to freeze filesystems error: internal error: unable to execute QEMU agent command 'guest-fsfreeze-freeze': The command guest-fsfreeze-freeze has been disabled for this instance Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
9340528a7f
commit
6085d917d5
@ -563,9 +563,6 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf, void *data)
|
|||||||
virBufferAddLit(buf, "</devices>\n");
|
virBufferAddLit(buf, "</devices>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->quiesced)
|
|
||||||
virBufferAddLit(buf, "<quiesced/>\n");
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -750,8 +747,6 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
|
|||||||
}
|
}
|
||||||
VIR_FREE(nodes);
|
VIR_FREE(nodes);
|
||||||
|
|
||||||
priv->quiesced = virXPathBoolean("boolean(./quiesced)", ctxt) == 1;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
@ -187,8 +187,6 @@ struct _qemuDomainObjPrivate {
|
|||||||
char **qemuDevices; /* NULL-terminated list of devices aliases known to QEMU */
|
char **qemuDevices; /* NULL-terminated list of devices aliases known to QEMU */
|
||||||
|
|
||||||
bool hookRun; /* true if there was a hook run over this domain */
|
bool hookRun; /* true if there was a hook run over this domain */
|
||||||
|
|
||||||
bool quiesced; /* true if filesystems are quiesced */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -12704,34 +12704,17 @@ qemuDomainPrepareDiskChainElement(virQEMUDriverPtr driver,
|
|||||||
* is sent but failed, and number of frozen filesystems on success. If -2 is
|
* is sent but failed, and number of frozen filesystems on success. If -2 is
|
||||||
* returned, FSThaw should be called revert the quiesced status. */
|
* returned, FSThaw should be called revert the quiesced status. */
|
||||||
static int
|
static int
|
||||||
qemuDomainSnapshotFSFreeze(virQEMUDriverPtr driver,
|
qemuDomainSnapshotFSFreeze(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
const char **mountpoints,
|
const char **mountpoints,
|
||||||
unsigned int nmountpoints)
|
unsigned int nmountpoints)
|
||||||
{
|
{
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
virQEMUDriverConfigPtr cfg;
|
|
||||||
int frozen;
|
int frozen;
|
||||||
|
|
||||||
if (priv->quiesced) {
|
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
|
||||||
_("domain is already quiesced"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!qemuDomainAgentAvailable(priv, true))
|
if (!qemuDomainAgentAvailable(priv, true))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
priv->quiesced = true;
|
|
||||||
|
|
||||||
cfg = virQEMUDriverGetConfig(driver);
|
|
||||||
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
|
|
||||||
priv->quiesced = false;
|
|
||||||
virObjectUnref(cfg);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
virObjectUnref(cfg);
|
|
||||||
|
|
||||||
qemuDomainObjEnterAgent(vm);
|
qemuDomainObjEnterAgent(vm);
|
||||||
frozen = qemuAgentFSFreeze(priv->agent, mountpoints, nmountpoints);
|
frozen = qemuAgentFSFreeze(priv->agent, mountpoints, nmountpoints);
|
||||||
qemuDomainObjExitAgent(vm);
|
qemuDomainObjExitAgent(vm);
|
||||||
@ -12741,24 +12724,17 @@ qemuDomainSnapshotFSFreeze(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
/* Return -1 on error, otherwise number of thawed filesystems. */
|
/* Return -1 on error, otherwise number of thawed filesystems. */
|
||||||
static int
|
static int
|
||||||
qemuDomainSnapshotFSThaw(virQEMUDriverPtr driver,
|
qemuDomainSnapshotFSThaw(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
bool report)
|
bool report)
|
||||||
{
|
{
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
virQEMUDriverConfigPtr cfg;
|
|
||||||
int thawed;
|
int thawed;
|
||||||
virErrorPtr err = NULL;
|
virErrorPtr err = NULL;
|
||||||
|
|
||||||
if (!qemuDomainAgentAvailable(priv, report))
|
if (!qemuDomainAgentAvailable(priv, report))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!priv->quiesced && report) {
|
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
|
||||||
_("domain is not quiesced"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
qemuDomainObjEnterAgent(vm);
|
qemuDomainObjEnterAgent(vm);
|
||||||
if (!report)
|
if (!report)
|
||||||
err = virSaveLastError();
|
err = virSaveLastError();
|
||||||
@ -12769,18 +12745,6 @@ qemuDomainSnapshotFSThaw(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
virFreeError(err);
|
virFreeError(err);
|
||||||
|
|
||||||
if (!report || thawed >= 0) {
|
|
||||||
priv->quiesced = false;
|
|
||||||
|
|
||||||
cfg = virQEMUDriverGetConfig(driver);
|
|
||||||
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
|
|
||||||
/* Revert the statuses when we failed to save them. */
|
|
||||||
priv->quiesced = true;
|
|
||||||
thawed = -1;
|
|
||||||
}
|
|
||||||
virObjectUnref(cfg);
|
|
||||||
}
|
|
||||||
|
|
||||||
return thawed;
|
return thawed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18033,10 +17997,6 @@ qemuDomainFSFreeze(virDomainPtr dom,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = qemuDomainSnapshotFSFreeze(driver, vm, mountpoints, nmountpoints);
|
ret = qemuDomainSnapshotFSFreeze(driver, vm, mountpoints, nmountpoints);
|
||||||
if (ret == -2) {
|
|
||||||
qemuDomainSnapshotFSThaw(driver, vm, false);
|
|
||||||
ret = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
if (!qemuDomainObjEndJob(driver, vm))
|
if (!qemuDomainObjEndJob(driver, vm))
|
||||||
|
@ -539,10 +539,6 @@ qemuProcessHandleReset(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
|||||||
priv = vm->privateData;
|
priv = vm->privateData;
|
||||||
if (priv->agent)
|
if (priv->agent)
|
||||||
qemuAgentNotifyEvent(priv->agent, QEMU_AGENT_EVENT_RESET);
|
qemuAgentNotifyEvent(priv->agent, QEMU_AGENT_EVENT_RESET);
|
||||||
/* Clear some domain runtime information. For instance,
|
|
||||||
* fsfreeze won't survive domain reset. This, however,
|
|
||||||
* required the domain status file to be rewritten onto disk. */
|
|
||||||
priv->quiesced = false;
|
|
||||||
|
|
||||||
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
|
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
|
||||||
VIR_WARN("Failed to save status on vm %s", vm->def->name);
|
VIR_WARN("Failed to save status on vm %s", vm->def->name);
|
||||||
@ -4985,7 +4981,6 @@ void qemuProcessStop(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
virPortAllocatorRelease(driver->migrationPorts, priv->nbdPort);
|
virPortAllocatorRelease(driver->migrationPorts, priv->nbdPort);
|
||||||
priv->nbdPort = 0;
|
priv->nbdPort = 0;
|
||||||
priv->quiesced = false;
|
|
||||||
|
|
||||||
if (priv->agent) {
|
if (priv->agent) {
|
||||||
qemuAgentClose(priv->agent);
|
qemuAgentClose(priv->agent);
|
||||||
|
Loading…
Reference in New Issue
Block a user