Revision f5118ade lib/backend.py

b/lib/backend.py
2437 2437
  return (not failure, (alldone, min_resync))
2438 2438

  
2439 2439

  
2440
def PowercycleNode(hypervisor_type):
2441
  """Hard-powercycle the node.
2442

  
2443
  Because we need to return first, and schedule the powercycle in the
2444
  background, we won't be able to report failures nicely.
2445

  
2446
  """
2447
  hyper = hypervisor.GetHypervisor(hypervisor_type)
2448
  try:
2449
    pid = os.fork()
2450
  except OSError, err:
2451
    # if we can't fork, we'll pretend that we're in the child process
2452
    pid = 0
2453
  if pid > 0:
2454
    return (True, "Reboot scheduled in 5 seconds")
2455
  time.sleep(5)
2456
  hyper.PowercycleNode()
2457

  
2458

  
2440 2459
class HooksRunner(object):
2441 2460
  """Hook runner.
2442 2461

  

Also available in: Unified diff