WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] acm: check for duplicate labels and types

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] acm: check for duplicate labels and types
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 10 Jun 2008 03:40:15 -0700
Delivery-date: Tue, 10 Jun 2008 03:40:20 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1213000676 -3600
# Node ID 1de5d17497fd0518c153ec37123fc3f9cce6332f
# Parent  4eba2151d38b2071629de86beaf43593bdd5160b
acm: check for duplicate labels and types
Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxx>
---
 tools/python/xen/util/acmpolicy.py   |    7 +++++++
 tools/python/xen/util/xsconstants.py |    6 ++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff -r 4eba2151d38b -r 1de5d17497fd tools/python/xen/util/acmpolicy.py
--- a/tools/python/xen/util/acmpolicy.py        Mon Jun 09 09:37:22 2008 +0100
+++ b/tools/python/xen/util/acmpolicy.py        Mon Jun 09 09:37:56 2008 +0100
@@ -1323,6 +1323,13 @@ class ACMPolicy(XSPolicy):
         if ACM_LABEL_UNLABELED in resnames:
             resnames.remove(ACM_LABEL_UNLABELED)
 
+        # check for duplicate labels
+        if len(vmlabels) != len(set(vmlabels)) or \
+           len(resnames) != len(set(resnames)) or \
+           len(stes)     != len(set(stes))     or \
+           len(chws)     != len(set(chws)):
+            return -xsconstants.XSERR_POLICY_HAS_DUPLICATES, "", ""
+
         max_chw_ssids = 1 + len(vms_with_chws)
         max_chw_types = 1 + len(vms_with_chws)
         max_ste_ssids = 1 + len(vms_with_stes) + len(resnames)
diff -r 4eba2151d38b -r 1de5d17497fd tools/python/xen/util/xsconstants.py
--- a/tools/python/xen/util/xsconstants.py      Mon Jun 09 09:37:22 2008 +0100
+++ b/tools/python/xen/util/xsconstants.py      Mon Jun 09 09:37:56 2008 +0100
@@ -59,7 +59,8 @@ XSERR_BOOTPOLICY_INSTALL_ERROR = 25 + XS
 XSERR_BOOTPOLICY_INSTALL_ERROR = 25 + XSERR_BASE
 XSERR_VM_NOT_AUTHORIZED        = 26 + XSERR_BASE
 XSERR_VM_IN_CONFLICT           = 27 + XSERR_BASE
-XSERR_LAST                     = 27 + XSERR_BASE ## KEEP LAST
+XSERR_POLICY_HAS_DUPLICATES    = 28 + XSERR_BASE
+XSERR_LAST                     = 28 + XSERR_BASE ## KEEP LAST
 
 XSERR_MESSAGES = [
     '',
@@ -89,7 +90,8 @@ XSERR_MESSAGES = [
     'Operation failed in hypervisor',
     'Boot policy installation error',
     'VM is not authorized to run',
-    'VM label conflicts with another VM'
+    'VM label conflicts with another VM',
+    'Duplicate labels or types in policy'
 ]
 
 def xserr2string(err):

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] acm: check for duplicate labels and types, Xen patchbot-unstable <=