Revision f92d9674
b/lib/cmdlib/instance_operation.py | ||
---|---|---|
433 | 433 |
@rtype: dict |
434 | 434 |
|
435 | 435 |
""" |
436 |
hyper = hypervisor.GetHypervisor(instance.hypervisor) |
|
436 |
hyper = hypervisor.GetHypervisorClass(instance.hypervisor)
|
|
437 | 437 |
# beparams and hvparams are passed separately, to avoid editing the |
438 | 438 |
# instance and then saving the defaults in the instance itself. |
439 | 439 |
hvparams = cluster.FillHV(instance) |
b/lib/hypervisor/hv_xen.py | ||
---|---|---|
343 | 343 |
|
344 | 344 |
self._cmd = _cmd |
345 | 345 |
|
346 |
@staticmethod |
|
347 |
def _GetCommandFromHvparams(hvparams): |
|
348 |
"""Returns the Xen command extracted from the given hvparams. |
|
349 |
|
|
350 |
@type hvparams: dict of strings |
|
351 |
@param hvparams: hypervisor parameters |
|
352 |
|
|
353 |
""" |
|
354 |
if hvparams is None or constants.HV_XEN_CMD not in hvparams: |
|
355 |
raise errors.HypervisorError("Cannot determine xen command.") |
|
356 |
else: |
|
357 |
return hvparams[constants.HV_XEN_CMD] |
|
358 |
|
|
346 | 359 |
def _GetCommand(self, hvparams): |
347 | 360 |
"""Returns Xen command to use. |
348 | 361 |
|
... | ... | |
351 | 364 |
|
352 | 365 |
""" |
353 | 366 |
if self._cmd is None: |
354 |
if hvparams is None or constants.HV_XEN_CMD not in hvparams: |
|
355 |
raise errors.HypervisorError("Cannot determine xen command.") |
|
356 |
else: |
|
357 |
cmd = hvparams[constants.HV_XEN_CMD] |
|
367 |
cmd = XenHypervisor._GetCommandFromHvparams(hvparams) |
|
358 | 368 |
else: |
359 | 369 |
cmd = self._cmd |
360 | 370 |
|
... | ... | |
692 | 702 |
instance_list = self._GetInstanceList(True, hvparams) |
693 | 703 |
return _GetNodeInfo(result.stdout, instance_list) |
694 | 704 |
|
695 |
def GetInstanceConsole(self, instance, primary_node, hvparams, beparams): |
|
705 |
@classmethod |
|
706 |
def GetInstanceConsole(cls, instance, primary_node, hvparams, beparams): |
|
696 | 707 |
"""Return a command for connecting to the console of an instance. |
697 | 708 |
|
698 | 709 |
""" |
699 |
xen_cmd = self._GetCommand(hvparams)
|
|
710 |
xen_cmd = XenHypervisor._GetCommandFromHvparams(hvparams)
|
|
700 | 711 |
return objects.InstanceConsole(instance=instance.name, |
701 | 712 |
kind=constants.CONS_SSH, |
702 | 713 |
host=primary_node.name, |
Also available in: Unified diff