params = simplejson.loads(body)
result = method(params)
payload = simplejson.dumps(result)
+ except errors.QuitGanetiException, err:
+ global _EXIT_GANETI_NODED
+ _EXIT_GANETI_NODED = True
+ if isinstance(err, tuple) and len(err) == 2:
+ if err[0]:
+ self.send_error(500, "Error: %s" % str(err[1]))
+ else:
+ payload = simplejson.dumps(err[1])
+ else:
+ self.log_message('GanetiQuitException Usage Error')
+ self.send_error(500, "Error: %s" % str(err))
except Exception, err:
self.send_error(500, "Error: %s" % str(err))
return False
cfbd = objects.Disk.FromDict(params[0])
return backend.SnapshotBlockDevice(cfbd)
+ @staticmethod
+ def perspective_blockdev_grow(params):
+ """Grow a stack of devices.
+
+ """
+ cfbd = objects.Disk.FromDict(params[0])
+ amount = params[1]
+ return backend.GrowBlockDevice(cfbd, amount)
+
+ @staticmethod
+ def perspective_blockdev_close(params):
+ """Closes the given block devices.
+
+ """
+ disks = [objects.Disk.FromDict(cf) for cf in params]
+ return backend.CloseBlockDevices(disks)
+
# export/import --------------------------
@staticmethod
return backend.StartInstance(instance, extra_args)
@staticmethod
+ def perspective_instance_migrate(params):
+ """Migrates an instance.
+
+ """
+ instance, target, live = params
+ return backend.MigrateInstance(instance, target, live)
+
+ @staticmethod
def perspective_instance_reboot(params):
"""Reboot an instance.
if options.fork:
utils.Daemonize(logfile=constants.LOG_NODESERVER)
- logger.SetupLogging(twisted_workaround=True, debug=options.debug,
- program="ganeti-noded")
+ logger.SetupLogging(program="ganeti-noded", debug=options.debug)
+
+ global _EXIT_GANETI_NODED
+ _EXIT_GANETI_NODED = False
httpd = BaseHTTPServer.HTTPServer(('', port), ServerObject)
- httpd.serve_forever()
+ while (not _EXIT_GANETI_NODED):
+ httpd.handle_request()
if __name__ == '__main__':