[libvirt] [PATCH 2/2] blockjob: make PIVOT and ASYNC flags mutually exclusive
Peter Krempa
pkrempa at redhat.com
Mon Jul 1 15:28:18 UTC 2013
(CC'd Eric)
On 07/01/13 15:09, Ján Tomko wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=977678
> ---
> src/qemu/qemu_driver.c | 7 +++++++
> tools/virsh-domain.c | 9 ++++++---
> 2 files changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 6a83fda..aa7affe 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -14153,6 +14153,13 @@ qemuDomainBlockJobAbort(virDomainPtr dom, const char *path, unsigned int flags)
> virCheckFlags(VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC |
> VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT, -1);
>
> + if ((flags & VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC) &&
> + (flags & VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT)) {
> + virReportError(VIR_ERR_INVALID_ARG, "%s",
> + _("asynchronnous pivot not supported"));
> + return -1;
> + }
> +
I agree with this hunk.
> if (!(vm = qemuDomObjFromDomain(dom)))
> return -1;
>
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index 5257416..2653388 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -1919,11 +1919,14 @@ cmdBlockJob(vshControl *ctl, const vshCmd *cmd)
> virDomainBlockJobInfo info;
> const char *type;
> int ret;
> - bool abortMode = (vshCommandOptBool(cmd, "abort") ||
> - vshCommandOptBool(cmd, "async") ||
> - vshCommandOptBool(cmd, "pivot"));
> + bool abort = vshCommandOptBool(cmd, "abort");
> + bool async = vshCommandOptBool(cmd, "async");
> + bool pivot = vshCommandOptBool(cmd, "pivot");
> bool infoMode = vshCommandOptBool(cmd, "info");
> bool bandwidth = vshCommandOptBool(cmd, "bandwidth");
> + bool abortMode = abort || async || pivot;
> +
> + VSH_EXCLUSIVE_OPTIONS_VAR(async, pivot);
.. but I don't think we should forbid this combination in virsh. I think
could happen that we might need this combination. I think that the
combination of _ABORT and _PIVOT is less usefull.
Eric, what do you think?
(Or if we do forbid it, we need to document it, and ban it at library
level instead of qemu driver)
>
> if (abortMode + infoMode + bandwidth > 1) {
> vshError(ctl, "%s",
>
Peter
More information about the libvir-list
mailing list