From dffdfe29258d8abca24e48212145e5e93655e849 Mon Sep 17 00:00:00 2001 From: Julia Graham Date: Thu, 26 Sep 2024 12:30:35 -0400 Subject: [PATCH] fixed inspekt issues --- libvirt/tests/src/cpu/vcpu_max_topology.py | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/libvirt/tests/src/cpu/vcpu_max_topology.py b/libvirt/tests/src/cpu/vcpu_max_topology.py index e682252618..23191eb776 100644 --- a/libvirt/tests/src/cpu/vcpu_max_topology.py +++ b/libvirt/tests/src/cpu/vcpu_max_topology.py @@ -13,7 +13,7 @@ def run(test, params, env): """ - Test that the vm can start with vcpus which is equal to host online cpu number + Test that the vm can start with vcpus which is equal to host online cpu number and vm topology is consistent to those configured. Steps: @@ -46,7 +46,7 @@ def run(test, params, env): # cores = vcpus_num // number of clusters if sockets_param == "one": sockets_list = [1] - + # many_clusters case if clusters_param == "many": # Ensure that vcpus_num is evenly divisble by the number of clusters @@ -64,8 +64,8 @@ def run(test, params, env): # many_cores_per_socket # Ensure that vcpus_num is evenly divible by the number of cores else: - # many_clusters case - # sockets = vcpus_num // number of cores // number of clusters + # many_clusters case + # sockets = vcpus_num // number of cores // number of clusters if clusters_param == "many": # defaulting to either 2 or 3 cores cores = 2 if vcpus_num % 2 == 0 else 3 @@ -118,15 +118,15 @@ def set_and_check_topology(test, params, env, vcpus_num, sockets, cores, cluster if vm.is_alive(): vm.destroy() vmxml.placement = vcpus_placement - + if clusters > 1: # Set manually vmcpu_xml = vmxml["cpu"] vmcpu_xml["topology"] = { "sockets": str(sockets), "clusters": str(clusters), - "cores":str(cores), - "threads":"1"} + "cores": str(cores), + "threads": "1"} vmxml["cpu"] = vmcpu_xml vmxml["vcpu"] = vcpus_num vmxml.sync() @@ -134,15 +134,15 @@ def set_and_check_topology(test, params, env, vcpus_num, sockets, cores, cluster else: # Set using set_vm_vcpus helper function vmxml.set_vm_vcpus( - vm_name, - vcpus_num, - sockets=sockets, - cores=cores, + vm_name, + vcpus_num, + sockets=sockets, + cores=cores, threads=1, add_topology=True ) - logging.debug("Defined guest with '%s' vcpu(s), '%s' socket(s), and '%s' core(s), and '%s' cluster(s)", - str(vcpus_num), str(sockets), str(cores), str(clusters)) + logging.debug("Defined guest with '%s' vcpu(s), '%s' socket(s), and '%s' core(s), and '%s' cluster(s)", + str(vcpus_num), str(sockets), str(cores), str(clusters)) # Start guest agent in vm try: @@ -182,7 +182,7 @@ def set_and_check_topology(test, params, env, vcpus_num, sockets, cores, cluster ret_coreid = session.cmd_output(cmd_coreid).strip() if (str(vcpu) != ret_coreid): test.fail("In the vm kernel file, the coreid for vcpu %s should not be %s" % (vcpu, ret_coreid)) - + # Check vcpu cluster number cmd_clusterid = 'cat /sys/devices/system/cpu/cpu*/topology/cluster_id | sort | uniq -c | wc -l' @@ -200,7 +200,7 @@ def set_and_check_topology(test, params, env, vcpus_num, sockets, cores, cluster test.fail("In the vm kernel file, the cluster cpu list should be %s, not %s" % (str(sockets * clusters), ret_cluster_cpu_list)) session.close() - + finally: # Recover VM if vm.is_alive():