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.
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:
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
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.
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: