Project

General

Profile

Bug #57528

API bug: Impossible to delete a cloned ZVol

Added by Waqar Ahmed almost 2 years ago. Updated almost 2 years ago.

Status:
Done
Priority:
No priority
Assignee:
Waqar Ahmed
Category:
Middleware
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 #57519: Fix APIv1 bug that prevented deletion of a cloned zvolDone

History

#1 Updated by Waqar Ahmed almost 2 years ago

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

#2 Updated by Bug Clerk almost 2 years ago

  • Status changed from In Progress to Ready for Testing

#3 Updated by Dru Lavigne almost 2 years ago

  • Status changed from Ready for Testing to Done
  • Target version changed from 11.3 to Master - FreeNAS Nightlies
  • Needs QA changed from Yes to No
  • Needs Doc changed from Yes to No
  • Needs Merging changed from Yes to No

Also available in: Atom PDF