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
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/b58123e0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/b58123e0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/b58123e0
Branch: refs/heads/4.0
Commit: b58123e075a69e923483b3f9ee51a1fe9cb19350
Parents: 9214fa0
Author: Anthony Xu <[email protected]>
Authored: Fri Sep 7 17:25:41 2012 -0700
Committer: Anthony Xu <[email protected]>
Committed: Fri Sep 7 17:25:41 2012 -0700
----------------------------------------------------------------------
scripts/vm/hypervisor/xenserver/vmops | 16 ++++++----------
1 files changed, 6 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b58123e0/scripts/vm/hypervisor/xenserver/vmops
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/vmops
b/scripts/vm/hypervisor/xenserver/vmops
index 79b67e7..05a2ccf 100755
--- a/scripts/vm/hypervisor/xenserver/vmops
+++ b/scripts/vm/hypervisor/xenserver/vmops
@@ -1087,17 +1087,13 @@ def cleanup_rules(session, args):
cleaned = 0
cleanup = []
for chain in vmchains:
- vm = session.xenapi.VM.get_by_name_label(chain)
- if len(vm) != 1:
- vm = session.xenapi.VM.get_by_name_label(chain + "-untagged")
- if len(vm) != 1:
- util.SMlog("chain " + chain + " does not correspond to a vm,
cleaning up")
+ vmname = chain
+ if vmname not in resident_vms:
+ vmname = chain + "-untagged"
+ if vmname not in resident_vms:
+ util.SMlog("vm " + chain + " is not running on this host,
cleaning up")
cleanup.append(chain)
- continue
- if chain not in resident_vms:
- util.SMlog("vm " + chain + " is not running, cleaning up")
- cleanup.append(chain)
-
+
for vm_name in cleanup:
destroy_network_rules_for_vm(session, {'vmName':vm_name})