commit cd3b4ff489598bfb1cd12617c22debd65b675bd4
Author: Helga Velroyen <helgav@google.com>
Date:   Tue Aug 27 15:38:58 2013 +0200

    Replace LD_* constants with DT_* constants
    
    LD_* constants are basically like DT_* constants, except
    for that both file and shared file were mapped to file.
    In order to not having to maintain three slightly different
    sets of disk-related constants (DT, LD and ST), we merge
    DT and LD here. This patch does the renaming of the
    various constants and then fixes the handling of shared
    file disks.
    
    Signed-off-by: Helga Velroyen <helgav@google.com>
    Reviewed-by: Guido Trotter <ultrotter@google.com>

diff --git a/doc/design-resource-model.rst b/doc/design-resource-model.rst
index a4d63c6..8131848 100644
--- a/doc/design-resource-model.rst
+++ b/doc/design-resource-model.rst
@@ -895,7 +895,7 @@ Beside the per-hypervisor attributes, we also have disk attributes,
 which are queried directly on the node (without hypervisor
 involvment). The are stored in a separate attribute (``disk_state``),
 which is indexed per storage type and name; currently this will be just
-``LD_LV`` and the volume name as key.
+``DT_PLAIN`` and the volume name as key.
 
 +-------------+-------------------------+--------------------+--------+
 |Name         |Description              |Current state       |Type    |
diff --git a/lib/backend.py b/lib/backend.py
index 6a38310..36db048 100644
--- a/lib/backend.py
+++ b/lib/backend.py
@@ -2845,9 +2845,9 @@ def OSEnvironment(instance, inst_os, debug=0):
     if constants.HV_DISK_TYPE in instance.hvparams:
       result["DISK_%d_FRONTEND_TYPE" % idx] = \
         instance.hvparams[constants.HV_DISK_TYPE]
-    if disk.dev_type in constants.LDS_BLOCK:
+    if disk.dev_type in constants.DTS_BLOCK:
       result["DISK_%d_BACKEND_TYPE" % idx] = "block"
-    elif disk.dev_type == constants.LD_FILE:
+    elif disk.dev_type in [constants.DT_FILE, constants.DT_SHARED_FILE]:
       result["DISK_%d_BACKEND_TYPE" % idx] = \
         "file:%s" % disk.physical_id[0]
 
@@ -2969,12 +2969,12 @@ def BlockdevSnapshot(disk):
   @return: snapshot disk ID as (vg, lv)
 
   """
-  if disk.dev_type == constants.LD_DRBD8:
+  if disk.dev_type == constants.DT_DRBD8:
     if not disk.children:
       _Fail("DRBD device '%s' without backing storage cannot be snapshotted",
             disk.unique_id)
     return BlockdevSnapshot(disk.children[0])
-  elif disk.dev_type == constants.LD_LV:
+  elif disk.dev_type == constants.DT_PLAIN:
     r_dev = _RecursiveFindBD(disk)
     if r_dev is not None:
       # FIXME: choose a saner value for the snapshot size
diff --git a/lib/client/gnt_instance.py b/lib/client/gnt_instance.py
index f52bc65..de8239f 100644
--- a/lib/client/gnt_instance.py
+++ b/lib/client/gnt_instance.py
@@ -919,7 +919,7 @@ def _FormatDiskDetails(dev_type, dev, roman):
   """Formats the logical_id of a disk.
 
   """
-  if dev_type == constants.LD_DRBD8:
+  if dev_type == constants.DT_DRBD8:
     drbd_info = dev["drbd_info"]
     data = [
       ("nodeA", "%s, minor=%s" %
@@ -933,7 +933,7 @@ def _FormatDiskDetails(dev_type, dev, roman):
       ("port", str(compat.TryToRoman(drbd_info["port"], convert=roman))),
       ("auth key", str(drbd_info["secret"])),
       ]
-  elif dev_type == constants.LD_LV:
+  elif dev_type == constants.DT_PLAIN:
     vg_name, lv_name = dev["logical_id"]
     data = ["%s/%s" % (vg_name, lv_name)]
   else:
@@ -968,7 +968,7 @@ def _FormatBlockDevInfo(idx, top_level, dev, roman):
     """Format one line for physical device status.
 
     @type dtype: str
-    @param dtype: a constant from the L{constants.LDS_BLOCK} set
+    @param dtype: a constant from the L{constants.DTS_BLOCK} set
     @type status: tuple
     @param status: a tuple as returned from L{backend.FindBlockDevice}
     @return: the string representing the status
@@ -989,7 +989,7 @@ def _FormatBlockDevInfo(idx, top_level, dev, roman):
       minor_string = str(compat.TryToRoman(minor, convert=roman))
 
     txt += ("%s (%s:%s)" % (path, major_string, minor_string))
-    if dtype in (constants.LD_DRBD8, ):
+    if dtype in (constants.DT_DRBD8, ):
       if syncp is not None:
         sync_text = "*RECOVERING* %5.2f%%," % syncp
         if estt:
@@ -1009,7 +1009,7 @@ def _FormatBlockDevInfo(idx, top_level, dev, roman):
       else:
         ldisk_text = ""
       txt += (" %s, status %s%s" % (sync_text, degr_text, ldisk_text))
-    elif dtype == constants.LD_LV:
+    elif dtype == constants.DT_PLAIN:
       if ldisk_status == constants.LDS_FAULTY:
         ldisk_text = " *FAILED* (failed drive?)"
       else:
diff --git a/lib/cmdlib/backup.py b/lib/cmdlib/backup.py
index 54f7d90..3014a21 100644
--- a/lib/cmdlib/backup.py
+++ b/lib/cmdlib/backup.py
@@ -341,7 +341,7 @@ class LUBackupExport(LogicalUnit):
     # instance disk type verification
     # TODO: Implement export support for file-based disks
     for disk in self.instance.disks:
-      if disk.dev_type == constants.LD_FILE:
+      if disk.dev_type in [constants.DT_FILE, constants.DT_SHARED_FILE]:
         raise errors.OpPrereqError("Export not supported for instances with"
                                    " file-based disks", errors.ECODE_INVAL)
 
diff --git a/lib/cmdlib/cluster.py b/lib/cmdlib/cluster.py
index 32e24de..b855f5a 100644
--- a/lib/cmdlib/cluster.py
+++ b/lib/cmdlib/cluster.py
@@ -495,7 +495,7 @@ class LUClusterRepairDiskSizes(NoHooksLU):
     @param disk: an L{ganeti.objects.Disk} object
 
     """
-    if disk.dev_type == constants.LD_DRBD8:
+    if disk.dev_type == constants.DT_DRBD8:
       assert disk.children, "Empty children for DRBD8?"
       fchild = disk.children[0]
       mismatch = fchild.size < disk.size
@@ -757,7 +757,7 @@ class LUClusterSetParams(LogicalUnit):
                                    " enabling lvm-based disk-templates.")
 
     if self.op.vg_name is not None and not self.op.vg_name:
-      if self.cfg.HasAnyDiskOfType(constants.LD_LV):
+      if self.cfg.HasAnyDiskOfType(constants.DT_PLAIN):
         raise errors.OpPrereqError("Cannot disable lvm storage while lvm-based"
                                    " instances exist", errors.ECODE_INVAL)
 
@@ -859,7 +859,7 @@ class LUClusterSetParams(LogicalUnit):
 
     """
     if self.op.drbd_helper is not None and not self.op.drbd_helper:
-      if self.cfg.HasAnyDiskOfType(constants.LD_DRBD8):
+      if self.cfg.HasAnyDiskOfType(constants.DT_DRBD8):
         raise errors.OpPrereqError("Cannot disable drbd helper while"
                                    " drbd-based instances exist",
                                    errors.ECODE_INVAL)
diff --git a/lib/cmdlib/instance.py b/lib/cmdlib/instance.py
index 8753fad..4a46bf3 100644
--- a/lib/cmdlib/instance.py
+++ b/lib/cmdlib/instance.py
@@ -1705,7 +1705,8 @@ class LUInstanceMove(LogicalUnit):
     bep = self.cfg.GetClusterInfo().FillBE(self.instance)
 
     for idx, dsk in enumerate(self.instance.disks):
-      if dsk.dev_type not in (constants.LD_LV, constants.LD_FILE):
+      if dsk.dev_type not in (constants.DT_PLAIN, constants.DT_FILE,
+                              constants.DT_SHARED_FILE):
         raise errors.OpPrereqError("Instance disk %d has a complex layout,"
                                    " cannot copy" % idx, errors.ECODE_STATE)
 
diff --git a/lib/cmdlib/instance_storage.py b/lib/cmdlib/instance_storage.py
index 793cfa6..6f6cdd5 100644
--- a/lib/cmdlib/instance_storage.py
+++ b/lib/cmdlib/instance_storage.py
@@ -55,16 +55,6 @@ _DISK_TEMPLATE_NAME_PREFIX = {
   }
 
 
-_DISK_TEMPLATE_DEVICE_TYPE = {
-  constants.DT_PLAIN: constants.LD_LV,
-  constants.DT_FILE: constants.LD_FILE,
-  constants.DT_SHARED_FILE: constants.LD_FILE,
-  constants.DT_BLOCK: constants.LD_BLOCKDEV,
-  constants.DT_RBD: constants.LD_RBD,
-  constants.DT_EXT: constants.LD_EXT,
-  }
-
-
 def CreateSingleBlockDev(lu, node_uuid, instance, device, info, force_open,
                          excl_stor):
   """Create a single block device on a given node.
@@ -390,16 +380,16 @@ def _GenerateDRBD8Branch(lu, primary_uuid, secondary_uuid, size, vgnames, names,
   port = lu.cfg.AllocatePort()
   shared_secret = lu.cfg.GenerateDRBDSecret(lu.proc.GetECId())
 
-  dev_data = objects.Disk(dev_type=constants.LD_LV, size=size,
+  dev_data = objects.Disk(dev_type=constants.DT_PLAIN, size=size,
                           logical_id=(vgnames[0], names[0]),
                           params={})
   dev_data.uuid = lu.cfg.GenerateUniqueID(lu.proc.GetECId())
-  dev_meta = objects.Disk(dev_type=constants.LD_LV,
+  dev_meta = objects.Disk(dev_type=constants.DT_PLAIN,
                           size=constants.DRBD_META_SIZE,
                           logical_id=(vgnames[1], names[1]),
                           params={})
   dev_meta.uuid = lu.cfg.GenerateUniqueID(lu.proc.GetECId())
-  drbd_dev = objects.Disk(dev_type=constants.LD_DRBD8, size=size,
+  drbd_dev = objects.Disk(dev_type=constants.DT_DRBD8, size=size,
                           logical_id=(primary_uuid, secondary_uuid, port,
                                       p_minor, s_minor,
                                       shared_secret),
@@ -493,7 +483,7 @@ def GenerateDiskTemplate(
     else:
       raise errors.ProgrammerError("Unknown disk template '%s'" % template_name)
 
-    dev_type = _DISK_TEMPLATE_DEVICE_TYPE[template_name]
+    dev_type = template_name
 
     for idx, disk in enumerate(disk_info):
       params = {}
@@ -819,7 +809,7 @@ class LUInstanceRecreateDisks(LogicalUnit):
         continue
 
       # update secondaries for disks, if needed
-      if self.op.node_uuids and disk.dev_type == constants.LD_DRBD8:
+      if self.op.node_uuids and disk.dev_type == constants.DT_DRBD8:
         # need to update the nodes and minors
         assert len(self.op.node_uuids) == 2
         assert len(disk.logical_id) == 6 # otherwise disk internals
@@ -840,7 +830,7 @@ class LUInstanceRecreateDisks(LogicalUnit):
     for idx, new_id, changes in mods:
       disk = self.instance.disks[idx]
       if new_id is not None:
-        assert disk.dev_type == constants.LD_DRBD8
+        assert disk.dev_type == constants.DT_DRBD8
         disk.logical_id = new_id
       if changes:
         disk.Update(size=changes.get(constants.IDISK_SIZE, None),
@@ -2261,11 +2251,11 @@ class TLReplaceDisks(Tasklet):
 
       (data_disk, meta_disk) = dev.children
       vg_data = data_disk.logical_id[0]
-      lv_data = objects.Disk(dev_type=constants.LD_LV, size=dev.size,
+      lv_data = objects.Disk(dev_type=constants.DT_PLAIN, size=dev.size,
                              logical_id=(vg_data, names[0]),
                              params=data_disk.params)
       vg_meta = meta_disk.logical_id[0]
-      lv_meta = objects.Disk(dev_type=constants.LD_LV,
+      lv_meta = objects.Disk(dev_type=constants.DT_PLAIN,
                              size=constants.DRBD_META_SIZE,
                              logical_id=(vg_meta, names[1]),
                              params=meta_disk.params)
@@ -2541,7 +2531,7 @@ class TLReplaceDisks(Tasklet):
       iv_names[idx] = (dev, dev.children, new_net_id)
       logging.debug("Allocated new_minor: %s, new_logical_id: %s", new_minor,
                     new_net_id)
-      new_drbd = objects.Disk(dev_type=constants.LD_DRBD8,
+      new_drbd = objects.Disk(dev_type=constants.DT_DRBD8,
                               logical_id=new_alone_id,
                               children=dev.children,
                               size=dev.size,
diff --git a/lib/config.py b/lib/config.py
index d29e792..7fb136b 100644
--- a/lib/config.py
+++ b/lib/config.py
@@ -891,7 +891,7 @@ class ConfigWriter:
 
     if disk.logical_id is None and disk.physical_id is not None:
       return
-    if disk.dev_type == constants.LD_DRBD8:
+    if disk.dev_type == constants.DT_DRBD8:
       pnode, snode, port, pminor, sminor, secret = disk.logical_id
       if node_uuid not in (pnode, snode):
         raise errors.ConfigurationError("DRBD device not knowing node %s" %
@@ -981,7 +981,7 @@ class ConfigWriter:
     """
     def _AppendUsedMinors(get_node_name_fn, instance, disk, used):
       duplicates = []
-      if disk.dev_type == constants.LD_DRBD8 and len(disk.logical_id) >= 5:
+      if disk.dev_type == constants.DT_DRBD8 and len(disk.logical_id) >= 5:
         node_a, node_b, _, minor_a, minor_b = disk.logical_id[:5]
         for node_uuid, minor in ((node_a, minor_a), (node_b, minor_b)):
           assert node_uuid in used, \
@@ -1570,7 +1570,7 @@ class ConfigWriter:
     inst.name = new_name
 
     for (idx, disk) in enumerate(inst.disks):
-      if disk.dev_type == constants.LD_FILE:
+      if disk.dev_type in [constants.DT_FILE, constants.DT_SHARED_FILE]:
         # rename the file paths in logical and physical id
         file_storage_dir = os.path.dirname(os.path.dirname(disk.logical_id[1]))
         disk.logical_id = (disk.logical_id[0],
diff --git a/lib/constants.py b/lib/constants.py
index e7b6120..d9434a1 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -564,28 +564,12 @@ DTS_NO_FREE_SPACE_CHECK = compat.UniqueFrozenset([
   DT_EXT,
   ])
 
-# logical disk types
-LD_LV = "lvm"
-LD_DRBD8 = "drbd8"
-LD_FILE = "file"
-LD_BLOCKDEV = "blockdev"
-LD_RBD = "rbd"
-LD_EXT = "ext"
-LOGICAL_DISK_TYPES = compat.UniqueFrozenset([
-  LD_LV,
-  LD_DRBD8,
-  LD_FILE,
-  LD_BLOCKDEV,
-  LD_RBD,
-  LD_EXT,
-  ])
-
-LDS_BLOCK = compat.UniqueFrozenset([
-  LD_LV,
-  LD_DRBD8,
-  LD_BLOCKDEV,
-  LD_RBD,
-  LD_EXT,
+DTS_BLOCK = compat.UniqueFrozenset([
+  DT_PLAIN,
+  DT_DRBD8,
+  DT_BLOCK,
+  DT_RBD,
+  DT_EXT,
   ])
 
 # drbd constants
@@ -623,7 +607,7 @@ FD_LOOP = "loop"
 FD_BLKTAP = "blktap"
 
 # the set of drbd-like disk types
-LDS_DRBD = compat.UniqueFrozenset([LD_DRBD8])
+LDS_DRBD = compat.UniqueFrozenset([DT_DRBD8])
 
 # disk access mode
 DISK_RDONLY = "ro"
@@ -1119,7 +1103,7 @@ DSS_PARAMETER_TYPES = {
   }
 
 DSS_PARAMETERS = frozenset(DSS_PARAMETER_TYPES.keys())
-DS_VALID_TYPES = compat.UniqueFrozenset([LD_LV])
+DS_VALID_TYPES = compat.UniqueFrozenset([DT_PLAIN])
 
 # Backend parameter names
 BE_MEMORY = "memory" # deprecated and replaced by max and min mem
@@ -2203,8 +2187,8 @@ NDC_GLOBALS = compat.UniqueFrozenset([
   ND_EXCLUSIVE_STORAGE,
   ])
 
-DISK_LD_DEFAULTS = {
-  LD_DRBD8: {
+DISK_DT_DEFAULTS = {
+  DT_DRBD8: {
     LDP_RESYNC_RATE: CLASSIC_DRBD_SYNC_SPEED,
     LDP_BARRIERS: _autoconf.DRBD_BARRIERS,
     LDP_NO_META_FLUSH: _autoconf.DRBD_NO_META_FLUSH,
@@ -2225,24 +2209,25 @@ DISK_LD_DEFAULTS = {
     LDP_MAX_RATE: CLASSIC_DRBD_SYNC_SPEED, # KiB/s
     LDP_MIN_RATE: 4 * 1024, # KiB/s
     },
-  LD_LV: {
+  DT_PLAIN: {
     LDP_STRIPES: _autoconf.LVM_STRIPECOUNT
     },
-  LD_FILE: {},
-  LD_BLOCKDEV: {},
-  LD_RBD: {
+  DT_FILE: {},
+  DT_SHARED_FILE: {},
+  DT_BLOCK: {},
+  DT_RBD: {
     LDP_POOL: "rbd"
     },
-  LD_EXT: {},
+  DT_EXT: {},
   }
 
 # readability shortcuts
-_LV_DEFAULTS = DISK_LD_DEFAULTS[LD_LV]
-_DRBD_DEFAULTS = DISK_LD_DEFAULTS[LD_DRBD8]
+_LV_DEFAULTS = DISK_DT_DEFAULTS[DT_PLAIN]
+_DRBD_DEFAULTS = DISK_DT_DEFAULTS[DT_DRBD8]
 
 DISK_DT_DEFAULTS = {
   DT_PLAIN: {
-    LV_STRIPES: DISK_LD_DEFAULTS[LD_LV][LDP_STRIPES],
+    LV_STRIPES: DISK_DT_DEFAULTS[DT_PLAIN][LDP_STRIPES],
     },
   DT_DRBD8: {
     DRBD_RESYNC_RATE: _DRBD_DEFAULTS[LDP_RESYNC_RATE],
@@ -2266,7 +2251,7 @@ DISK_DT_DEFAULTS = {
   DT_SHARED_FILE: {},
   DT_BLOCK: {},
   DT_RBD: {
-    RBD_POOL: DISK_LD_DEFAULTS[LD_RBD][LDP_POOL]
+    RBD_POOL: DISK_DT_DEFAULTS[DT_RBD][LDP_POOL]
     },
   DT_EXT: {},
   }
diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py
index fa1cb0c..8aa940f 100644
--- a/lib/hypervisor/hv_xen.py
+++ b/lib/hypervisor/hv_xen.py
@@ -295,7 +295,7 @@ def _GetConfigFileDiskData(block_devices, blockdev_prefix,
     else:
       mode = "r"
 
-    if cfdev.dev_type == constants.LD_FILE:
+    if cfdev.dev_type in [constants.DT_FILE, constants.DT_SHARED_FILE]:
       driver = _FILE_DRIVER_MAP[cfdev.physical_id[0]]
     else:
       driver = "phy"
diff --git a/lib/masterd/instance.py b/lib/masterd/instance.py
index 8bb5e5d..fe0aa45 100644
--- a/lib/masterd/instance.py
+++ b/lib/masterd/instance.py
@@ -1184,8 +1184,8 @@ class ExportInstanceHelper:
                             " result '%s'", idx, src_node, result.payload)
       else:
         disk_id = tuple(result.payload)
-        disk_params = constants.DISK_LD_DEFAULTS[constants.LD_LV].copy()
-        new_dev = objects.Disk(dev_type=constants.LD_LV, size=disk.size,
+        disk_params = constants.DISK_DT_DEFAULTS[constants.DT_PLAIN].copy()
+        new_dev = objects.Disk(dev_type=constants.DT_PLAIN, size=disk.size,
                                logical_id=disk_id, physical_id=disk_id,
                                iv_name=disk.iv_name,
                                params=disk_params)
diff --git a/lib/objects.py b/lib/objects.py
index 758d5b3..9811eb4 100644
--- a/lib/objects.py
+++ b/lib/objects.py
@@ -418,7 +418,7 @@ class ConfigData(ConfigObject):
   def HasAnyDiskOfType(self, dev_type):
     """Check if in there is at disk of the given type in the configuration.
 
-    @type dev_type: L{constants.LDS_BLOCK}
+    @type dev_type: L{constants.DTS_BLOCK}
     @param dev_type: the type to look for
     @rtype: boolean
     @return: boolean indicating if a disk of the given type was found or not
@@ -447,7 +447,7 @@ class ConfigData(ConfigObject):
       # To decide if we set an helper let's check if at least one instance has
       # a DRBD disk. This does not cover all the possible scenarios but it
       # gives a good approximation.
-      if self.HasAnyDiskOfType(constants.LD_DRBD8):
+      if self.HasAnyDiskOfType(constants.DT_DRBD8):
         self.cluster.drbd_usermode_helper = constants.DEFAULT_DRBD_HELPER
     if self.networks is None:
       self.networks = {}
@@ -511,15 +511,15 @@ class Disk(ConfigObject):
 
   def CreateOnSecondary(self):
     """Test if this device needs to be created on a secondary node."""
-    return self.dev_type in (constants.LD_DRBD8, constants.LD_LV)
+    return self.dev_type in (constants.DT_DRBD8, constants.DT_PLAIN)
 
   def AssembleOnSecondary(self):
     """Test if this device needs to be assembled on a secondary node."""
-    return self.dev_type in (constants.LD_DRBD8, constants.LD_LV)
+    return self.dev_type in (constants.DT_DRBD8, constants.DT_PLAIN)
 
   def OpenOnSecondary(self):
     """Test if this device needs to be opened on a secondary node."""
-    return self.dev_type in (constants.LD_LV,)
+    return self.dev_type in (constants.DT_PLAIN,)
 
   def StaticDevPath(self):
     """Return the device path if this device type has a static one.
@@ -532,11 +532,11 @@ class Disk(ConfigObject):
         should check that it is a valid path.
 
     """
-    if self.dev_type == constants.LD_LV:
+    if self.dev_type == constants.DT_PLAIN:
       return "/dev/%s/%s" % (self.logical_id[0], self.logical_id[1])
-    elif self.dev_type == constants.LD_BLOCKDEV:
+    elif self.dev_type == constants.DT_BLOCK:
       return self.logical_id[1]
-    elif self.dev_type == constants.LD_RBD:
+    elif self.dev_type == constants.DT_RBD:
       return "/dev/%s/%s" % (self.logical_id[0], self.logical_id[1])
     return None
 
@@ -552,14 +552,14 @@ class Disk(ConfigObject):
     -1.
 
     """
-    if self.dev_type == constants.LD_DRBD8:
+    if self.dev_type == constants.DT_DRBD8:
       return 0
     return -1
 
   def IsBasedOnDiskType(self, dev_type):
     """Check if the disk or its children are based on the given type.
 
-    @type dev_type: L{constants.LDS_BLOCK}
+    @type dev_type: L{constants.DTS_BLOCK}
     @param dev_type: the type to look for
     @rtype: boolean
     @return: boolean indicating if a device of the given type was found or not
@@ -580,9 +580,9 @@ class Disk(ConfigObject):
     devices needs to (or can) be assembled.
 
     """
-    if self.dev_type in [constants.LD_LV, constants.LD_FILE,
-                         constants.LD_BLOCKDEV, constants.LD_RBD,
-                         constants.LD_EXT]:
+    if self.dev_type in [constants.DT_PLAIN, constants.DT_FILE,
+                         constants.DT_BLOCK, constants.DT_RBD,
+                         constants.DT_EXT, constants.DT_SHARED_FILE]:
       result = [node_uuid]
     elif self.dev_type in constants.LDS_DRBD:
       result = [self.logical_id[0], self.logical_id[1]]
@@ -638,9 +638,9 @@ class Disk(ConfigObject):
     @return: a dictionary of volume-groups and the required size
 
     """
-    if self.dev_type == constants.LD_LV:
+    if self.dev_type == constants.DT_PLAIN:
       return {self.logical_id[0]: amount}
-    elif self.dev_type == constants.LD_DRBD8:
+    elif self.dev_type == constants.DT_DRBD8:
       if self.children:
         return self.children[0].ComputeGrowth(amount)
       else:
@@ -657,10 +657,11 @@ class Disk(ConfigObject):
     actual algorithms from bdev.
 
     """
-    if self.dev_type in (constants.LD_LV, constants.LD_FILE,
-                         constants.LD_RBD, constants.LD_EXT):
+    if self.dev_type in (constants.DT_PLAIN, constants.DT_FILE,
+                         constants.DT_RBD, constants.DT_EXT,
+                         constants.DT_SHARED_FILE):
       self.size += amount
-    elif self.dev_type == constants.LD_DRBD8:
+    elif self.dev_type == constants.DT_DRBD8:
       if self.children:
         self.children[0].RecordGrow(amount)
       self.size += amount
@@ -672,7 +673,7 @@ class Disk(ConfigObject):
     """Apply changes to size, spindles and mode.
 
     """
-    if self.dev_type == constants.LD_DRBD8:
+    if self.dev_type == constants.DT_DRBD8:
       if self.children:
         self.children[0].Update(size=size, mode=mode)
     else:
@@ -775,7 +776,7 @@ class Disk(ConfigObject):
     """Custom str() formatter for disks.
 
     """
-    if self.dev_type == constants.LD_LV:
+    if self.dev_type == constants.DT_PLAIN:
       val = "<LogicalVolume(/dev/%s/%s" % self.logical_id
     elif self.dev_type in constants.LDS_DRBD:
       node_a, node_b, port, minor_a, minor_b = self.logical_id[:5]
@@ -851,7 +852,7 @@ class Disk(ConfigObject):
     result = list()
     dt_params = disk_params[disk_template]
     if disk_template == constants.DT_DRBD8:
-      result.append(FillDict(constants.DISK_LD_DEFAULTS[constants.LD_DRBD8], {
+      result.append(FillDict(constants.DISK_DT_DEFAULTS[constants.DT_DRBD8], {
         constants.LDP_RESYNC_RATE: dt_params[constants.DRBD_RESYNC_RATE],
         constants.LDP_BARRIERS: dt_params[constants.DRBD_DISK_BARRIERS],
         constants.LDP_NO_META_FLUSH: dt_params[constants.DRBD_META_BARRIERS],
@@ -868,33 +869,33 @@ class Disk(ConfigObject):
         }))
 
       # data LV
-      result.append(FillDict(constants.DISK_LD_DEFAULTS[constants.LD_LV], {
+      result.append(FillDict(constants.DISK_DT_DEFAULTS[constants.DT_PLAIN], {
         constants.LDP_STRIPES: dt_params[constants.DRBD_DATA_STRIPES],
         }))
 
       # metadata LV
-      result.append(FillDict(constants.DISK_LD_DEFAULTS[constants.LD_LV], {
+      result.append(FillDict(constants.DISK_DT_DEFAULTS[constants.DT_PLAIN], {
         constants.LDP_STRIPES: dt_params[constants.DRBD_META_STRIPES],
         }))
 
     elif disk_template in (constants.DT_FILE, constants.DT_SHARED_FILE):
-      result.append(constants.DISK_LD_DEFAULTS[constants.LD_FILE])
+      result.append(constants.DISK_DT_DEFAULTS[disk_template])
 
     elif disk_template == constants.DT_PLAIN:
-      result.append(FillDict(constants.DISK_LD_DEFAULTS[constants.LD_LV], {
+      result.append(FillDict(constants.DISK_DT_DEFAULTS[constants.DT_PLAIN], {
         constants.LDP_STRIPES: dt_params[constants.LV_STRIPES],
         }))
 
     elif disk_template == constants.DT_BLOCK:
-      result.append(constants.DISK_LD_DEFAULTS[constants.LD_BLOCKDEV])
+      result.append(constants.DISK_DT_DEFAULTS[constants.DT_BLOCK])
 
     elif disk_template == constants.DT_RBD:
-      result.append(FillDict(constants.DISK_LD_DEFAULTS[constants.LD_RBD], {
+      result.append(FillDict(constants.DISK_DT_DEFAULTS[constants.DT_RBD], {
         constants.LDP_POOL: dt_params[constants.RBD_POOL],
         }))
 
     elif disk_template == constants.DT_EXT:
-      result.append(constants.DISK_LD_DEFAULTS[constants.LD_EXT])
+      result.append(constants.DISK_DT_DEFAULTS[constants.DT_EXT])
 
     return result
 
@@ -1140,7 +1141,7 @@ class Instance(TaggableObject):
       devs = self.disks
 
     for dev in devs:
-      if dev.dev_type == constants.LD_LV:
+      if dev.dev_type == constants.DT_PLAIN:
         lvmap[node_uuid].append(dev.logical_id[0] + "/" + dev.logical_id[1])
 
       elif dev.dev_type in constants.LDS_DRBD:
diff --git a/lib/rpc.py b/lib/rpc.py
index 1058dcc..c934ba2 100644
--- a/lib/rpc.py
+++ b/lib/rpc.py
@@ -662,7 +662,7 @@ def _AnnotateDParamsDRBD(disk, (drbd_params, data_params, meta_params)):
   """Annotates just DRBD disks layouts.
 
   """
-  assert disk.dev_type == constants.LD_DRBD8
+  assert disk.dev_type == constants.DT_DRBD8
 
   disk.params = objects.FillDict(drbd_params, disk.params)
   (dev_data, dev_meta) = disk.children
@@ -676,7 +676,7 @@ def _AnnotateDParamsGeneric(disk, (params, )):
   """Generic disk parameter annotation routine.
 
   """
-  assert disk.dev_type != constants.LD_DRBD8
+  assert disk.dev_type != constants.DT_DRBD8
 
   disk.params = objects.FillDict(params, disk.params)
 
diff --git a/lib/storage/bdev.py b/lib/storage/bdev.py
index 0807333..5a9e495 100644
--- a/lib/storage/bdev.py
+++ b/lib/storage/bdev.py
@@ -1718,12 +1718,13 @@ def _VolumeLogName(kind, es_name, volume):
 
 
 DEV_MAP = {
-  constants.LD_LV: LogicalVolume,
-  constants.LD_DRBD8: drbd.DRBD8Dev,
-  constants.LD_BLOCKDEV: PersistentBlockDevice,
-  constants.LD_RBD: RADOSBlockDevice,
-  constants.LD_EXT: ExtStorageDevice,
-  constants.LD_FILE: FileStorage,
+  constants.DT_PLAIN: LogicalVolume,
+  constants.DT_DRBD8: drbd.DRBD8Dev,
+  constants.DT_BLOCK: PersistentBlockDevice,
+  constants.DT_RBD: RADOSBlockDevice,
+  constants.DT_EXT: ExtStorageDevice,
+  constants.DT_FILE: FileStorage,
+  constants.DT_SHARED_FILE: FileStorage,
   }
 
 
@@ -1736,7 +1737,7 @@ def _VerifyDiskParams(disk):
   """Verifies if all disk parameters are set.
 
   """
-  missing = set(constants.DISK_LD_DEFAULTS[disk.dev_type]) - set(disk.params)
+  missing = set(constants.DISK_DT_DEFAULTS[disk.dev_type]) - set(disk.params)
   if missing:
     raise errors.ProgrammerError("Block device is missing disk parameters: %s" %
                                  missing)
diff --git a/qa/qa_instance.py b/qa/qa_instance.py
index 37b7fc4..e7d8bb4 100644
--- a/qa/qa_instance.py
+++ b/qa/qa_instance.py
@@ -95,7 +95,7 @@ def GetInstanceInfo(instance):
   drbd_min = {}
   for (count, diskinfo) in enumerate(info["Disks"]):
     (dtype, _) = diskinfo["disk/%s" % count].split(",", 1)
-    if dtype == constants.LD_DRBD8:
+    if dtype == constants.DT_DRBD8:
       for child in diskinfo["child devices"]:
         vols.append(child["logical_id"])
       for key in ["nodeA", "nodeB"]:
@@ -106,7 +106,7 @@ def GetInstanceInfo(instance):
         minor = int(m.group(2))
         minorlist = drbd_min.setdefault(node, [])
         minorlist.append(minor)
-    elif dtype == constants.LD_LV:
+    elif dtype == constants.DT_PLAIN:
       vols.append(diskinfo["logical_id"])
 
   assert nodes
diff --git a/src/Ganeti/Objects.hs b/src/Ganeti/Objects.hs
index 22115eb..2e08072 100644
--- a/src/Ganeti/Objects.hs
+++ b/src/Ganeti/Objects.hs
@@ -41,7 +41,6 @@ module Ganeti.Objects
   , FileDriver(..)
   , BlockDriver(..)
   , DiskMode(..)
-  , DiskType(..)
   , DiskLogicalId(..)
   , Disk(..)
   , includesLogicalId
@@ -303,16 +302,6 @@ $(declareSADT "DiskMode"
   ])
 $(makeJSONInstance ''DiskMode)
 
-$(declareSADT "DiskType"
-  [ ("LD_LV",       'C.ldLv)
-  , ("LD_DRBD8",    'C.ldDrbd8)
-  , ("LD_FILE",     'C.ldFile)
-  , ("LD_BLOCKDEV", 'C.ldBlockdev)
-  , ("LD_RADOS",    'C.ldRbd)
-  , ("LD_EXT",      'C.ldExt)
-  ])
-$(makeJSONInstance ''DiskType)
-
 -- | The persistent block driver type. Currently only one type is allowed.
 $(declareSADT "BlockDriver"
   [ ("BlockDrvManual", 'C.blockdevDriverManual)
@@ -332,19 +321,21 @@ data DiskLogicalId
   | LIDDrbd8 String String Int Int Int String
   -- ^ NodeA, NodeB, Port, MinorA, MinorB, Secret
   | LIDFile FileDriver String -- ^ Driver, path
+  | LIDSharedFile FileDriver String -- ^ Driver, path
   | LIDBlockDev BlockDriver String -- ^ Driver, path (must be under /dev)
   | LIDRados String String -- ^ Unused, path
   | LIDExt String String -- ^ ExtProvider, unique name
     deriving (Show, Eq)
 
 -- | Mapping from a logical id to a disk type.
-lidDiskType :: DiskLogicalId -> DiskType
-lidDiskType (LIDPlain {}) = LD_LV
-lidDiskType (LIDDrbd8 {}) = LD_DRBD8
-lidDiskType (LIDFile  {}) = LD_FILE
-lidDiskType (LIDBlockDev {}) = LD_BLOCKDEV
-lidDiskType (LIDRados {}) = LD_RADOS
-lidDiskType (LIDExt {}) = LD_EXT
+lidDiskType :: DiskLogicalId -> DiskTemplate
+lidDiskType (LIDPlain {}) = DTPlain
+lidDiskType (LIDDrbd8 {}) = DTDrbd8
+lidDiskType (LIDFile  {}) = DTFile
+lidDiskType (LIDSharedFile  {}) = DTSharedFile
+lidDiskType (LIDBlockDev {}) = DTBlock
+lidDiskType (LIDRados {}) = DTRbd
+lidDiskType (LIDExt {}) = DTExt
 
 -- | Builds the extra disk_type field for a given logical id.
 lidEncodeType :: DiskLogicalId -> [(String, JSValue)]
@@ -358,6 +349,8 @@ encodeDLId (LIDDrbd8 nodeA nodeB port minorA minorB key) =
           , showJSON minorA, showJSON minorB, showJSON key ]
 encodeDLId (LIDRados pool name) = JSArray [showJSON pool, showJSON name]
 encodeDLId (LIDFile driver name) = JSArray [showJSON driver, showJSON name]
+encodeDLId (LIDSharedFile driver name) =
+  JSArray [showJSON driver, showJSON name]
 encodeDLId (LIDBlockDev driver name) = JSArray [showJSON driver, showJSON name]
 encodeDLId (LIDExt extprovider name) =
   JSArray [showJSON extprovider, showJSON name]
@@ -373,7 +366,7 @@ decodeDLId :: [(String, JSValue)] -> JSValue -> J.Result DiskLogicalId
 decodeDLId obj lid = do
   dtype <- fromObj obj devType
   case dtype of
-    LD_DRBD8 ->
+    DTDrbd8 ->
       case lid of
         JSArray [nA, nB, p, mA, mB, k] -> do
           nA' <- readJSON nA
@@ -384,41 +377,50 @@ decodeDLId obj lid = do
           k'  <- readJSON k
           return $ LIDDrbd8 nA' nB' p' mA' mB' k'
         _ -> fail "Can't read logical_id for DRBD8 type"
-    LD_LV ->
+    DTPlain ->
       case lid of
         JSArray [vg, lv] -> do
           vg' <- readJSON vg
           lv' <- readJSON lv
           return $ LIDPlain vg' lv'
         _ -> fail "Can't read logical_id for plain type"
-    LD_FILE ->
+    DTFile ->
       case lid of
         JSArray [driver, path] -> do
           driver' <- readJSON driver
           path'   <- readJSON path
           return $ LIDFile driver' path'
         _ -> fail "Can't read logical_id for file type"
-    LD_BLOCKDEV ->
+    DTSharedFile ->
+      case lid of
+        JSArray [driver, path] -> do
+          driver' <- readJSON driver
+          path'   <- readJSON path
+          return $ LIDSharedFile driver' path'
+        _ -> fail "Can't read logical_id for shared file type"
+    DTBlock ->
       case lid of
         JSArray [driver, path] -> do
           driver' <- readJSON driver
           path'   <- readJSON path
           return $ LIDBlockDev driver' path'
         _ -> fail "Can't read logical_id for blockdev type"
-    LD_RADOS ->
+    DTRbd ->
       case lid of
         JSArray [driver, path] -> do
           driver' <- readJSON driver
           path'   <- readJSON path
           return $ LIDRados driver' path'
         _ -> fail "Can't read logical_id for rdb type"
-    LD_EXT ->
+    DTExt ->
       case lid of
         JSArray [extprovider, name] -> do
           extprovider' <- readJSON extprovider
           name'   <- readJSON name
           return $ LIDExt extprovider' name'
         _ -> fail "Can't read logical_id for extstorage type"
+    DTDiskless ->
+      fail "Retrieved 'diskless' disk."
 
 -- | Disk data structure.
 --
diff --git a/test/py/ganeti.cmdlib_unittest.py b/test/py/ganeti.cmdlib_unittest.py
index 3eade88..2cc304a 100755
--- a/test/py/ganeti.cmdlib_unittest.py
+++ b/test/py/ganeti.cmdlib_unittest.py
@@ -197,7 +197,7 @@ class TestLUGroupAssignNodes(unittest.TestCase):
         disks = []
         disk_template = constants.DT_DISKLESS
       else:
-        disks = [objects.Disk(dev_type=constants.LD_DRBD8,
+        disks = [objects.Disk(dev_type=constants.DT_DRBD8,
                               logical_id=[pnode, snode, 1, 17, 17])]
         disk_template = constants.DT_DRBD8
 
@@ -604,7 +604,7 @@ class TestDiskStateHelper(unittest.TestCase):
 
   def testWithoutOldData(self):
     new = {
-      constants.LD_LV: {
+      constants.DT_PLAIN: {
         "xenvg": {
           constants.DS_DISK_RESERVED: 1024,
           },
@@ -1293,7 +1293,7 @@ class TestGenerateDiskTemplate(unittest.TestCase):
       }]
 
     result = self._TestTrivialDisk(constants.DT_PLAIN, disk_info, 3,
-                                   constants.LD_LV)
+                                   constants.DT_PLAIN)
 
     self.assertEqual(map(operator.attrgetter("logical_id"), result), [
       ("testvg", "ec0-uq0.disk3"),
@@ -1322,7 +1322,7 @@ class TestGenerateDiskTemplate(unittest.TestCase):
 
       self._SetUpLUWithTemplates([disk_template])
       result = self._TestTrivialDisk(disk_template, disk_info, 2,
-        constants.LD_FILE, file_storage_dir="/tmp",
+        constants.DT_FILE, file_storage_dir="/tmp",
         file_driver=constants.FD_BLKTAP)
 
       self.assertEqual(map(operator.attrgetter("logical_id"), result), [
@@ -1339,7 +1339,7 @@ class TestGenerateDiskTemplate(unittest.TestCase):
       }]
 
     result = self._TestTrivialDisk(constants.DT_BLOCK, disk_info, 10,
-                                   constants.LD_BLOCKDEV)
+                                   constants.DT_BLOCK)
 
     self.assertEqual(map(operator.attrgetter("logical_id"), result), [
       (constants.BLOCKDEV_DRIVER_MANUAL, "/tmp/some/block/dev"),
@@ -1355,7 +1355,7 @@ class TestGenerateDiskTemplate(unittest.TestCase):
       }]
 
     result = self._TestTrivialDisk(constants.DT_RBD, disk_info, 0,
-                                   constants.LD_RBD)
+                                   constants.DT_RBD)
 
     self.assertEqual(map(operator.attrgetter("logical_id"), result), [
       ("rbd", "ec0-uq0.rbd.disk0"),
@@ -1364,7 +1364,7 @@ class TestGenerateDiskTemplate(unittest.TestCase):
 
   def testDrbd8(self):
     gdt = instance.GenerateDiskTemplate
-    drbd8_defaults = constants.DISK_LD_DEFAULTS[constants.LD_DRBD8]
+    drbd8_defaults = constants.DISK_DT_DEFAULTS[constants.DT_DRBD8]
     drbd8_default_metavg = drbd8_defaults[constants.LDP_DEFAULT_METAVG]
 
     disk_info = [{
@@ -1411,13 +1411,13 @@ class TestGenerateDiskTemplate(unittest.TestCase):
 
     for (idx, disk) in enumerate(result):
       self.assertTrue(isinstance(disk, objects.Disk))
-      self.assertEqual(disk.dev_type, constants.LD_DRBD8)
+      self.assertEqual(disk.dev_type, constants.DT_DRBD8)
       self.assertEqual(disk.size, disk_info[idx][constants.IDISK_SIZE])
       self.assertEqual(disk.mode, disk_info[idx][constants.IDISK_MODE])
 
       for child in disk.children:
         self.assertTrue(isinstance(disk, objects.Disk))
-        self.assertEqual(child.dev_type, constants.LD_LV)
+        self.assertEqual(child.dev_type, constants.DT_PLAIN)
         self.assertTrue(child.children is None)
 
       self.assertEqual(map(operator.attrgetter("logical_id"), disk.children),
@@ -1528,9 +1528,9 @@ class TestWipeDisks(unittest.TestCase):
                  cfg=_ConfigForDiskWipe(node_name))
 
     disks = [
-      objects.Disk(dev_type=constants.LD_LV),
-      objects.Disk(dev_type=constants.LD_LV),
-      objects.Disk(dev_type=constants.LD_LV),
+      objects.Disk(dev_type=constants.DT_PLAIN),
+      objects.Disk(dev_type=constants.DT_PLAIN),
+      objects.Disk(dev_type=constants.DT_PLAIN),
       ]
 
     inst = objects.Instance(name="inst21201",
@@ -1553,11 +1553,11 @@ class TestWipeDisks(unittest.TestCase):
                  cfg=_ConfigForDiskWipe(node_uuid))
 
     disks = [
-      objects.Disk(dev_type=constants.LD_LV, logical_id="disk0",
+      objects.Disk(dev_type=constants.DT_PLAIN, logical_id="disk0",
                    size=100 * 1024),
-      objects.Disk(dev_type=constants.LD_LV, logical_id="disk1",
+      objects.Disk(dev_type=constants.DT_PLAIN, logical_id="disk1",
                    size=500 * 1024),
-      objects.Disk(dev_type=constants.LD_LV, logical_id="disk2", size=256),
+      objects.Disk(dev_type=constants.DT_PLAIN, logical_id="disk2", size=256),
       ]
 
     inst = objects.Instance(name="inst562",
@@ -1599,11 +1599,11 @@ class TestWipeDisks(unittest.TestCase):
 
   def testNormalWipe(self):
     disks = [
-      objects.Disk(dev_type=constants.LD_LV, logical_id="disk0", size=1024),
-      objects.Disk(dev_type=constants.LD_LV, logical_id="disk1",
+      objects.Disk(dev_type=constants.DT_PLAIN, logical_id="disk0", size=1024),
+      objects.Disk(dev_type=constants.DT_PLAIN, logical_id="disk1",
                    size=500 * 1024),
-      objects.Disk(dev_type=constants.LD_LV, logical_id="disk2", size=128),
-      objects.Disk(dev_type=constants.LD_LV, logical_id="disk3",
+      objects.Disk(dev_type=constants.DT_PLAIN, logical_id="disk2", size=128),
+      objects.Disk(dev_type=constants.DT_PLAIN, logical_id="disk3",
                    size=constants.MAX_WIPE_CHUNK),
       ]
 
@@ -1629,9 +1629,9 @@ class TestWipeDisks(unittest.TestCase):
   def testWipeWithStartOffset(self):
     for start_offset in [0, 280, 8895, 1563204]:
       disks = [
-        objects.Disk(dev_type=constants.LD_LV, logical_id="disk0",
+        objects.Disk(dev_type=constants.DT_PLAIN, logical_id="disk0",
                      size=128),
-        objects.Disk(dev_type=constants.LD_LV, logical_id="disk1",
+        objects.Disk(dev_type=constants.DT_PLAIN, logical_id="disk1",
                      size=start_offset + (100 * 1024)),
         ]
 
diff --git a/test/py/ganeti.constants_unittest.py b/test/py/ganeti.constants_unittest.py
index 3139d7d..f4961d9 100755
--- a/test/py/ganeti.constants_unittest.py
+++ b/test/py/ganeti.constants_unittest.py
@@ -80,8 +80,8 @@ class TestConstants(unittest.TestCase):
     self.failUnless(constants.OP_PRIO_HIGH > constants.OP_PRIO_HIGHEST)
 
   def testDiskDefaults(self):
-    self.failUnless(set(constants.DISK_LD_DEFAULTS.keys()) ==
-                    constants.LOGICAL_DISK_TYPES)
+    self.failUnless(set(constants.DISK_DT_DEFAULTS.keys()) ==
+                    constants.DISK_TEMPLATES)
     self.failUnless(set(constants.DISK_DT_DEFAULTS.keys()) ==
                     constants.DISK_TEMPLATES)
 
diff --git a/test/py/ganeti.hypervisor.hv_xen_unittest.py b/test/py/ganeti.hypervisor.hv_xen_unittest.py
index 8b59ebf..60d44dd 100755
--- a/test/py/ganeti.hypervisor.hv_xen_unittest.py
+++ b/test/py/ganeti.hypervisor.hv_xen_unittest.py
@@ -269,7 +269,7 @@ class TestGetConfigFileDiskData(unittest.TestCase):
 
   def testManyDisks(self):
     for offset in [0, 1, 10]:
-      disks = [(objects.Disk(dev_type=constants.LD_LV), "/tmp/disk/%s" % idx)
+      disks = [(objects.Disk(dev_type=constants.DT_PLAIN), "/tmp/disk/%s" % idx)
                for idx in range(len(hv_xen._DISK_LETTERS) + offset)]
 
       if offset == 0:
@@ -288,9 +288,9 @@ class TestGetConfigFileDiskData(unittest.TestCase):
 
   def testTwoLvDisksWithMode(self):
     disks = [
-      (objects.Disk(dev_type=constants.LD_LV, mode=constants.DISK_RDWR),
+      (objects.Disk(dev_type=constants.DT_PLAIN, mode=constants.DISK_RDWR),
        "/tmp/diskFirst"),
-      (objects.Disk(dev_type=constants.LD_LV, mode=constants.DISK_RDONLY),
+      (objects.Disk(dev_type=constants.DT_PLAIN, mode=constants.DISK_RDONLY),
        "/tmp/diskLast"),
       ]
 
@@ -302,16 +302,16 @@ class TestGetConfigFileDiskData(unittest.TestCase):
 
   def testFileDisks(self):
     disks = [
-      (objects.Disk(dev_type=constants.LD_FILE, mode=constants.DISK_RDWR,
+      (objects.Disk(dev_type=constants.DT_FILE, mode=constants.DISK_RDWR,
                     physical_id=[constants.FD_LOOP]),
        "/tmp/diskFirst"),
-      (objects.Disk(dev_type=constants.LD_FILE, mode=constants.DISK_RDONLY,
+      (objects.Disk(dev_type=constants.DT_FILE, mode=constants.DISK_RDONLY,
                     physical_id=[constants.FD_BLKTAP]),
        "/tmp/diskTwo"),
-      (objects.Disk(dev_type=constants.LD_FILE, mode=constants.DISK_RDWR,
+      (objects.Disk(dev_type=constants.DT_FILE, mode=constants.DISK_RDWR,
                     physical_id=[constants.FD_LOOP]),
        "/tmp/diskThree"),
-      (objects.Disk(dev_type=constants.LD_FILE, mode=constants.DISK_RDWR,
+      (objects.Disk(dev_type=constants.DT_FILE, mode=constants.DISK_RDWR,
                     physical_id=[constants.FD_BLKTAP]),
        "/tmp/diskLast"),
       ]
@@ -326,7 +326,7 @@ class TestGetConfigFileDiskData(unittest.TestCase):
 
   def testInvalidFileDisk(self):
     disks = [
-      (objects.Disk(dev_type=constants.LD_FILE, mode=constants.DISK_RDWR,
+      (objects.Disk(dev_type=constants.DT_FILE, mode=constants.DISK_RDWR,
                     physical_id=["#unknown#"]),
        "/tmp/diskinvalid"),
       ]
@@ -678,9 +678,9 @@ class _TestXenHypervisor(object):
       hvp[constants.HV_VNC_PASSWORD_FILE] = self.vncpw_path
 
     disks = [
-      (objects.Disk(dev_type=constants.LD_LV, mode=constants.DISK_RDWR),
+      (objects.Disk(dev_type=constants.DT_PLAIN, mode=constants.DISK_RDWR),
        utils.PathJoin(self.tmpdir, "disk0")),
-      (objects.Disk(dev_type=constants.LD_LV, mode=constants.DISK_RDONLY),
+      (objects.Disk(dev_type=constants.DT_PLAIN, mode=constants.DISK_RDONLY),
        utils.PathJoin(self.tmpdir, "disk1")),
       ]
 
diff --git a/test/py/ganeti.objects_unittest.py b/test/py/ganeti.objects_unittest.py
index 5ba7901..877ecfb 100755
--- a/test/py/ganeti.objects_unittest.py
+++ b/test/py/ganeti.objects_unittest.py
@@ -298,9 +298,9 @@ class TestInstance(unittest.TestCase):
     inst = objects.Instance(name="fakeinstplain.example.com",
       primary_node="node3.example.com",
       disks=[
-        objects.Disk(dev_type=constants.LD_LV, size=128,
+        objects.Disk(dev_type=constants.DT_PLAIN, size=128,
                      logical_id=("myxenvg", "disk25494")),
-        objects.Disk(dev_type=constants.LD_LV, size=512,
+        objects.Disk(dev_type=constants.DT_PLAIN, size=512,
                      logical_id=("myxenvg", "disk29071")),
         ])
 
@@ -315,13 +315,13 @@ class TestInstance(unittest.TestCase):
     inst = objects.Instance(name="fakeinstdrbd.example.com",
       primary_node="node10.example.com",
       disks=[
-        objects.Disk(dev_type=constants.LD_DRBD8, size=786432,
+        objects.Disk(dev_type=constants.DT_DRBD8, size=786432,
           logical_id=("node10.example.com", "node15.example.com",
                       12300, 0, 0, "secret"),
           children=[
-            objects.Disk(dev_type=constants.LD_LV, size=786432,
+            objects.Disk(dev_type=constants.DT_PLAIN, size=786432,
                          logical_id=("myxenvg", "disk0")),
-            objects.Disk(dev_type=constants.LD_LV, size=128,
+            objects.Disk(dev_type=constants.DT_PLAIN, size=128,
                          logical_id=("myxenvg", "meta0"))
           ],
           iv_name="disk/0")
@@ -368,7 +368,7 @@ class TestNode(unittest.TestCase):
 
   def testDiskState(self):
     node = objects.Node(name="node32087.example.com", disk_state={
-      constants.LD_LV: {
+      constants.DT_PLAIN: {
         "lv32352": objects.NodeDiskState(total=128),
         "lv2082": objects.NodeDiskState(total=512),
         },
@@ -381,14 +381,12 @@ class TestNode(unittest.TestCase):
 
     self.assertEqual(node2.name, "node32087.example.com")
     self.assertEqual(frozenset(node2.disk_state), frozenset([
-      constants.LD_LV,
+      constants.DT_PLAIN,
       ]))
-    self.assertEqual(frozenset(node2.disk_state[constants.LD_LV]), frozenset([
-      "lv32352",
-      "lv2082",
-      ]))
-    self.assertEqual(node2.disk_state[constants.LD_LV]["lv2082"].total, 512)
-    self.assertEqual(node2.disk_state[constants.LD_LV]["lv32352"].total, 128)
+    self.assertEqual(frozenset(node2.disk_state[constants.DT_PLAIN]),
+                     frozenset(["lv32352", "lv2082"]))
+    self.assertEqual(node2.disk_state[constants.DT_PLAIN]["lv2082"].total, 512)
+    self.assertEqual(node2.disk_state[constants.DT_PLAIN]["lv32352"].total, 128)
 
   def testFilterEsNdp(self):
     node1 = objects.Node(name="node11673.example.com", ndparams={
diff --git a/test/py/ganeti.rpc_unittest.py b/test/py/ganeti.rpc_unittest.py
index 670d555..38faa02 100755
--- a/test/py/ganeti.rpc_unittest.py
+++ b/test/py/ganeti.rpc_unittest.py
@@ -810,9 +810,9 @@ class TestRpcRunner(unittest.TestCase):
         ],
       disk_template=constants.DT_PLAIN,
       disks=[
-        objects.Disk(dev_type=constants.LD_LV, size=4096,
+        objects.Disk(dev_type=constants.DT_PLAIN, size=4096,
                      logical_id=("vg", "disk6120")),
-        objects.Disk(dev_type=constants.LD_LV, size=1024,
+        objects.Disk(dev_type=constants.DT_PLAIN, size=1024,
                      logical_id=("vg", "disk8508")),
         ])
     inst.UpgradeConfig()
@@ -882,12 +882,12 @@ class TestRpcRunner(unittest.TestCase):
       constants.HV_BOOT_ORDER: "xyz",
       })
     self.assertEqual(result["disks"], [{
-      "dev_type": constants.LD_LV,
+      "dev_type": constants.DT_PLAIN,
       "size": 4096,
       "logical_id": ("vg", "disk6120"),
       "params": constants.DISK_DT_DEFAULTS[inst.disk_template],
       }, {
-      "dev_type": constants.LD_LV,
+      "dev_type": constants.DT_PLAIN,
       "size": 1024,
       "logical_id": ("vg", "disk8508"),
       "params": constants.DISK_DT_DEFAULTS[inst.disk_template],
diff --git a/tools/cfgupgrade12 b/tools/cfgupgrade12
index fd70ee1..dd76ce9 100755
--- a/tools/cfgupgrade12
+++ b/tools/cfgupgrade12
@@ -263,7 +263,7 @@ def Disk12To20(drbd_minors, secrets, disk):
   """
   if "mode" not in disk:
     disk["mode"] = constants.DISK_RDWR
-  if disk["dev_type"] == constants.LD_DRBD8:
+  if disk["dev_type"] == constants.DT_DRBD8:
     old_lid = disk["logical_id"]
     for node in old_lid[:2]:
       if node not in drbd_minors:
diff --git a/tools/sanitize-config b/tools/sanitize-config
index 5c4668b..5556ffb 100755
--- a/tools/sanitize-config
+++ b/tools/sanitize-config
@@ -199,11 +199,11 @@ def SanitizeDisks(opts, cfg): # pylint: disable=W0613
       for child in disk["children"]:
         helper(child)
 
-    if disk["dev_type"] == constants.LD_DRBD8:
+    if disk["dev_type"] == constants.DT_DRBD8:
       if "physical_id" in disk:
         del disk["physical_id"]
 
-    if disk["dev_type"] == constants.LD_LV and opts.sanitize_lvs:
+    if disk["dev_type"] == constants.DT_PLAIN and opts.sanitize_lvs:
       disk["logical_id"][1] = _Get(disk["logical_id"][1])
       disk["physical_id"][1] = disk["logical_id"][1]
 
@@ -223,7 +223,7 @@ def RandomizeDiskSecrets(disk):
       RandomizeDiskSecrets(child)
 
   # only disk type to contain secrets is the drbd one
-  if disk["dev_type"] == constants.LD_DRBD8:
+  if disk["dev_type"] == constants.DT_DRBD8:
     disk["logical_id"][5] = utils.GenerateSecret()
 
 
@@ -236,7 +236,7 @@ def RenameDiskNodes(disk, node_map):
       RenameDiskNodes(child, node_map)
 
   # only disk type to contain nodes is the drbd one
-  if disk["dev_type"] == constants.LD_DRBD8:
+  if disk["dev_type"] == constants.DT_DRBD8:
     lid = disk["logical_id"]
     lid[0] = node_map[lid[0]]
     lid[1] = node_map[lid[1]]
