Properly handle =-separated fsargs

This commit is contained in:
Joshua Boniface 2021-08-24 11:40:22 -04:00
parent 3b41beb0f3
commit 722fd0a65d
1 changed files with 7 additions and 3 deletions

View File

@ -1510,15 +1510,17 @@ def create_vm(self, vm_name, vm_profile, define_vm=True, start_vm=True, script_r
if volume.get('filesystem') is None: if volume.get('filesystem') is None:
continue continue
print("Creating {} filesystem on {}:\n{}".format(volume['filesystem'], dst_volume, stdout))
filesystem_args_list = list() filesystem_args_list = list()
for arg in volume['filesystem_args'].split(): for arg in volume['filesystem_args'].split():
arg_entry, arg_data = arg.split('=') arg_entry, *arg_data = arg.split('=')
arg_data = '='.join(arg_data)
filesystem_args_list.append(arg_entry) filesystem_args_list.append(arg_entry)
filesystem_args_list.append(arg_data) filesystem_args_list.append(arg_data)
filesystem_args = ' '.join(filesystem_args_list) filesystem_args = ' '.join(filesystem_args_list)
print("Creating {} filesystem on {}".format(volume['filesystem'], dst_volume))
print("Args: {}".format(filesystem_args))
# Map the RBD device # Map the RBD device
retcode, retmsg = pvc_ceph.map_volume(zkhandler, volume['pool'], dst_volume_name) retcode, retmsg = pvc_ceph.map_volume(zkhandler, volume['pool'], dst_volume_name)
if not retcode: if not retcode:
@ -1534,6 +1536,8 @@ def create_vm(self, vm_name, vm_profile, define_vm=True, start_vm=True, script_r
if retcode: if retcode:
raise ProvisioningError('Failed to create {} filesystem on "{}": {}'.format(volume['filesystem'], dst_volume, stderr)) raise ProvisioningError('Failed to create {} filesystem on "{}": {}'.format(volume['filesystem'], dst_volume, stderr))
print(stdout)
if is_script_install: if is_script_install:
# Create temporary directory # Create temporary directory
retcode, stdout, stderr = pvc_common.run_os_command("mktemp -d") retcode, stdout, stderr = pvc_common.run_os_command("mktemp -d")