]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
nvme: add uuid parameter to _create_nvmet_subsystem
authorJohannes Thumshirn <jthumshirn@suse.de>
Tue, 24 Apr 2018 16:12:50 +0000 (10:12 -0600)
committerOmar Sandoval <osandov@fb.com>
Wed, 25 Apr 2018 03:41:18 +0000 (20:41 -0700)
Add an optional UUID parameter to _create_nvmet_subsystem().

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
common/nvme

index 506612f2729759dfe9c542537b580f0fa8acecc0..73bbfe9626435e171df721a7ac5486ab99d99eef 100644 (file)
@@ -46,13 +46,19 @@ _remove_nvmet_port() {
 _create_nvmet_subsystem() {
        local nvmet_subsystem="$1"
        local blkdev="$2"
+       local uuid="00000000-0000-0000-0000-000000000000"
        local nvmet_cfs="/sys/kernel/config/nvmet/"
        local cfs_path="${nvmet_cfs}/subsystems/${nvmet_subsystem}"
 
+       if [[ $# -eq 3 ]]; then
+               uuid="$3"
+       fi
+
        mkdir -p "${cfs_path}"
        echo 1 > "${cfs_path}/attr_allow_any_host"
        mkdir "${cfs_path}/namespaces/1"
        printf "%s" "$blkdev" > "${cfs_path}/namespaces/1/device_path"
+       printf "%s" "$uuid" > "${cfs_path}/namespaces/1/device_uuid"
        printf 1 > "${cfs_path}/namespaces/1/enable"
 }