X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/f2ffd244aed2749f719b2c1811dd715be9ae6a26..c8fcde472922e4ee664d904e0bf1a583f1d5040d:/daemons/ganeti-noded diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded index 0337dca..c29db72 100755 --- a/daemons/ganeti-noded +++ b/daemons/ganeti-noded @@ -365,7 +365,8 @@ class NodeHttpServer(http.server.HttpServer): """ inst_s = params[0] inst = objects.Instance.FromDict(inst_s) - return backend.InstanceOsAdd(inst) + reinstall = params[1] + return backend.InstanceOsAdd(inst, reinstall) @staticmethod def perspective_instance_run_rename(params): @@ -392,7 +393,7 @@ class NodeHttpServer(http.server.HttpServer): """ instance = objects.Instance.FromDict(params[0]) - return backend.ShutdownInstance(instance) + return backend.InstanceShutdown(instance) @staticmethod def perspective_instance_start(params): @@ -400,8 +401,7 @@ class NodeHttpServer(http.server.HttpServer): """ instance = objects.Instance.FromDict(params[0]) - extra_args = params[1] - return backend.StartInstance(instance, extra_args) + return backend.StartInstance(instance) @staticmethod def perspective_migration_info(params): @@ -445,8 +445,7 @@ class NodeHttpServer(http.server.HttpServer): """ instance = objects.Instance.FromDict(params[0]) reboot_type = params[1] - extra_args = params[2] - return backend.RebootInstance(instance, reboot_type, extra_args) + return backend.InstanceReboot(instance, reboot_type) @staticmethod def perspective_instance_info(params): @@ -553,6 +552,15 @@ class NodeHttpServer(http.server.HttpServer): return backend.DemoteFromMC() + @staticmethod + def perspective_node_powercycle(params): + """Tries to powercycle the nod. + + """ + hypervisor_type = params[0] + return backend.PowercycleNode(hypervisor_type) + + # cluster -------------------------- @staticmethod @@ -723,7 +731,7 @@ def ParseOptions(): """ parser = OptionParser(description="Ganeti node daemon", - usage="%prog [-f] [-d]", + usage="%prog [-f] [-d] [-b ADDRESS]", version="%%prog (ganeti) %s" % constants.RELEASE_VERSION) @@ -733,35 +741,14 @@ def ParseOptions(): parser.add_option("-d", "--debug", dest="debug", help="Enable some debug messages", default=False, action="store_true") + parser.add_option("-b", "--bind", dest="bind_address", + help="Bind address", + default="", metavar="ADDRESS") + options, args = parser.parse_args() return options, args -def EnsureRuntimeEnvironment(): - """Ensure our run-time environment is complete. - - Currently this creates directories which could be missing, either - due to directories being on a tmpfs mount, or due to incomplete - packaging. - - """ - dirs = [(val, constants.RUN_DIRS_MODE) for val in constants.SUB_RUN_DIRS] - dirs.append((constants.LOG_OS_DIR, 0750)) - dirs.append((constants.LOCK_DIR, 1777)) - for dir_name, dir_mode in dirs: - if not os.path.exists(dir_name): - try: - os.mkdir(dir_name, dir_mode) - except EnvironmentError, err: - if err.errno != errno.EEXIST: - print ("Node setup wrong, cannot create directory '%s': %s" % - (dir_name, err)) - sys.exit(5) - if not os.path.isdir(dir_name): - print ("Node setup wrong, '%s' is not a directory" % dir_name) - sys.exit(5) - - def main(): """Main function for the node daemon. @@ -785,7 +772,10 @@ def main(): print "Cluster configuration incomplete: '%s'" % str(err) sys.exit(5) - EnsureRuntimeEnvironment() + dirs = [(val, constants.RUN_DIRS_MODE) for val in constants.SUB_RUN_DIRS] + dirs.append((constants.LOG_OS_DIR, 0750)) + dirs.append((constants.LOCK_DIR, 1777)) + utils.EnsureDirs(dirs) # become a daemon if options.fork: @@ -805,7 +795,7 @@ def main(): queue_lock = jstore.InitAndVerifyQueue(must_lock=False) mainloop = daemon.Mainloop() - server = NodeHttpServer(mainloop, "", port, + server = NodeHttpServer(mainloop, options.bind_address, port, ssl_params=ssl_params, ssl_verify_peer=True) server.Start() try: