Revision b262a5c6 lib/backend.py

b/lib/backend.py
1934 1934
  except Exception, err:  # pylint: disable=W0703
1935 1935
    _Fail("Failed to get migration status: %s", err, exc=True)
1936 1936

  
1937
def HotplugDevice(instance, action, dev_type, device, extra, seq):
1938
  """Hotplug a device
1939

  
1940
  Hotplug is currently supported only for KVM Hypervisor.
1941
  @type instance: L{objects.Instance}
1942
  @param instance: the instance to which we hotplug a device
1943
  @type action: string
1944
  @param action: the hotplug action to perform
1945
  @type dev_type: string
1946
  @param dev_type: the device type to hotplug
1947
  @type device: either L{objects.NIC} or L{objects.Disk}
1948
  @param device: the device object to hotplug
1949
  @type extra: string
1950
  @param extra: extra info used by hotplug code (e.g. disk link)
1951
  @type seq: int
1952
  @param seq: the index of the device from master perspective
1953
  @raise RPCFail: in case instance does not have KVM hypervisor
1954

  
1955
  """
1956
  hyper = hypervisor.GetHypervisor(instance.hypervisor)
1957
  try:
1958
    getattr(hyper, "HotplugDevice")
1959
  except NameError:
1960
    _Fail("Hotplug is not supported for %s hypervisor",
1961
          instance.hypervisor, exc=True )
1962
  return hyper.HotplugDevice(instance, action, dev_type, device, extra, seq)
1937 1963

  
1938 1964
def BlockdevCreate(disk, size, owner, on_primary, info, excl_stor):
1939 1965
  """Creates a block device for an instance.

Also available in: Unified diff