Bug 1425882

Summary: [RFE] provide a way to cancel (specific) jobs
Product: [Community] LVM and device-mapper Reporter: Vratislav Podzimek <vpodzime>
Component: lvm2Assignee: LVM Team <lvm-team>
lvm2 sub component: lvmdbusd QA Contact: cluster-qe <cluster-qe>
Status: NEW --- Docs Contact:
Severity: unspecified    
Priority: medium CC: agk, heinzm, jbrassow, msnitzer, pasik, prajnoha, tasleson, zkabelac
Version: unspecifiedKeywords: Triaged
Target Milestone: ---Flags: rule-engine: lvm-technical-solution?
rule-engine: lvm-test-coverage?
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1427323, 1563827, 1595334    
Bug Blocks:    

Description Vratislav Podzimek 2017-02-22 16:24:49 UTC
Description of problem:
The lvm2-dbusd API returns Job objects for actions being performed. The Job objects provide results, progress and other features as described at https://github.com/tasleson/lvm-dubstep/blob/master/api.md#interface-comredhatlvmdbus1job

However, there's no way to cancel a Job. For example a job for 'pvmove' can take a very log time while the underlying operation can be safely canceled. It would be nice if the com.redhat.lvmdbus1.Job interface provided a Cancel() method or there was a new com.redhat.lvmdbus1.Job.Cancellable interface providing such method at least for specific types of actions. (If the Cancel() method is added to the com.redhat.lvmdbus1.Job interface, it may just return error if the action it runs doesn't support cancellation)

Comment 1 Tony Asleson 2017-02-23 22:00:50 UTC
The only thing we can interrupt is pvmove(s).  However, lvm only gives us the ability to abort *all* outstanding moves, not specific ones.  I will follow-up with the lvm team on if we could provide a mechanism to abort specific move operations.  Otherwise I think we are only left with something like Manager.PvMoveAbort().

Comment 2 Alasdair Kergon 2017-02-24 01:04:21 UTC
The command line is supposed to work in exactly the same way as other options - if you give additional arguments it's supposed to use them to identify the pvmove(s) the action applies to.  Is this facility missing from the API?

Comment 3 Tony Asleson 2017-02-24 16:14:48 UTC
(In reply to Alasdair Kergon from comment #2)
> The command line is supposed to work in exactly the same way as other
> options - if you give additional arguments it's supposed to use them to
> identify the pvmove(s) the action applies to.  

OK I incorrectly concluded from the man page:

"--abort
     Abort  any moves in progress.  If the --atomic option was used to start
     the pvmove, all logical volumes will remain on the source physical vol‐
     ume.   Otherwise, those segments that have completed the move will stay
     on the destination physical volume, while  those  that  have  not  will
     remain on the source physical volume."

that `pvmove --abort` was the only option (which does indeed work).  In empirical testing it appears that you can select a specific move to abort.

> Is this facility missing from
> the API?

Yes, thus the reason for this specific BZ

Comment 4 Vratislav Podzimek 2017-02-28 15:16:27 UTC
> OK I incorrectly concluded from the man page:...

Same here. Looks like the man page needs to be more explicit.