Commit a1c7ae2d authored by Krzysztof Karas's avatar Krzysztof Karas Committed by Tomasz Zawadzki
Browse files

bdev: remove generation of UUIDs for bdevs that do not provide one



Remove automatic generation of UUIDs for bdevs
that do not provide this value themselves.
This is to clarify whether this field can be
depended upon.

Modified match files to reflect change in UUID
generation.

Disabled nullglob shell option, as it deletes
empty arrays during word splitting. Bdevs with no
aliases would instead of "[]", have nullpointer
printed, which makes resulting JSON invalid.

Part of enhancement proposed in #2516.

Change-Id: Ic1d5f8f8d001ae1a219e876aef2a19b1ff0b2f2c
Signed-off-by: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15150


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
parent 8000cedb
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -6419,11 +6419,10 @@ bdev_register(struct spdk_bdev *bdev)
		return ret;
	}

	/* If the user didn't specify a uuid, generate one. */
	if (spdk_mem_all_zero(&bdev->uuid, sizeof(bdev->uuid))) {
		spdk_uuid_generate(&bdev->uuid);
	}

	/* UUID has to be specified by the user or defined by bdev itself.
	 * Otherwise this field must remain empty, to indicate that this
	 * value cannot be depended upon. */
	if (!spdk_mem_all_zero(&bdev->uuid, sizeof(bdev->uuid))) {
		/* Add the UUID alias only if it's different than the name */
		spdk_uuid_fmt_lower(uuid, sizeof(uuid), &bdev->uuid);
		if (strcmp(bdev->name, uuid) != 0) {
@@ -6435,6 +6434,7 @@ bdev_register(struct spdk_bdev *bdev)
				return ret;
			}
		}
	}

	if (spdk_bdev_get_buf_align(bdev) > 1) {
		if (bdev->split_on_optimal_io_boundary) {
+6 −1
Original line number Diff line number Diff line
@@ -5,7 +5,11 @@ rootdir=$(readlink -f $testdir/../..)
source $rootdir/test/common/autotest_common.sh
source $testdir/nbd_common.sh

shopt -s nullglob extglob
# nullglob will remove unmatched words containing '*', '?', '[' characters during word splitting.
# This means that empty alias arrays will be removed instead of printing "[]", which breaks
# consecutive "jq" calls, as the "aliases" key will have no value and the whole JSON will be
# invalid. Hence do not enable this option for the duration of the tests in this script.
shopt -s extglob

rpc_py=rpc_cmd
conf_file="$testdir/bdev.json"
@@ -626,6 +630,7 @@ CONF
bdevs=$("$rpc_py" bdev_get_bdevs | jq -r '.[] | select(.claimed == false)')
bdevs_name=$(echo $bdevs | jq -r '.name')
bdev_list=($bdevs_name)

hello_world_bdev=${bdev_list[0]}
trap - SIGINT SIGTERM EXIT
killprocess "$spdk_tgt_pid"
+1 −4
Original line number Diff line number Diff line
{
  "aliases": [
    "$(UUID)"
  ],
  "aliases": [],
  "assigned_rate_limits": {
    "r_mbytes_per_sec": $(N),
    "rw_ios_per_sec": $(N),
@@ -32,6 +30,5 @@
    "write": $(S),
    "write_zeroes": $(S)
  },
  "uuid": "$(S)",
  "zoned": false
}
+2 −2
Original line number Diff line number Diff line
o- pmemblk .............................................................................................................. [Bdevs: 2]
  o- pmem_bdev0 $(S) [$(UUID), Size=31.6M, Not claimed]
  o- pmem_bdev1 $(S) [$(UUID), Size=31.6M, Not claimed]
  o- pmem_bdev0 $(S) [Size=31.6M, Not claimed]
  o- pmem_bdev1 $(S) [Size=31.6M, Not claimed]
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ o- bdevs .......................................................................
  o- nvme ............................................................................................................... [Bdevs: 0]
  o- pmemblk ............................................................................................................ [Bdevs: 0]
  o- raid_volume ........................................................................................................ [Bdevs: 1]
  | o- testraid $(S) [$(UUID), Size=16.0M, Not claimed]
  | o- testraid $(S) [Size=16.0M, Not claimed]
  o- rbd ................................................................................................................ [Bdevs: 0]
  o- split_disk ......................................................................................................... [Bdevs: 0]
  o- virtioblk_disk ..................................................................................................... [Bdevs: 0]
Loading