|
|
9119d9 |
From 6e4847fa4fd206e8954d07eebda809568d2fa2a4 Mon Sep 17 00:00:00 2001
|
|
|
9119d9 |
Message-Id: <6e4847fa4fd206e8954d07eebda809568d2fa2a4@dist-git>
|
|
|
9119d9 |
From: Eric Blake <eblake@redhat.com>
|
|
|
9119d9 |
Date: Tue, 13 Jan 2015 08:31:58 -0700
|
|
|
9119d9 |
Subject: [PATCH] qemu: forbid second blockcommit during active commit
|
|
|
9119d9 |
|
|
|
9119d9 |
https://bugzilla.redhat.com/show_bug.cgi?id=1135339 documents some
|
|
|
9119d9 |
confusing behavior when a user tries to start an inactive block
|
|
|
9119d9 |
commit in a second connection while there is already an on-going
|
|
|
9119d9 |
active commit from a first connection. Eventually, qemu will
|
|
|
9119d9 |
support multiple simultaneous block jobs, but as of now, it does
|
|
|
9119d9 |
not; furthermore, libvirt also needs an overhaul before we can
|
|
|
9119d9 |
support simultaneous jobs. So, the best way to avoid confusing
|
|
|
9119d9 |
ourselves is to quit relying on qemu to tell us about the situation
|
|
|
9119d9 |
(where we risk getting in weird states) and instead forbid a
|
|
|
9119d9 |
duplicate block commit ourselves.
|
|
|
9119d9 |
|
|
|
9119d9 |
Note that we are still relying on qemu to diagnose attempts to
|
|
|
9119d9 |
interrupt an inactive commit (since we only track XML of an active
|
|
|
9119d9 |
commit), but as inactive commit is less confusing for libvirt to
|
|
|
9119d9 |
manage, there is less that can go wrong by leaving that detection
|
|
|
9119d9 |
up to qemu.
|
|
|
9119d9 |
|
|
|
9119d9 |
* src/qemu/qemu_driver.c (qemuDomainBlockCommit): Hoist check for
|
|
|
9119d9 |
active commit to occur earlier outside of conditions.
|
|
|
9119d9 |
|
|
|
9119d9 |
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
9119d9 |
(cherry picked from commit e1125cebfc057059f444894c6cedf1f29379bca3)
|
|
|
9119d9 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
9119d9 |
---
|
|
|
9119d9 |
src/qemu/qemu_driver.c | 14 +++++++-------
|
|
|
9119d9 |
1 file changed, 7 insertions(+), 7 deletions(-)
|
|
|
9119d9 |
|
|
|
9119d9 |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
9119d9 |
index 77f8cac..8830e04 100644
|
|
|
9119d9 |
--- a/src/qemu/qemu_driver.c
|
|
|
9119d9 |
+++ b/src/qemu/qemu_driver.c
|
|
|
9119d9 |
@@ -1,7 +1,7 @@
|
|
|
9119d9 |
/*
|
|
|
9119d9 |
* qemu_driver.c: core driver methods for managing qemu guests
|
|
|
9119d9 |
*
|
|
|
9119d9 |
- * Copyright (C) 2006-2014 Red Hat, Inc.
|
|
|
9119d9 |
+ * Copyright (C) 2006-2015 Red Hat, Inc.
|
|
|
9119d9 |
* Copyright (C) 2006 Daniel P. Berrange
|
|
|
9119d9 |
*
|
|
|
9119d9 |
* This library is free software; you can redistribute it and/or
|
|
|
9119d9 |
@@ -16027,6 +16027,12 @@ qemuDomainBlockCommit(virDomainPtr dom,
|
|
|
9119d9 |
disk->dst);
|
|
|
9119d9 |
goto endjob;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
+ if (disk->mirror) {
|
|
|
9119d9 |
+ virReportError(VIR_ERR_BLOCK_COPY_ACTIVE,
|
|
|
9119d9 |
+ _("disk '%s' already in active block job"),
|
|
|
9119d9 |
+ disk->dst);
|
|
|
9119d9 |
+ goto endjob;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
if (qemuDomainDetermineDiskChain(driver, vm, disk, false, true) < 0)
|
|
|
9119d9 |
goto endjob;
|
|
|
9119d9 |
|
|
|
9119d9 |
@@ -16051,12 +16057,6 @@ qemuDomainBlockCommit(virDomainPtr dom,
|
|
|
9119d9 |
disk->dst);
|
|
|
9119d9 |
goto endjob;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
- if (disk->mirror) {
|
|
|
9119d9 |
- virReportError(VIR_ERR_BLOCK_COPY_ACTIVE,
|
|
|
9119d9 |
- _("disk '%s' already in active block job"),
|
|
|
9119d9 |
- disk->dst);
|
|
|
9119d9 |
- goto endjob;
|
|
|
9119d9 |
- }
|
|
|
9119d9 |
} else if (flags & VIR_DOMAIN_BLOCK_COMMIT_ACTIVE) {
|
|
|
9119d9 |
virReportError(VIR_ERR_INVALID_ARG,
|
|
|
9119d9 |
_("active commit requested but '%s' is not active"),
|
|
|
9119d9 |
--
|
|
|
9119d9 |
2.2.1
|
|
|
9119d9 |
|