Bug 1518693

Summary: Quota is needed to copy template disk
Product: [oVirt] ovirt-engine Reporter: Raz Tamir <ratamir>
Component: BLL.StorageAssignee: Andrej Krejcir <akrejcir>
Status: CLOSED CURRENTRELEASE QA Contact: Raz Tamir <ratamir>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.2.0CC: akrejcir, bugs, kgoldbla
Target Milestone: ovirt-4.2.0Keywords: Automation, Regression
Target Release: ---Flags: rule-engine: ovirt-4.2+
rule-engine: blocker+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Null quota on a disk is not allowed. When a disk is copied or moved using the rest API and no quota parameter is specified, the new disk will have the same quota as the old one. Consequence: If an existing disk has a null quota in the DB, because it was created before the default quota was introduced, it cannot be copied or using without specifying a new quota. Fix: If a disk with null quota is copied without specifying new quota, the default quota is used. Result: Copying and moving disks using rest now works as expected without specifying new quota.
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-12-20 11:18:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: SLA RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
engine log none

Description Raz Tamir 2017-11-29 13:34:15 UTC
Created attachment 1360311 [details]
engine log

Description of problem:
In our automation (tier 3) we see that copying a template's disk is now required a quota for the operation to succeed:

POST to /api/disks/14b4fbc2-2610-4420-87b0-72260bada96d/copy
<action>
    <async>false</async>
    <storage_domain href="/ovirt-engine/api/storagedomains/0b7d7943-ec75-4738-b263-ac1ba9ba216e" id="0b7d7943-ec75-4738-b263-ac1ba9ba216e">
        <name>nfs_1</name>
        <storage>
            <address>yellow-vdsb.qa.lab.tlv.redhat.com</address>
            <path>/Storage_NFS/storage_local_ge6_nfs_1</path>
            <type>nfs</type>
        </storage>
        <storage_format>v4</storage_format>
        <type>data</type>
        <data_centers>
            <data_center href="/ovirt-engine/api/datacenters/480d7e0f-4587-41d7-a045-a0fd8a41b6af" id="480d7e0f-4587-41d7-a045-a0fd8a41b6af"/>
        </data_centers>
    </storage_domain>
</action>

Failed with 
Status: 400
Reason: Bad Request
Detail: [Cannot copy Virtual Disk. Quota cannot be null.]

In engine.log:
2017-11-29 15:22:02,255+02 INFO  [org.ovirt.engine.core.bll.storage.disk.MoveOrCopyDiskCommand] (default task-16) [disks_syncAction_1001ea6d-4d06-4a50] Lock Acquired to object 'EngineLock:{exclusiveLocks='[14b4fbc2-2610-4420-87b0-72260bada96d=DISK]', sharedLocks='[d022534c-ef42-4496-b13f-3838f5ca32d3=TEMPLATE]'}'
2017-11-29 15:22:02,629+02 WARN  [org.ovirt.engine.core.bll.storage.disk.MoveOrCopyDiskCommand] (default task-16) [disks_syncAction_1001ea6d-4d06-4a50] Validation of action 'MoveOrCopyDisk' failed for user admin@internal-authz. Reasons: VAR__ACTION__COPY,VAR__TYPE__DISK,ACTION_TYPE_FAILED_QUOTA_NULL_NOT_ALLOWED
2017-11-29 15:22:02,630+02 INFO  [org.ovirt.engine.core.bll.storage.disk.MoveOrCopyDiskCommand] (default task-16) [disks_syncAction_1001ea6d-4d06-4a50] Lock freed to object 'EngineLock:{exclusiveLocks='[14b4fbc2-2610-4420-87b0-72260bada96d=DISK]', sharedLocks='[d022534c-ef42-4496-b13f-3838f5ca32d3=TEMPLATE]'}'
2017-11-29 15:22:02,694+02 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (default task-16) [] Operation Failed: [Cannot copy Virtual Disk. Quota cannot be null.]



Version-Release number of selected component (if applicable):
ovirt-engine-4.2.0-0.5.master.el7.noarch

How reproducible:
100%

Steps to Reproduce:
1. Copy template disk using the provided POST body
2.
3.

Actual results:


Expected results:
Regression flag - this test is passing in previous builds

Additional info:

Comment 1 Allon Mureinik 2017-11-29 13:39:45 UTC
Quotas are SLA's domain.
I **think** this was done intentionally, but let's leave it up to the appropriate stakeholders to weigh in.

Comment 2 Andrej Krejcir 2017-11-29 14:12:10 UTC
This is partially intentional. The change was done in Bug 1496704.

When a disk is copied using REST and no quota parameter is specified, the current quota of the disk is used for the copy. But if the disk has null quota, it cannot be used for the new disk and the error is shown.

We can change this, so if the original disk has null quota, the default quota will be used for the copy.

As a workaround, the default quota can be used as a parameter in the rest call:

<action>
  <storage_domain id=... />
  <quota id={ID_OF_THE_DEFAULT_QUOTA} />
</action>

The new parameters are described here:
http://ovirt.github.io/ovirt-engine-api-model/master/#services/disk/methods/copy

Comment 3 Raz Tamir 2017-11-30 12:42:13 UTC
*** Bug 1519224 has been marked as a duplicate of this bug. ***

Comment 4 Raz Tamir 2017-12-07 20:18:12 UTC
Not observed in automation run over rhvm-4.2.0-0.6.el7

Verified

Comment 5 Sandro Bonazzola 2017-12-20 11:18:04 UTC
This bugzilla is included in oVirt 4.2.0 release, published on Dec 20th 2017.

Since the problem described in this bug report should be
resolved in oVirt 4.2.0 release, published on Dec 20th 2017, it has been closed with a resolution of CURRENT RELEASE.

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