Support converting types during upload

Allow the user to specify other, non-raw files and upload them,
performing a conversion with qemu-img convert and a temporary block
device as a shim (since qemu-img can't use FIFOs).

Also ensures that the target volume exists before proceeding.

Addresses #68
This commit is contained in:
2020-02-09 19:43:07 -05:00
parent 49e5ce1176
commit e419855911
4 changed files with 166 additions and 38 deletions

View File

@ -38,11 +38,12 @@ import daemon_lib.zkhandler as zkhandler
#
# Run a local OS command via shell
#
def run_os_command(command_string, background=False, environment=None, timeout=None):
def run_os_command(command_string, background=False, environment=None, timeout=None, shell=False):
command = shlex.split(command_string)
try:
command_output = subprocess.run(
command,
shell=shell,
env=environment,
timeout=timeout,
stdout=subprocess.PIPE,