Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 876115

Summary: 3.1 - [vdsm] moveImage fails in case 'force' option is True and image doesn't exists on destination storage domain
Product: Red Hat Enterprise Linux 6 Reporter: Haim <hateya>
Component: vdsmAssignee: Eduardo Warszawski <ewarszaw>
Status: CLOSED ERRATA QA Contact: Haim <hateya>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.3CC: abaron, achan, bazulay, dpaikov, eedri, ewarszaw, hateya, iheim, ilvovsky, jlibosva, lpeer, thildred, yeylon, ykaul
Target Milestone: rcKeywords: Regression, ZStream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: Storage
Fixed In Version: vdsm-4.9.6-43.0 Doc Type: Bug Fix
Doc Text:
Previously, an error would occur when using "moveImage" from the Rest API when the image did not exist in the source domain and an internal parameter "force" was set. VDSM would try to delete the image even though it did not exist and the task failed. VDSM now validates if the image exists and will output an error message if no source volumes are found.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-04 19:14:02 UTC 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:
Attachments:
Description Flags
full logs.
none
vdsm + engine logs none

Description Haim 2012-11-13 11:12:09 UTC
Description of problem:

moveImage operation (with copy operand) fails since function is called with 'force' value in 'true' as vdsm tries to delete the image even if it doesn't exists, exception is not caught, and task is failing.

    def move(self, srcSdUUID, dstSdUUID, imgUUID, vmUUID, op, postZero, force):
        """
        ...
        destDom = sdCache.produce(dstSdUUID)
        # If image already exists check whether it illegal/fake, overwrite it
        if not self.isLegal(destDom.sdUUID, imgUUID):
            force = True
        # We must first remove the previous instance of image (if exists)
        # in destination domain, if we got the overwrite command
        if force:
            self.log.info("delete image %s on domain %s before overwriting", imgUUID, destDom.sdUUID)
            _deleteImage(destDom, imgUUID, postZero)

        chains = self._createTargetImage(destDom, srcSdUUID, imgUUID)
        self._interImagesCopy(destDom, srcSdUUID, imgUUID, chains)
        self._finalizeDestinationImage(destDom, imgUUID, chains, force)
        if force:
            leafVol = chains['dstChain'][-1]
            # Now we should re-link all deleted hardlinks, if exists
            self.__templateRelink(destDom, imgUUID, leafVol.volUUID)

we are hitting this issue in API tests where 'force' is always true (another bug).

excepted results:

vdsm should be more robust and validate if image exists before it tries to delete it or use try: except: method.

Comment 1 Haim 2012-11-13 11:16:21 UTC
Created attachment 644061 [details]
full logs.

Comment 5 Eduardo Warszawski 2012-11-13 14:34:39 UTC
This is not a regression.

You should not use force parameter for overriding a non-existent image.
And non-inexistent images can't be removed.
Rest API should not send force in every call.


d05470ea-9e55-4598-97cc-cc779adfe02d::ERROR::2012-11-13 06:09:00,478::task::853::TaskManager.Task::(_setError) Task=`d05470ea-9e55-4598-97cc-cc779adfe02d`::Unexpected error
Traceback (most recent call last):
  File "/usr/share/vdsm/storage/task.py", line 861, in _run
    return fn(*args, **kargs)
  File "/usr/share/vdsm/storage/task.py", line 320, in run
    return self.cmd(*self.argslist, **self.argsdict)
  File "/usr/share/vdsm/storage/securable.py", line 63, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/share/vdsm/storage/sp.py", line 1741, in moveImage
    image.Image(repoPath).move(srcDomUUID, dstDomUUID, imgUUID, vmUUID, op, postZero, force)
  File "/usr/share/vdsm/storage/image.py", line 628, in move
    _deleteImage(destDom, imgUUID, postZero)
  File "/usr/share/vdsm/storage/image.py", line 80, in _deleteImage
    dom.deleteImage(dom.sdUUID, imgUUID, imgVols)
  File "/usr/share/vdsm/storage/blockSD.py", line 945, in deleteImage
    deleteVolumes(sdUUID, toDel)
  File "/usr/share/vdsm/storage/blockSD.py", line 177, in deleteVolumes
    lvm.removeLVs(sdUUID, vols)
  File "/usr/share/vdsm/storage/lvm.py", line 1010, in removeLVs
    raise se.CannotRemoveLogicalVolume(vgName, str(lvNames))
CannotRemoveLogicalVolume: Cannot remove Logical Volume: ('065747fa-57d3-435a-81f0-448a9210191a', '()')

Comment 7 Haim 2012-11-13 16:49:04 UTC
*** Bug 876104 has been marked as a duplicate of this bug. ***

Comment 9 Igor Lvovsky 2012-11-14 16:57:25 UTC
http://gerrit.ovirt.org/#/c/9244/

Comment 11 Gadi Ickowicz 2012-11-18 14:12:28 UTC
Created attachment 647181 [details]
vdsm + engine logs

Verified on SI 24.2.

Comment 13 errata-xmlrpc 2012-12-04 19:14:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2012-1508.html