Return-Path: X-Original-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0893ADBE4 for ; Sat, 8 Sep 2012 00:25:07 +0000 (UTC) Received: (qmail 37053 invoked by uid 500); 8 Sep 2012 00:25:06 -0000 Delivered-To: apmail-incubator-cloudstack-commits-archive@incubator.apache.org Received: (qmail 37027 invoked by uid 500); 8 Sep 2012 00:25:06 -0000 Mailing-List: contact cloudstack-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cloudstack-dev@incubator.apache.org Delivered-To: mailing list cloudstack-commits@incubator.apache.org Received: (qmail 37020 invoked by uid 99); 8 Sep 2012 00:25:06 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Sep 2012 00:25:06 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id A38C628533; Sat, 8 Sep 2012 00:25:06 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: anthonyxu@apache.org To: cloudstack-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: git commit: 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 Message-Id: <20120908002506.A38C628533@tyr.zones.apache.org> Date: Sat, 8 Sep 2012 00:25:06 +0000 (UTC) Updated Branches: refs/heads/master 9214fa0af -> b58123e07 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/master Commit: b58123e075a69e923483b3f9ee51a1fe9cb19350 Parents: 9214fa0 Author: Anthony Xu Authored: Fri Sep 7 17:25:41 2012 -0700 Committer: Anthony Xu 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})