Bug 1315874 - brokers.Disk.move() not honoring synchronous call
Summary: brokers.Disk.move() not honoring synchronous call
Keywords:
Status: CLOSED DUPLICATE of bug 1199011
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: 3.6.3.3
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Juan Hernández
QA Contact: Pavel Stehlik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-03-08 20:32 UTC by nicolas
Modified: 2016-03-09 10:22 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-03-09 10:22:41 UTC
oVirt Team: Infra
Embargoed:
rule-engine: planning_ack?
rule-engine: devel_ack?
rule-engine: testing_ack?


Attachments (Terms of Use)

Description nicolas 2016-03-08 20:32:56 UTC
Description of problem:

Relative to bug #1314959, I'm making a script to migrate disks of VMs in this way:

1. Copying the disk to iSCSI
2. Move the disk to a file-based storage (NFS)
3. Move the disk back to iSCSI
4. Attach the new disk to the VM
5. Detach the old disk from the VM

For step 1, I do this:

  sd = api.storagedomains.get(name='iSCSI')
  action = params.Action(storage_domain=sd, disk=params.Disk(alias='temporary'), async=False)
  disk.copy(action)

Copying is done synchronously (no prompt is shown until the disk has been entirely copied), which is especially important as I need to wait the disk to finish copying to get its new UUID. No problem so far.

For step 2, I do the same, but instead of calling copy() y call move():

  sd = api.storagedomains.get(name='NFS')
  action = params.Action(storage_domain=sd, async=False)
  disk.move(action)

Even if explicitly set async=False in the Action, the call is asynchronous, the prompt is immediately shown after the call. The call to move() must be synchronous here because before moving it back to iSCSI I need it to finish moving to NFS first.

In short: when calling move() the async=False attribute is not being honored (in copy() it behaves as expected).

Version-Release number of selected component (if applicable):

3.6.3.0

Additional info:

As a workaround, I was able to write a "poorman's" wait4unlock method like this:

def wait4unlock(api, diskalias, timeout=60):
    while True:
        disk = api.disks.get(alias=diskalias)
        st = disk.get_status()
        if st.get_state() == 'ok':
            break
        else:
            sleep(timeout)

Comment 1 Juan Hernández 2016-03-09 10:21:11 UTC
The "async=False" parameter tells the API to wait till all the activities reported by the backend have been completed. It is key to understand that *reported* doesn't mean all, as there are ongoing activities (like moving disks) that aren't reported by the backend in a way that the API can handle. See bug 1199011 for more details. This isn't going to be fixed soon. So your poorman's wait method is actually the recommended approach. You should use it for all the operations, not just moving the disk.

Comment 2 Juan Hernández 2016-03-09 10:22:41 UTC

*** This bug has been marked as a duplicate of bug 1199011 ***


Note You need to log in before you can comment on or make changes to this bug.