コード例 #1
0
ファイル: burnin.py プロジェクト: badp/ganeti
 def BurnReinstall(self):
     """Reinstall the instances."""
     Log("Reinstalling instances")
     for instance in self.instances:
         Log("instance %s", instance, indent=1)
         op1 = self.StopInstanceOp(instance)
         op2 = opcodes.OpInstanceReinstall(instance_name=instance)
         Log("reinstall without passing the OS", indent=2)
         op3 = opcodes.OpInstanceReinstall(instance_name=instance,
                                           os_type=self.opts.os)
         Log("reinstall specifying the OS", indent=2)
         op4 = self.StartInstanceOp(instance)
         self.ExecOrQueue(instance, [op1, op2, op3, op4])
コード例 #2
0
ファイル: rlib2.py プロジェクト: kawamuray/ganeti
def _ParseInstanceReinstallRequest(name, data):
    """Parses a request for reinstalling an instance.

  """
    if not isinstance(data, dict):
        raise http.HttpBadRequest("Invalid body contents, not a dictionary")

    ostype = baserlib.CheckParameter(data, "os", default=None)
    start = baserlib.CheckParameter(data, "start", exptype=bool, default=True)
    osparams = baserlib.CheckParameter(data, "osparams", default=None)

    ops = [
        opcodes.OpInstanceShutdown(instance_name=name),
        opcodes.OpInstanceReinstall(instance_name=name,
                                    os_type=ostype,
                                    osparams=osparams),
    ]

    if start:
        ops.append(opcodes.OpInstanceStartup(instance_name=name, force=False))

    return ops