Project

General

Profile

Bug #15453

Bug #10795: Need to prune old boot environments when space is running low and need to create new one

ListClones always shows "True" for keep flag.

Added by Anonymous over 4 years ago. Updated almost 3 years ago.

Status:
Resolved
Priority:
Important
Assignee:
-
Category:
Middleware
Severity:
New
Reason for Closing:
Reason for Blocked:
Needs QA:
Yes
Needs Doc:
Yes
Needs Merging:
Yes
Needs Automation:
No
Support Suite Ticket:
n/a
Hardware Configuration:
ChangeLog Required:
No

Description

I found an issue with ListClones module code. ListClones fetches keep information from ZFS.
Irrespective of any value for "keep" it always shows as "True" in dictionary that it returns.

This API fetches the VALUE for a PROPERTY.

History

#1 Updated by Anonymous over 4 years ago

I found an issue with ListClones module code. ListClones fetches keep information from ZFS.
Irrespective of any value for "keep" it always shows as "True" in dictionary that it returns.

Existing Code:
--------------
try:
prop_cmd = ["/sbin/zfs", "get", "-H", "-o", "value", "beadm:keep"]
prop_cmd.append("freenas-boot/ROOT/{0}".format(tdict["realname"]))
keep_str = subprocess.check_output(prop_cmd).rstrip()
if keep_str == "-":
tdict["keep"] = None
else:
tdict["keep"] = bool(keep_str)
except:
log.debug("Could not get beadm properties from dataset")
rv.append(tdict)
return rv

Proposed Code:
--------------
try:
prop_cmd = ["/sbin/zfs", "get", "-H", "-o", "value", "beadm:keep"]
prop_cmd.append("freenas-boot/ROOT/{0}".format(tdict["realname"]))
keep_str = subprocess.check_output(prop_cmd).rstrip()
if keep_str == "-":
tdict["keep"] = None
else:
if keep_str == "True":
tdict["keep"] = True
elif keep_str == "False":
tdict["keep"] = False
else:
tdict["keep"] = None
except:
log.debug("Could not get beadm properties from dataset")
rv.append(tdict)
return rv

#2 Updated by Anonymous over 4 years ago

  • Status changed from Investigation to Resolved
  • % Done changed from 0 to 100

Bug fixed and tested.

#3 Updated by Dru Lavigne almost 3 years ago

  • Target version set to Master - FreeNAS Nightlies

Also available in: Atom PDF