On 11/20/14 12:52, Erik Skultety wrote: > When a block{pull, copy, commit} is aborted via keyboard interrupt, > the job is properly canceled followed by proper error message. > However, when the job receives an abort from another client connected > to the same domain, the error message incorrectly indicates that > a blockjob has been finished successfully, though the abort request > took effect. This patch introduces a new blockjob abort handler, which > is registered when the client calls block{copy,commit,pull} routine, > providing its caller the status of the finished blockjob. > > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1135442 > --- > tools/virsh-domain.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++--- > 1 file changed, 68 insertions(+), 3 deletions(-) > > diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c > index a7e9151..0891821 100644 > --- a/tools/virsh-domain.c > +++ b/tools/virsh-domain.c > @@ -1709,6 +1709,17 @@ static void vshCatchInt(int sig ATTRIBUTE_UNUSED, > intCaught = 1; > } > > +static void > +vshBlockJobStatusHandler(virConnectPtr conn ATTRIBUTE_UNUSED, > + virDomainPtr dom ATTRIBUTE_UNUSED, > + const char *disk ATTRIBUTE_UNUSED, > + int type ATTRIBUTE_UNUSED, > + int status, > + void *opaque) > +{ > + *(int *) opaque = status; > +} > + > /* > * "blockcommit" command > */ > @@ -1808,6 +1819,8 @@ cmdBlockCommit(vshControl *ctl, const vshCmd *cmd) > const char *path = NULL; > bool quit = false; > int abort_flags = 0; > + int status = -1; > + int cb_id = -1; > > blocking |= vshCommandOptBool(cmd, "timeout") || pivot || finish; > if (blocking) { > @@ -1837,6 +1850,17 @@ cmdBlockCommit(vshControl *ctl, const vshCmd *cmd) > return false; > } > > + virConnectDomainEventGenericCallback cb = > + VIR_DOMAIN_EVENT_CALLBACK(vshBlockJobStatusHandler); > + > + if ((cb_id = virConnectDomainEventRegisterAny(ctl->conn, > + dom, > + VIR_DOMAIN_EVENT_ID_BLOCK_JOB, > + cb, > + &status, > + NULL)) < 0) The lines above are misaligned after you added the condition. > + vshResetLibvirtError(); > + > if (!blockJobImpl(ctl, cmd, VSH_CMD_BLOCK_JOB_COMMIT, &dom)) > goto cleanup; > I've fixed all three instances and pushed the patch. Peter
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list