示例#1
0
    def _PrepareInstanceRootFsBdev(cls, storage_path, stash):
        """Return mountable path for storage_path.

    This function creates a partition mapping for storage_path and returns the
    first partition device path as a rootfs partition, and stashes the loopback
    device path.
    If storage_path is not a multi-partition block device, just return
    storage_path.

    """
        try:
            ret = utils.CreateBdevPartitionMapping(storage_path)
        except errors.CommandError, err:
            raise HypervisorError("Failed to create partition mapping for %s"
                                  ": %s" % (storage_path, err))
示例#2
0
    def _PrepareInstanceRootFsBdev(cls, storage_path, stash):
        """Return mountable path for storage_path.

    This function creates a partition mapping for storage_path and returns the
    first partition device path as a rootfs partition, and stashes the loopback
    device path.
    If storage_path is not a multi-partition block device, just return
    storage_path.

    """
        try:
            ret = utils.CreateBdevPartitionMapping(storage_path)
        except errors.CommandError as err:
            raise HypervisorError("Failed to create partition mapping for %s"
                                  ": %s" % (storage_path, err))

        if ret is None:
            return storage_path
        else:
            loop_dev_path, dm_dev_paths = ret
            stash[cls._STASH_KEY_ALLOCATED_LOOP_DEV] = loop_dev_path
            return dm_dev_paths[0]