commit dfc44e5c2be6fcfc502307435989982501e250a2
Merge: 621c507 dc3d810
Author: Klaus Aehlig <[email protected]>
Date:   Wed Oct 8 14:15:56 2014 +0200

    Merge branch 'stable-2.12' into master
    
    * stable-2.9
      Ganeti.Daemon: always install SIGHUP handler
    
    * stable-2.10
      ganeti.daemon: fix daemon mode with GnuTLS >= 3.3
      Fix DRBD version check for non VM capable nodes
      Fix invalid message from gnt-os
      Renaming NV_VMNODES to NV_NONVMNODES
      Node names in NV_VMNODES
    
    * stable-2.11
      Remove misleading cleanup
      systemd: start kvmd by default
      Fix failing BGL whitelist test
      Remove BGL from LUInstanceRename
      Factor out instance existence checks
      Allow coexistence of adding and acquiring locks
      Allow _LockList to handle locking.ALL_SET
    
    Conflicts:
        lib/cmdlib/instance.py
        lib/cmdlib/instance_utils.py
        lib/mcpu.py
        test/py/ganeti.mcpu_unittest.py
    
    Resolution:
        test/py/ganeti.mcpu_unittest.py and
        lib/cmdlib/instance_utils.py trivial;
        rest: take master (the only changes in
        the lower branches to those files
        where cherry-picks).
    
    Signed-off-by: Klaus Aehlig <[email protected]>

diff --cc lib/cmdlib/instance_utils.py
index 175b53e,2ffdb7a..eec2e0a
--- a/lib/cmdlib/instance_utils.py
+++ b/lib/cmdlib/instance_utils.py
@@@ -653,113 -639,6 +653,112 @@@ def CheckCompressionTool(lu, compressio
      )
  
  
 +def BuildDiskLogicalIDEnv(idx, disk):
 +  """Helper method to create hooks env related to disk's logical_id
 +
 +  @type idx: integer
 +  @param idx: The index of the disk
 +  @type disk: L{objects.Disk}
 +  @param disk: The disk object
 +
 +  """
 +  if disk.dev_type == constants.DT_PLAIN:
 +    vg, name = disk.logical_id
 +    ret = {
 +      "INSTANCE_DISK%d_VG" % idx: vg,
 +      "INSTANCE_DISK%d_ID" % idx: name
 +      }
 +  elif disk.dev_type in (constants.DT_FILE, constants.DT_SHARED_FILE):
 +    file_driver, name = disk.logical_id
 +    ret = {
 +      "INSTANCE_DISK%d_DRIVER" % idx: file_driver,
 +      "INSTANCE_DISK%d_ID" % idx: name
 +      }
 +  elif disk.dev_type == constants.DT_BLOCK:
 +    block_driver, adopt = disk.logical_id
 +    ret = {
 +      "INSTANCE_DISK%d_DRIVER" % idx: block_driver,
 +      "INSTANCE_DISK%d_ID" % idx: adopt
 +      }
 +  elif disk.dev_type == constants.DT_RBD:
 +    rbd, name = disk.logical_id
 +    ret = {
 +      "INSTANCE_DISK%d_DRIVER" % idx: rbd,
 +      "INSTANCE_DISK%d_ID" % idx: name
 +      }
 +  elif disk.dev_type == constants.DT_EXT:
 +    provider, name = disk.logical_id
 +    ret = {
 +      "INSTANCE_DISK%d_PROVIDER" % idx: provider,
 +      "INSTANCE_DISK%d_ID" % idx: name
 +      }
 +  elif disk.dev_type == constants.DT_DRBD8:
 +    pnode, snode, port, pmin, smin, _ = disk.logical_id
 +    data, meta = disk.children
 +    data_vg, data_name = data.logical_id
 +    meta_vg, meta_name = meta.logical_id
 +    ret = {
 +      "INSTANCE_DISK%d_PNODE" % idx: pnode,
 +      "INSTANCE_DISK%d_SNODE" % idx: snode,
 +      "INSTANCE_DISK%d_PORT" % idx: port,
 +      "INSTANCE_DISK%d_PMINOR" % idx: pmin,
 +      "INSTANCE_DISK%d_SMINOR" % idx: smin,
 +      "INSTANCE_DISK%d_DATA_VG" % idx: data_vg,
 +      "INSTANCE_DISK%d_DATA_ID" % idx: data_name,
 +      "INSTANCE_DISK%d_META_VG" % idx: meta_vg,
 +      "INSTANCE_DISK%d_META_ID" % idx: meta_name,
 +      }
 +  elif disk.dev_type == constants.DT_GLUSTER:
 +    file_driver, name = disk.logical_id
 +    ret = {
 +      "INSTANCE_DISK%d_DRIVER" % idx: file_driver,
 +      "INSTANCE_DISK%d_ID" % idx: name
 +      }
 +  elif disk.dev_type == constants.DT_DISKLESS:
 +    ret = {}
 +  else:
 +    ret = {}
 +
 +  ret.update({
 +    "INSTANCE_DISK%d_DEV_TYPE" % idx: disk.dev_type
 +    })
 +
 +  return ret
 +
 +
 +def BuildDiskEnv(idx, disk):
 +  """Helper method to create disk's hooks env
 +
 +  @type idx: integer
 +  @param idx: The index of the disk
 +  @type disk: L{objects.Disk} or dict
 +  @param disk: The disk object or a simple dict in case of LUInstanceCreate
 +
 +  """
 +  ret = {}
 +  # In case of LUInstanceCreate this runs in CheckPrereq where lu.disks
 +  # is a list of dicts i.e the result of ComputeDisks
 +  if isinstance(disk, dict):
 +    uuid = disk.get("uuid", "")
 +    name = disk.get(constants.IDISK_NAME, "")
 +    size = disk.get(constants.IDISK_SIZE, "")
 +    mode = disk.get(constants.IDISK_MODE, "")
 +  elif isinstance(disk, objects.Disk):
 +    uuid = disk.uuid
 +    name = disk.name
 +    size = disk.size
 +    mode = disk.mode
 +    ret.update(BuildDiskLogicalIDEnv(idx, disk))
 +
 +  # only name is optional here
 +  if name:
 +    ret["INSTANCE_DISK%d_NAME" % idx] = name
 +  ret["INSTANCE_DISK%d_UUID" % idx] = uuid
 +  ret["INSTANCE_DISK%d_SIZE" % idx] = size
 +  ret["INSTANCE_DISK%d_MODE" % idx] = mode
 +
 +  return ret
 +
- 
  def CheckInstanceExistence(lu, instance_name):
    """Raises an error if an instance with the given name exists already.
  
diff --cc src/Ganeti/Constants.hs
index 2ea0cbb,2ced23b..58817d5
--- a/src/Ganeti/Constants.hs
+++ b/src/Ganeti/Constants.hs
@@@ -3256,12 -3160,9 +3256,12 @@@ nvVersion = "version
  nvVglist :: String
  nvVglist = "vglist"
  
- nvVmnodes :: String
- nvVmnodes = "vmnodes"
+ nvNonvmnodes :: String
+ nvNonvmnodes = "nonvmnodes"
  
 +nvSshSetup :: String
 +nvSshSetup = "ssh-setup"
 +
  -- * Instance status
  
  inststAdmindown :: String

-- 
Klaus Aehlig
Google Germany GmbH, Dienerstr. 12, 80331 Muenchen
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschaeftsfuehrer: Graham Law, Christine Elizabeth Flores

Reply via email to