- logger.info("suspendSlices: %s" % exc)
-
-def suspendSlices(argv):
- """Freeze all site slices."""
- global api, auth
- if auth is None:
- printUsage("requires admin privs")
- sys.exit(1)
-
- if argv[0].find(".") <> -1: siteslices = slices([siteId(argv)])
- else: siteslices = slices(argv)
-
- for slice in siteslices:
- suspendSlice([slice])
-
-def __enableSlice(slice):
- logger.info("unfreezing slice %s" % slice['name'])
- slice_attributes = api.GetSliceAttributes(auth,slice['slice_attribute_ids'])
- for slice_attribute in slice_attributes:
- if slice_attribute['name'] == "enabled":
- api.DeleteSliceAttribute(auth, slice_attribute['slice_attribute_id'])
-
-def enableSlice(arg):
- """Enable suspended slice."""
- global api, auth
- if auth is None:
- printUsage("requires admin privs")
- sys.exit(1)
-
- slicename = arg[0]
- gSlices = {'name':slicename}
- slice = api.GetSlices(auth,gSlices)
- if len(slice) == 1:
- __enableSlice(slice[0])
- else:
- logger.info("slice %s not found" % slicename)
-
-def enableSlices(argv):
- """Enable suspended site slices."""
-
- global api, auth
- if auth is None:
- printUsage("requires admin privs")
- sys.exit(1)
-
- if argv[0].find(".") <> -1:
- slices = api.GetSlices(auth,[siteId(argv)])
- else:
- gSlices = {'name':"%s_*"%argv[0]}
- slices = api.GetSlices(auth,gSlices)
-
- for slice in slices:
- __enableSlice(slice)
-
-def setSliceMax(argv):
- """Set max_slices for Slice. Returns previous max_slices"""
- global api, auth
- if auth is None:
- printUsage("requires admin privs")
- sys.exit(1)
-
- name = argv[0]
- val = int(argv[1])
- if name.find(".") <> -1:
- site_ids = api.GetNodes(auth, [name], ['site_id'])
- if len(site_ids) == 1:
- site_id = [site_ids[0]['site_id']]
- loginbase = api.GetSites (auth, site_id, ["login_base"])
- else:
- printUsage("invalid hostname %s" % name)
- sys.exit(1)
+ logger.info("removeSliceCreation: %s" % exc)
+
+'''
+QED
+'''
+def enableSliceCreation(nodename, maxslices):
+ api = xmlrpclib.Server(XMLRPC_SERVER, verbose=False)
+ anon = {'AuthMethod': "anonymous"}
+ siteid = api.AnonAdmQuerySite (anon, {"node_hostname": nodename})
+ if len(siteid) == 1:
+ logger.info("Enabling slice creation for site %s" % siteId(nodename))
+ try:
+ if not config.debug:
+ api.AdmUpdateSite(auth.auth, siteid[0], {"max_slices" : maxslices})
+ except Exception, exc:
+ logger.info("API: %s" % exc)