"""
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):
"""
instance = objects.Instance.FromDict(params[0])
- return backend.ShutdownInstance(instance)
+ return backend.InstanceShutdown(instance)
@staticmethod
def perspective_instance_start(params):
"""
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):
"""
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):
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
"""
parser = OptionParser(description="Ganeti node daemon",
- usage="%prog [-f] [-d]",
+ usage="%prog [-f] [-d] [-b ADDRESS]",
version="%%prog (ganeti) %s" %
constants.RELEASE_VERSION)
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.
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:
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: