incubator-tashi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strou...@apache.org
Subject svn commit: r1375306 - /incubator/tashi/trunk/src/tashi/client/tashi-admin.py
Date Mon, 20 Aug 2012 23:20:00 GMT
Author: stroucki
Date: Mon Aug 20 23:20:00 2012
New Revision: 1375306

URL: http://svn.apache.org/viewvc?rev=1375306&view=rev
Log:
tashi-admin: Initial add of reservation function

Modified:
    incubator/tashi/trunk/src/tashi/client/tashi-admin.py

Modified: incubator/tashi/trunk/src/tashi/client/tashi-admin.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/client/tashi-admin.py?rev=1375306&r1=1375305&r2=1375306&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/client/tashi-admin.py (original)
+++ incubator/tashi/trunk/src/tashi/client/tashi-admin.py Mon Aug 20 23:20:00 2012
@@ -118,6 +118,24 @@ def delHost(args):
 	print rv
 	return 0
 
+def reservation(args):
+	global scriptname
+	parser = optparse.OptionParser()
+	parser.set_usage("%s reservation [options]" % scriptname)
+	parser.add_option("--host", help="Add or remove reservations from this host (mandatory)",
action="store", type="string", dest="hostname")
+	parser.add_option("--add", help="Add this user to the host reservation", action="store",
type="string", dest="username")
+	parser.add_option("--remove", help="Remove this user from the host reservation", action="store",
type="string", dest="username")
+	(options, arguments) = parser.parse_args(args)
+	if options.hostname is None:
+		print "A mandatory option is missing\n"
+		parser.print_help()
+		sys.exit(-1)
+
+	hostId = checkHid(options.hostname)
+	rv = remoteCommand("setReservation", hostId, username)
+	print rv
+	return 0
+
 def help(args):
 	global scriptname
 	print "Available commands:"
@@ -130,6 +148,7 @@ def help(args):
 description = (
 ('addHost', 'Adds a new host to Tashi'),
 ('delHost', 'Removes a host from Tashi'),
+('reservation', 'Define host reservations'),
 ('addUser', 'Adds a user to Tashi'),
 ('delUser', 'Removes a user from Tashi'),
 ('addNet', 'Adds a network to Tashi'),
@@ -144,6 +163,7 @@ cmdsdesc = (
 ("setHostNotes", "Annotates a host"),
 ("addHost", "Add a host to the cluster"),
 ("delHost", "Remove a host from the cluster"),
+('reservation', 'Define host reservations'),
 ("help", "Get list of available commands"),
 )
 
@@ -152,6 +172,7 @@ cmds = {
 'setHostNotes': setHostNotes,
 'addHost': addHost,
 'delHost': delHost,
+'reservation': reservation,
 'help': help,
 }
 



Mime
View raw message