Commit 7e1394dc authored by Alexander Schreiber's avatar Alexander Schreiber
Browse files

Infrastructure for detailed instance restarts, part one

The beginning of the infrastructure for detailed instance restarts. Does
not affect behaviour if code yet.

Reviewed-by: iustinp
parent 59072e7e
...@@ -73,6 +73,10 @@ class BaseHypervisor(object): ...@@ -73,6 +73,10 @@ class BaseHypervisor(object):
"""Stop an instance.""" """Stop an instance."""
raise NotImplementedError raise NotImplementedError
def RebootInstance(self, instance):
"""Reboot an instance."""
raise NotImplementedError
def ListInstances(self): def ListInstances(self):
"""Get the list of running instances.""" """Get the list of running instances."""
raise NotImplementedError raise NotImplementedError
...@@ -277,6 +281,14 @@ class XenHypervisor(BaseHypervisor): ...@@ -277,6 +281,14 @@ class XenHypervisor(BaseHypervisor):
raise HypervisorError("Failed to stop instance %s: %s" % raise HypervisorError("Failed to stop instance %s: %s" %
(instance.name, result.fail_reason)) (instance.name, result.fail_reason))
def RebootInstance(self, instance):
"""Reboot an instance."""
result = utils.RunCmd(["xm", "reboot", instance.name])
if result.failed:
raise HypervisorError("Failed to reboot instance %s: %s" %
(instance.name, result.fail_reason))
def GetNodeInfo(self): def GetNodeInfo(self):
"""Return information about the node. """Return information about the node.
...@@ -438,6 +450,14 @@ class FakeHypervisor(BaseHypervisor): ...@@ -438,6 +450,14 @@ class FakeHypervisor(BaseHypervisor):
(instance.name, "not running")) (instance.name, "not running"))
utils.RemoveFile(file_name) utils.RemoveFile(file_name)
def RebootInstance(self, instance):
"""Reboot an instance.
For the fake hypervisor, this does nothing.
"""
return
def GetNodeInfo(self): def GetNodeInfo(self):
"""Return information about the node. """Return information about the node.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment