diff --git a/client-common/vm.py b/client-common/vm.py index 52757d5c..35b3fcf7 100644 --- a/client-common/vm.py +++ b/client-common/vm.py @@ -167,7 +167,7 @@ def define_vm(zk_conn, config_data, target_node, node_limit, node_selector, node dom_name = parsed_xml.name.text # Ensure that the UUID and name are unique - if searchClusterByUUID(dom_uuid) or searchClusterByName(dom_name): + if searchClusterByUUID(zk_conn, dom_uuid) or searchClusterByName(zk_conn, dom_name): return False, 'ERROR: Specified VM "{}" or UUID "{}" matches an existing VM on the cluster'.format(dom_name, dom_uuid) if not target_node: diff --git a/client-provisioner/provisioner_lib/provisioner.py b/client-provisioner/provisioner_lib/provisioner.py index 93f286c8..07680fa5 100755 --- a/client-provisioner/provisioner_lib/provisioner.py +++ b/client-provisioner/provisioner_lib/provisioner.py @@ -1005,16 +1005,16 @@ def create_vm(self, vm_name, vm_profile): vm_memory=vm_data['system_details']['vram_mb'], vm_vcpus=vm_data['system_details']['vcpu_count'], vm_architecture=system_architecture - ) + ).strip() # Add default devices - vm_schema += libvirt_schema.devices_default + vm_schema += libvirt_schema.devices_default.strip() # Add serial device if vm_data['system_details']['serial']: vm_schema += libvirt_schema.devices_serial.format( vm_name=vm_name - ) + ).strip() # Add VNC device if vm_data['system_details']['vnc']: @@ -1030,10 +1030,10 @@ def create_vm(self, vm_name, vm_profile): vm_vncport=vm_vncport, vm_vnc_autoport=vm_vnc_autoport, vm_vnc_bind=vm_vnc_bind - ) + ).strip() # Add SCSI controller - vm_schema += libvirt_schema.devices_scsi_controller + vm_schema += libvirt_schema.devices_scsi_controller.strip() # Add disk devices monitor_list = list() @@ -1049,15 +1049,15 @@ def create_vm(self, vm_name, vm_profile): disk_pool=volume['pool'], vm_name=vm_name, disk_id=volume['disk_id'] - ) + ).strip() for monitor in monitor_list: vm_schema += libvirt_schema.devices_disk_coordinator.format( coordinator_name=monitor, coordinator_ceph_mon_port=config['ceph_monitor_port'] - ) - vm_schema += libvirt_schema.devices_disk_footer + ).strip() + vm_schema += libvirt_schema.devices_disk_footer.strip() - vm_schema += libvirt_schema.devices_vhostmd + vm_schema += libvirt_schema.devices_vhostmd.strip() # Add network devices network_id = 0 @@ -1093,11 +1093,11 @@ def create_vm(self, vm_name, vm_profile): vm_schema += libvirt_schema.devices_net_interface.format( eth_macaddr=eth_macaddr, eth_bridge=eth_bridge - ) + ).strip() network_id += 1 - vm_schema += libvirt_schema.libvirt_footer + vm_schema += libvirt_schema.libvirt_footer.strip() print("Final VM schema:\n{}\n".format(vm_schema))