Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

Disk allocation format #459

Merged
merged 1 commit into from Jun 14, 2016
Merged

Disk allocation format #459

merged 1 commit into from Jun 14, 2016

Conversation

abrarshivani
Copy link
Contributor

Fixes #427

Added option for user to select disk allocation format. Example:

docker volume create --driver=vmdk --name=vol -o diskformat=eagerzeroedthick

format choices:
"zeroedthick", "thin" (default), "eagerzeroedthick"

Tested: make all and CI

format = kv.DEFAULT_ALLOCATION_FORMAT
else:
format = str(opts[kv.DISK_ALLOCATION_FORMAT])
logging.debug("SETTING VMDK DISK ALLOCATION FORMAT to %s for %s", format, vmdk_path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use ALL CAPS. Use sentence case.

@@ -75,7 +75,7 @@
OBJ_TOOL_CMD = "/usr/lib/vmware/osfs/bin/objtool open -u "
OSFS_MKDIR_CMD = "/usr/lib/vmware/osfs/bin/osfs-mkdir -n "
MKFS_CMD = BIN_LOC + "/mkfs.ext4 -qF -L "
VMDK_CREATE_CMD = "/sbin/vmkfstools -d thin -c "
VMDK_CREATE_CMD = "/sbin/vmkfstools"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: would be better to have VMDK_CREATE_CMD = "/sbin/vmkfstools -c"
not a big deal since the string needs to be formatted anyways, just makes it more symmetric with '-U' option

@msterin
Copy link
Contributor

msterin commented Jun 14, 2016

LGTM contingent on addressing I agree with Prashant's request to add valid choices to error message. Also a couple of nits - please take a look

Ensure format is valid.
"""
if not format.lower() in kv.VALID_ALLOCATION_FORMATS :
raise ValidationError('Disk Allocation Format {0} does not exist. Valid options are: (thin(default), eagerzeroedthick, zeroedthick)'.format(format))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this statement is way beyond 80char limit or whatever PEP8 recommends. You may want split & indent in 2 lines.

Added option for user to select disk allocation format. Example:

docker volume create --driver=vmdk --name=vol -o diskformat=eagerzeroedthick
format choices:
"zeroedthick", "thin" (default), "eagerzeroedthick"
@abrarshivani
Copy link
Contributor Author

I have made changes to the code according to the comments posted here.

@abrarshivani abrarshivani merged commit ec76d4d into master Jun 14, 2016
@kerneltime kerneltime deleted the disk-allocation-format branch July 25, 2016 21:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants