def _DetachDisk(self, idx, root, _):
    hotmsg = ""
    if self.op.hotplug:
      hotmsg = self._HotplugDevice(constants.HOTPLUG_ACTION_REMOVE,
                                   constants.HOTPLUG_TARGET_DISK,
                                   root, None, idx)

    # Always shutdown the disk before detaching.
    ShutdownInstanceDisks(self, self.instance, [root])

    # Rename detached disk.
    #
    # Transform logical_id from:
    #   <file_storage_dir>/<instance_name>/<disk_name>
    # to
    #   <file_storage_dir>/<disk_name>
    if root.dev_type in (constants.DT_FILE, constants.DT_SHARED_FILE):
      file_driver = root.logical_id[0]
      instance_path, disk_name = os.path.split(root.logical_id[1])
      new_path = os.path.join(os.path.dirname(instance_path), disk_name)
      new_logical_id = (file_driver, new_path)
      result = self.rpc.call_blockdev_rename(self.instance.primary_node,
                                             [(root, new_logical_id)])
      result.Raise("Failed before detach")
      # Update logical_id
      self.cfg.SetDiskLogicalID(root.uuid, new_logical_id)

    # Remove disk from config
    self.cfg.DetachInstanceDisk(self.instance.uuid, root.uuid)

    # re-read the instance from the configuration
    self.instance = self.cfg.GetInstanceInfo(self.instance.uuid)

    return hotmsg
When there is a a dataset in the ``ATTACHED_TO_DEAD_NODE`` state,
dataset/ETHPy150Open ganeti/ganeti/lib/cmdlib/instance_set_params.py/LUInstanceSetParams._DetachDisk--crossover with--dataset/ETHPy150Open ClusterHQ/flocker/flocker/node/agents/test/test_blockdevice.py/BlockDeviceDeployerLocalStateTests.test_attached_to_dead_node_dataset