From tashi-commits-return-283-apmail-incubator-tashi-commits-archive=incubator.apache.org@incubator.apache.org Fri Oct 21 19:09:49 2011 Return-Path: X-Original-To: apmail-incubator-tashi-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-tashi-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 68A399C82 for ; Fri, 21 Oct 2011 19:09:49 +0000 (UTC) Received: (qmail 15182 invoked by uid 500); 21 Oct 2011 19:09:49 -0000 Delivered-To: apmail-incubator-tashi-commits-archive@incubator.apache.org Received: (qmail 15155 invoked by uid 500); 21 Oct 2011 19:09:49 -0000 Mailing-List: contact tashi-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: tashi-dev@incubator.apache.org Delivered-To: mailing list tashi-commits@incubator.apache.org Received: (qmail 15147 invoked by uid 99); 21 Oct 2011 19:09:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Oct 2011 19:09:48 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_FRT_STOCK2 X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Oct 2011 19:09:44 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 2A18223889DA; Fri, 21 Oct 2011 19:09:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1187510 - in /incubator/tashi/branches/cmu: ./ etc/ src/tashi/agents/ src/tashi/client/ src/tashi/clustermanager/ src/tashi/nodemanager/ src/tashi/nodemanager/vmcontrol/ Date: Fri, 21 Oct 2011 19:09:22 -0000 To: tashi-commits@incubator.apache.org From: stroucki@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111021190923.2A18223889DA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: stroucki Date: Fri Oct 21 19:09:22 2011 New Revision: 1187510 URL: http://svn.apache.org/viewvc?rev=1187510&view=rev Log: branch cmu tree off of r1177661 (before move to 3.1 rpyc) Added: incubator/tashi/branches/cmu/ - copied from r1178105, incubator/tashi/trunk/ incubator/tashi/branches/cmu/etc/TashiDefaults.cfg - copied unchanged from r1178110, incubator/tashi/trunk/etc/TashiDefaults.cfg incubator/tashi/branches/cmu/src/tashi/agents/primitive.py - copied, changed from r1182062, incubator/tashi/trunk/src/tashi/agents/primitive.py incubator/tashi/branches/cmu/src/tashi/client/tashi-client.py - copied, changed from r1179498, incubator/tashi/trunk/src/tashi/client/tashi-client.py incubator/tashi/branches/cmu/src/tashi/nodemanager/vmcontrol/qemu.py - copied, changed from r1178110, incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py Removed: incubator/tashi/branches/cmu/src/tashi/agents/primitive_zoni.py incubator/tashi/branches/cmu/src/tashi/client/tashi-client-hack.py Modified: incubator/tashi/branches/cmu/src/tashi/agents/dhcpdns.py incubator/tashi/branches/cmu/src/tashi/agents/locality-server.py incubator/tashi/branches/cmu/src/tashi/clustermanager/clustermanager.py incubator/tashi/branches/cmu/src/tashi/nodemanager/nodemanager.py Modified: incubator/tashi/branches/cmu/src/tashi/agents/dhcpdns.py URL: http://svn.apache.org/viewvc/incubator/tashi/branches/cmu/src/tashi/agents/dhcpdns.py?rev=1187510&r1=1178105&r2=1187510&view=diff ============================================================================== --- incubator/tashi/branches/cmu/src/tashi/agents/dhcpdns.py (original) +++ incubator/tashi/branches/cmu/src/tashi/agents/dhcpdns.py Fri Oct 21 19:09:22 2011 @@ -28,8 +28,7 @@ from tashi import boolean class DhcpDns(InstanceHook): def __init__(self, config, client, post=False): InstanceHook.__init__(self, config, client, post) - self.dnsKeyName = self.config.get('DhcpDns', 'dnsKeyName') - self.dnsSecretKey = self.config.get('DhcpDns', 'dnsSecretKey') + self.dnsKeyFile = self.config.get('DhcpDns', 'dnsKeyFile') self.dnsServer = self.config.get('DhcpDns', 'dnsServer') self.dnsDomain = self.config.get('DhcpDns', 'dnsDomain') self.dnsExpire = int(self.config.get('DhcpDns', 'dnsExpire')) @@ -154,12 +153,14 @@ class DhcpDns(InstanceHook): self.removeDns(name) except: pass - cmd = "nsupdate" + if (self.dnsKeyFile != ""): + cmd = "nsupdate -k %s" % (self.dnsKeyFile) + else: + cmd = "nsupdate" child = subprocess.Popen(args=cmd.split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE) try: (stdin, stdout) = (child.stdin, child.stdout) stdin.write("server %s\n" % (self.dnsServer)) - stdin.write("key %s %s\n" % (self.dnsKeyName, self.dnsSecretKey)) stdin.write("update add %s.%s %d A %s\n" % (name, self.dnsDomain, self.dnsExpire, ip)) stdin.write("\n") if (self.reverseDns): @@ -180,12 +181,14 @@ class DhcpDns(InstanceHook): (pid, status) = os.waitpid(child.pid, os.WNOHANG) def removeDns(self, name): - cmd = "nsupdate" + if (self.dnsKeyFile != ""): + cmd = "nsupdate -k %s" % (self.dnsKeyFile) + else: + cmd = "nsupdate" child = subprocess.Popen(args=cmd.split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE) try: (stdin, stdout) = (child.stdin, child.stdout) stdin.write("server %s\n" % (self.dnsServer)) - stdin.write("key %s %s\n" % (self.dnsKeyName, self.dnsSecretKey)) if (self.reverseDns): ip = socket.gethostbyname(name) ipSegments = map(int, ip.split(".")) Modified: incubator/tashi/branches/cmu/src/tashi/agents/locality-server.py URL: http://svn.apache.org/viewvc/incubator/tashi/branches/cmu/src/tashi/agents/locality-server.py?rev=1187510&r1=1178105&r2=1187510&view=diff ============================================================================== --- incubator/tashi/branches/cmu/src/tashi/agents/locality-server.py (original) +++ incubator/tashi/branches/cmu/src/tashi/agents/locality-server.py Fri Oct 21 19:09:22 2011 @@ -1,4 +1,5 @@ #!/usr/bin/python + # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information Copied: incubator/tashi/branches/cmu/src/tashi/agents/primitive.py (from r1182062, incubator/tashi/trunk/src/tashi/agents/primitive.py) URL: http://svn.apache.org/viewvc/incubator/tashi/branches/cmu/src/tashi/agents/primitive.py?p2=incubator/tashi/branches/cmu/src/tashi/agents/primitive.py&p1=incubator/tashi/trunk/src/tashi/agents/primitive.py&r1=1182062&r2=1187510&rev=1187510&view=diff ============================================================================== --- incubator/tashi/trunk/src/tashi/agents/primitive.py (original) +++ incubator/tashi/branches/cmu/src/tashi/agents/primitive.py Fri Oct 21 19:09:22 2011 @@ -105,12 +105,6 @@ class Primitive(object): minMax = None minMaxHost = None minMaxCtr = None - - densePack = inst.hints.get("densePack", None) - if (densePack is None): - densePack = self.densePack - else: - densePack = boolean(densePack) targetHost = inst.hints.get("targetHost", None) try: @@ -119,7 +113,7 @@ class Primitive(object): allowElsewhere = False # has a host preference been expressed? if (targetHost != None): - for h in self.hosts.values(): + for h in hosts.values(): # if this is not the host we are looking for, continue if ((str(h.id) != targetHost and h.name != targetHost)): continue @@ -157,7 +151,7 @@ class Primitive(object): # minMax has not been modified or # the number of vms here is greater than minmax if we're dense packing or # the number of vms here is less than minmax if we're not dense packing - if (minMax is None or (densePack and len(self.load[h.id]) > minMax) or (not densePack and len(self.load[h.id]) < minMax)): + if (minMax is None or (self.densePack and len(self.load[h.id]) > minMax) or (not self.densePack and len(self.load[h.id]) < minMax)): if self.__checkCapacity(h, inst): minMax = len(self.load[h.id]) minMaxHost = h Copied: incubator/tashi/branches/cmu/src/tashi/client/tashi-client.py (from r1179498, incubator/tashi/trunk/src/tashi/client/tashi-client.py) URL: http://svn.apache.org/viewvc/incubator/tashi/branches/cmu/src/tashi/client/tashi-client.py?p2=incubator/tashi/branches/cmu/src/tashi/client/tashi-client.py&p1=incubator/tashi/trunk/src/tashi/client/tashi-client.py&r1=1179498&r2=1187510&rev=1187510&view=diff ============================================================================== --- incubator/tashi/trunk/src/tashi/client/tashi-client.py (original) +++ incubator/tashi/branches/cmu/src/tashi/client/tashi-client.py Fri Oct 21 19:09:22 2011 @@ -500,57 +500,30 @@ def main(): usage() function = matchFunction(sys.argv[1]) (config, configFiles) = getConfig(["Client"]) - - # build a structure of possible arguments - possibleArgs = {} - argList = argLists[function] - for i in range(0, len(argList)): - possibleArgs[argList[i][0]]=argList[i] - + possibleArgs = argLists[function] args = sys.argv[2:] - - vals = {} - + for arg in args: + if (arg == "--help" or arg == "--examples"): + usage(function) try: - # create client handle + vals = {} client = createClient(config) - - # set defaults - for parg in possibleArgs.values(): + for parg in possibleArgs: (parg, conv, default, required) = parg - if (required is False): - vals[parg] = default() - - while (len(args) > 0): - arg = args.pop(0) - - if (arg == "--help" or arg == "--examples"): - usage(function) - # this exits - + val = None + for i in range(0, len(args)): + arg = args[i] + if (arg.startswith("--") and arg[2:] == parg): + val = conv(args[i+1]) + if (val == None): + val = default() + vals[parg] = val + for arg in args: if (arg.startswith("--hide-")): show_hide.append((False, arg[7:])) - continue - if (arg.startswith("--show-")): show_hide.append((True, arg[7:])) - continue - - if (arg.startswith("--")): - if (arg[2:] in possibleArgs): - (parg, conv, default, required) = possibleArgs[arg[2:]] - val = conv(args.pop(0)) - if (val == None): - val = default() - - vals[parg] = val - continue - - raise ValueError("Unknown argument %s" % (arg)) - - f = getattr(client, function, None) - if (f is None): f = extraViews[function][0] if (function in convertArgs): Modified: incubator/tashi/branches/cmu/src/tashi/clustermanager/clustermanager.py URL: http://svn.apache.org/viewvc/incubator/tashi/branches/cmu/src/tashi/clustermanager/clustermanager.py?rev=1187510&r1=1178105&r2=1187510&view=diff ============================================================================== --- incubator/tashi/branches/cmu/src/tashi/clustermanager/clustermanager.py (original) +++ incubator/tashi/branches/cmu/src/tashi/clustermanager/clustermanager.py Fri Oct 21 19:09:22 2011 @@ -30,7 +30,7 @@ import tashi from tashi.rpycservices import rpycservices from rpyc.utils.server import ThreadedServer -from rpyc.utils.authenticators import TlsliteVdbAuthenticator +from rpyc.utils.authenticators import VdbAuthenticator def startClusterManager(config): global service, data @@ -47,7 +47,7 @@ def startClusterManager(config): users[user.name] = user.passwd users[config.get('AllowedUsers', 'nodeManagerUser')] = config.get('AllowedUsers', 'nodeManagerPassword') users[config.get('AllowedUsers', 'agentUser')] = config.get('AllowedUsers', 'agentPassword') - authenticator = TlsliteVdbAuthenticator.from_dict(users) + authenticator = VdbAuthenticator.from_dict(users) t = ThreadedServer(service=rpycservices.ManagerService, hostname='0.0.0.0', port=int(config.get('ClusterManagerService', 'port')), auto_register=False, authenticator=authenticator) else: t = ThreadedServer(service=rpycservices.ManagerService, hostname='0.0.0.0', port=int(config.get('ClusterManagerService', 'port')), auto_register=False) Modified: incubator/tashi/branches/cmu/src/tashi/nodemanager/nodemanager.py URL: http://svn.apache.org/viewvc/incubator/tashi/branches/cmu/src/tashi/nodemanager/nodemanager.py?rev=1187510&r1=1178105&r2=1187510&view=diff ============================================================================== --- incubator/tashi/branches/cmu/src/tashi/nodemanager/nodemanager.py (original) +++ incubator/tashi/branches/cmu/src/tashi/nodemanager/nodemanager.py Fri Oct 21 19:09:22 2011 @@ -28,7 +28,7 @@ from tashi import boolean from tashi.rpycservices import rpycservices from rpyc.utils.server import ThreadedServer -from rpyc.utils.authenticators import TlsliteVdbAuthenticator +from rpyc.utils.authenticators import VdbAuthenticator @signalHandler(signal.SIGTERM) def handleSIGTERM(signalNumber, stackFrame): @@ -51,7 +51,7 @@ def main(): if boolean(config.get("Security", "authAndEncrypt")): users = {} users[config.get('AllowedUsers', 'clusterManagerUser')] = config.get('AllowedUsers', 'clusterManagerPassword') - authenticator = TlsliteVdbAuthenticator.from_dict(users) + authenticator = VdbAuthenticator.from_dict(users) t = ThreadedServer(service=rpycservices.ManagerService, hostname='0.0.0.0', port=int(config.get('NodeManagerService', 'port')), auto_register=False, authenticator=authenticator) else: t = ThreadedServer(service=rpycservices.ManagerService, hostname='0.0.0.0', port=int(config.get('NodeManagerService', 'port')), auto_register=False) Copied: incubator/tashi/branches/cmu/src/tashi/nodemanager/vmcontrol/qemu.py (from r1178110, incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py) URL: http://svn.apache.org/viewvc/incubator/tashi/branches/cmu/src/tashi/nodemanager/vmcontrol/qemu.py?p2=incubator/tashi/branches/cmu/src/tashi/nodemanager/vmcontrol/qemu.py&p1=incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py&r1=1178110&r2=1187510&rev=1187510&view=diff ============================================================================== --- incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py (original) +++ incubator/tashi/branches/cmu/src/tashi/nodemanager/vmcontrol/qemu.py Fri Oct 21 19:09:22 2011 @@ -105,7 +105,6 @@ class Qemu(VmControlInterface): self.consolePortLock = threading.Lock() self.migrationSemaphore = threading.Semaphore(int(self.config.get("Qemu", "maxParallelMigrations"))) self.stats = {} - self.scratchVg = self.config.get("Qemu", "scratchVg") # XXXstroucki revise self.scratchDir = self.config.get("Qemu", "scratchDir") if len(self.scratchDir) == 0: @@ -179,15 +178,11 @@ class Qemu(VmControlInterface): f.write(i) f.close() #XXXstroucki remove scratch storage - try: - if self.scratchVg is not None: - scratch_name = child.instance.name - log.info("Removing scratch for " + scratch_name) - cmd = "/sbin/lvremove -f %s" % self.scratchVg - result = subprocess.Popen(cmd.split(), executable=cmd.split()[0], stdout=subprocess.PIPE).wait() - except: - pass - + scratch_name = child.instance.name + log.info("Removing scratch for " + scratch_name) + #cmd = "/sbin/lvremove -f vgscratch/lv" + scratch_name + cmd = "/sbin/lvremove -f vgscratch" + result = subprocess.Popen(cmd.split(), executable=cmd.split()[0], stdout=subprocess.PIPE).wait() try: if (not child.migratingOut): self.nm.vmStateChange(vmId, None, InstanceState.Exited) @@ -400,19 +395,17 @@ class Qemu(VmControlInterface): try: if scratchSize > 0: - if self.scratchVg is None: - raise Exception, "No scratch volume group defined" # create scratch disk # XXXstroucki: needs to be cleaned somewhere # XXXstroucki: clean user provided instance name scratch_name = "lv" + instance.name # XXXstroucki hold lock # XXXstroucki check for capacity - cmd = "/sbin/lvcreate -n" + scratch_name + " -L" + str(scratchSize) + "G " + self.scratchVg + cmd = "/sbin/lvcreate -n" + scratch_name + " -L" + str(scratchSize) + "G vgscratch" result = subprocess.Popen(cmd.split(), executable=cmd.split()[0], stdout=subprocess.PIPE).wait() index += 1 - thisDiskList = [ "file=/dev/%s/%s" % (self.scratchVg, scratch_name) ] + thisDiskList = [ "file=/dev/vgscratch/%s" % scratch_name ] thisDiskList.append("if=%s" % diskInterface) thisDiskList.append("index=%d" % index) thisDiskList.append("cache=off")