From 368f972cc4b321783523fac4a2d415baec3e1843 Mon Sep 17 00:00:00 2001 From: Anthony Xu Date: Mon, 20 Aug 2012 18:09:27 -0700 Subject: [PATCH] CS-15921 : in 2.1 timeframe, -untagged string is appended to the end of instance name, in cleanup_rules function, we need to convert chain name to vm name correclty --- scripts/vm/hypervisor/xenserver/vmops | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/scripts/vm/hypervisor/xenserver/vmops b/scripts/vm/hypervisor/xenserver/vmops index 25916fef042..bf245f0c5d2 100755 --- a/scripts/vm/hypervisor/xenserver/vmops +++ b/scripts/vm/hypervisor/xenserver/vmops @@ -1053,17 +1053,11 @@ def cleanup_rules(session, args): cleanup = [] for chain in vmchains: vmname = chain - vm = session.xenapi.VM.get_by_name_label(vmname) - if len(vm) != 1: - vmname = chain + "-untagged" - vm = session.xenapi.VM.get_by_name_label(vmname) - if len(vm) != 1: - util.SMlog("chain " + chain + " does not correspond to a vm, cleaning up") - cleanup.append(vmname) - continue if vmname not in resident_vms: - util.SMlog("vm " + vmname + " is not running on this host, cleaning up") - cleanup.append(vmname) + vmname = chain + "-untagged" + if vmname not in resident_vms: + util.SMlog("vm " + chain + " is not running on this host, cleaning up") + cleanup.append(chain) for vm_name in cleanup: destroy_network_rules_for_vm(session, {'vmName':vm_name})