Project

General

Profile

Bug #57519

Fix APIv1 bug that prevented deletion of a cloned zvol

Added by Waqar Ahmed 6 months ago. Updated 3 months ago.

Status:
Done
Priority:
No priority
Assignee:
Waqar Ahmed
Category:
Middleware
Target version:
Seen in:
Severity:
Low Medium
Reason for Closing:
Reason for Blocked:
Needs QA:
No
Needs Doc:
No
Needs Merging:
No
Needs Automation:
No
Support Suite Ticket:
n/a
Hardware Configuration:
ChangeLog Required:
No

Description

I'm trying to delete a cloned ZFS snapshot:

curl -v -X DELETE /api/v1.0/storage/volume/tank/zvols/<volname>/

This returns the following response:

* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Content-Type: application/json
< Content-Length: 121
< Server: Werkzeug/0.14.1 Python/3.6.5
< Date: Tue, 13 Nov 2018 11:30:39 GMT
<
"The object '&lt;ZFSVol: tank/volname&gt;' has an empty attribute 'description' and doesn't allow a default or null value." 

Cloned volumes have the comments/description attribute empty and there is no REST method to PUT a description on an existing Zvol - it can only be set at ZVol creation.

If I use the web GUI to manually set random comments to ZVols, I can then delete them via the API.

In /usr/local/www/freenasUI/api/resources.py, in the ZVolResource class, I made the following change by hand:

-    comments = fields.CharField(attribute='description')
+    comments = fields.CharField(attribute='description', null=True)

And now I can delete ZFS vols via the API without issues.

So, the tastypie-defined comments field for ZVols should be made optional or cloning a snapshot should set a default comment or allow the ZVolResource.put() method to edit the "comments" attribute.


Related issues

Copied from FreeNAS - Bug #57141: Fix APIv1 bug that prevented deletion of a cloned zvolDone
Copied to FreeNAS - Bug #57528: API bug: Impossible to delete a cloned ZVolDone

History

#1 Updated by Waqar Ahmed 6 months ago

  • Copied from Bug #57141: Fix APIv1 bug that prevented deletion of a cloned zvol added

#2 Updated by Waqar Ahmed 6 months ago

  • Copied to Bug #57528: API bug: Impossible to delete a cloned ZVol added

#3 Updated by Dru Lavigne 6 months ago

  • Subject changed from API bug: Impossible to delete a cloned ZVol to Fix APIv1 bug that prevented deletion of a cloned zvol

#4 Updated by Bug Clerk 6 months ago

  • Status changed from In Progress to Ready for Testing

#5 Updated by Dru Lavigne 5 months ago

  • Needs Doc changed from Yes to No
  • Needs Merging changed from Yes to No

#8 Updated by Dru Lavigne 3 months ago

  • Status changed from Ready for Testing to Done
  • Target version changed from 11.2-U2 to Master - FreeNAS Nightlies
  • Needs QA changed from Yes to No

#9 Updated by Dru Lavigne 3 months ago

  • Status changed from Done to Ready for Testing

#10 Updated by Dru Lavigne 3 months ago

  • Target version changed from Master - FreeNAS Nightlies to 11.2-U2

#11 Updated by Bonnie Follweiler 3 months ago

  • Status changed from Ready for Testing to Passed Testing

Test Passed in FreeNAS-11.2-U2-INTERNAL87

#12 Updated by Dru Lavigne 3 months ago

  • Status changed from Passed Testing to Done

Also available in: Atom PDF