RainbowHackerHorse / vzvol

vzvol is a general use ZFS zvol management tool, that handles creation, destruction, listing, and formatting with various FSes, in an easy to use single program
BSD 2-Clause "Simplified" License
31 stars 5 forks source link

--delete doesn't #30

Closed adriaandegroot closed 6 years ago

adriaandegroot commented 6 years ago

Admittedly, this is with vzvol 0.5, but I've looked and the code is unchanged.

root@beastie:/zpool/vm/iso # vzvol --list
ZVOL                         TYPE  VMDK  USED   SIZE   FS
zpool/bhyve-test             RAW   none  56K    20.6G  none
zpool/manjaro                RAW   none  13.1G  20.6G  none
zpool/netrunner              RAW   none  9.68G  12.4G  none
root@beastie:/zpool/vm/iso/pine64 # vzvol --delete zpool/bhyve-test
Error, zvol zpool/bhyve-test does not exist.
Try running vzvol --list or zfs list -t volume to see the available zvols on the system.
Error occurred in function getargz
Exiting

The code to check existence of a volume is different between --delete and --format; --delete only works if there's exactly one zvol, not when there's more. The problem is vzvol_getargz.sh line 97, in if ... | grep -vq "${2}" ; then .. this gives a successful exit if there are other zvols. You probably want the same code as in --format, which reverses the logic and drops the -v flag to grep.

RainbowHackerHorse commented 6 years ago

Thanks for reporting! Resolved :)