forked from coreos/fedora-coreos-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add
nvme-symlink
test to verify GCP udev rules
Force this test to not run by default unless named specifically or `--tag confidential` is passed to `kola run`, also requires `--gcp-machinetype n2d-standard-2 --gcp-confidential-vm --gcp-localssd=NVME` It will create confidential instance on GCP with 1 nvme persistent disk and 1 local ssd disk, then check the new udev rules make effect. See coreos/fedora-coreos-tracker#1457
- Loading branch information
1 parent
0e3d1db
commit cbb46d8
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../data/commonlib.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
## kola: | ||
## description: Verify new GCP udev rules work well on confidential instance. | ||
## exclusive: false | ||
## platforms: gcp | ||
## requiredTag: confidential | ||
|
||
# See https://issues.redhat.com/browse/OCPBUGS-7582 | ||
# https://github.com/coreos/fedora-coreos-tracker/issues/1457 | ||
# | ||
# Force this test to not run by default unless named specifically | ||
# or `--tag confidential` is passed to `kola run`, also requires | ||
# `--gcp-machinetype n2d-standard-2 --gcp-confidential-vm --gcp-localssd=NVME` | ||
# | ||
# It will create confidential instance on GCP with 1 nvme persistent disk | ||
# and 1 local ssd disk, then check the new udev rules make effect. | ||
|
||
set -xeuo pipefail | ||
|
||
. $KOLA_EXT_DATA/commonlib.sh | ||
|
||
# check nvme device | ||
has_nvme() { | ||
local nvme_info=$(nvme list-subsys -o json || true) | ||
local nvme_disk=$(jq -r ".[].Subsystems[].Paths[] | select(.Name == \"${disk}\").Name" <<< "$nvme_info") | ||
if [ -n "${nvme_disk}" ]; then | ||
if [ ! -e "${device}" ]; then | ||
fatal "instance has nvme device but no ${disk} accessible" | ||
fi | ||
fi | ||
} | ||
|
||
# check symlink | ||
check_symlink() { | ||
local tmpfile=$(mktemp) | ||
/usr/lib/udev/google_nvme_id -d "${device}" > ${tmpfile} | ||
source ${tmpfile} | ||
if [ ! -n ${ID_SERIAL_SHORT:-} ]; then | ||
fatal "can not get nvme ${device} ID_SERIAL_SHORT" | ||
fi | ||
|
||
local link="/dev/disk/by-id/google-${ID_SERIAL_SHORT}" | ||
if ! ls -l "${link}"; then | ||
fatal "can not find ${device} symlink ${link}" | ||
fi | ||
} | ||
|
||
for disk in nvme0 nvme1; do | ||
device="/dev/${disk}n1" | ||
has_nvme | ||
check_symlink | ||
ok "Find ${device} symlink" | ||
done |