Skip to content

Commit

Permalink
SCALE: ignore wholedisk
Browse files Browse the repository at this point in the history
We never want to partition vdevs automatically from ZFS in SCALE.

Ignore the wholedisk flag in SCALE and skip the tests that expect
auto partitioning to work.

Signed-off-by: Ryan Moeller <[email protected]>
  • Loading branch information
Ryan Moeller authored and ixhamza committed Jun 21, 2023
1 parent f4efe4e commit 6115cf6
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 3 deletions.
8 changes: 6 additions & 2 deletions cmd/zed/agents/zfs_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
(void) nvlist_lookup_string(vdev, ZPOOL_CONFIG_PHYS_PATH, &physpath);
(void) nvlist_lookup_string(vdev, ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH,
&enc_sysfs_path);
#ifndef TRUENAS_SCALE_NEVER_WHOLEDISK
(void) nvlist_lookup_uint64(vdev, ZPOOL_CONFIG_WHOLE_DISK, &wholedisk);
#endif
(void) nvlist_lookup_uint64(vdev, ZPOOL_CONFIG_OFFLINE, &offline);
(void) nvlist_lookup_uint64(vdev, ZPOOL_CONFIG_FAULTED, &faulted);

Expand Down Expand Up @@ -979,7 +981,9 @@ vdev_whole_disk_from_config(zpool_handle_t *zhp, const char *vdev_path)
if (!nvl)
return (0);

#ifndef TRUENAS_SCALE_NEVER_WHOLEDISK
(void) nvlist_lookup_uint64(nvl, ZPOOL_CONFIG_WHOLE_DISK, &wholedisk);
#endif

return (wholedisk);
}
Expand Down Expand Up @@ -1027,10 +1031,10 @@ zfsdle_vdev_online(zpool_handle_t *zhp, void *data)
zpool_close(zhp);
return (0);
}

#ifndef TRUENAS_SCALE_NEVER_WHOLEDISK
(void) nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_WHOLE_DISK,
&wholedisk);

#endif
if (wholedisk) {
char *tmp;
path = strrchr(path, '/');
Expand Down
6 changes: 6 additions & 0 deletions cmd/zpool/zpool_vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -976,8 +976,12 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv)
* magic value left by the previous filesystem.
*/
verify(!nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path));
#ifdef TRUENAS_SCALE_NEVER_WHOLEDISK
wholedisk = B_FALSE;
#else
verify(!nvlist_lookup_uint64(nv, ZPOOL_CONFIG_WHOLE_DISK,
&wholedisk));
#endif

if (!wholedisk) {
/*
Expand Down Expand Up @@ -1122,9 +1126,11 @@ is_device_in_use(nvlist_t *config, nvlist_t *nv, boolean_t force,
&child, &children) != 0) {

verify(!nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path));
#ifndef TRUENAS_SCALE_NEVER_WHOLEDISK
if (strcmp(type, VDEV_TYPE_DISK) == 0)
verify(!nvlist_lookup_uint64(nv,
ZPOOL_CONFIG_WHOLE_DISK, &wholedisk));
#endif

/*
* As a generic check, we look to see if this is a replace of a
Expand Down
6 changes: 6 additions & 0 deletions config/Rules.am
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ AM_CPPFLAGS += -DPKGDATADIR=\"$(pkgdatadir)\"
AM_CPPFLAGS += $(DEBUG_CPPFLAGS)
AM_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS)
AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-@ac_system_l@-user\"
if BUILD_LINUX
# NAS-118236: Vdevs from CORE are labeled with whole_disk=1, but we did not
# create the partition table in ZFS and must not repartition them. We know
# SCALE never creates wholedisk vdevs, so just ignore the config.
AM_CPPFLAGS += -DTRUENAS_SCALE_NEVER_WHOLEDISK
endif

AM_CPPFLAGS_NOCHECK = -D"strtok(...)=strtok(__VA_ARGS__) __attribute__((deprecated(\"Use strtok_r(3) instead!\")))"
AM_CPPFLAGS_NOCHECK += -D"__xpg_basename(...)=__xpg_basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))"
Expand Down
5 changes: 4 additions & 1 deletion lib/libzfs/libzfs_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -3141,8 +3141,10 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *path, int flags,
nvlist_lookup_string(tgt, ZPOOL_CONFIG_PATH, &pathname) == 0) {
uint64_t wholedisk = 0;

#ifndef TRUENAS_SCALE_NEVER_WHOLEDISK
(void) nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_WHOLE_DISK,
&wholedisk);
#endif

/*
* XXX - L2ARC 1.0 devices can't support expansion.
Expand Down Expand Up @@ -4228,7 +4230,7 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv,
!(name_flags & VDEV_NAME_PATH)) {
path = zfs_strip_path(path);
}

#ifndef TRUENAS_SCALE_NEVER_WHOLEDISK
/*
* Remove the partition from the path if this is a whole disk.
*/
Expand All @@ -4237,6 +4239,7 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv,
== 0 && value && !(name_flags & VDEV_NAME_PATH)) {
return (zfs_strip_partition(path));
}
#endif
} else {
path = type;

Expand Down
6 changes: 6 additions & 0 deletions lib/libzfs/os/linux/libzfs_pool_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ zpool_relabel_disk(libzfs_handle_t *hdl, const char *path, const char *msg)
return (0);
}

#ifndef TRUENAS_SCALE_NEVER_WHOLEDISK
/*
* Read the EFI label from the config, if a label does not exist then
* pass back the error to the caller. If the caller has passed a non-NULL
Expand Down Expand Up @@ -118,6 +119,7 @@ read_efi_label(nvlist_t *config, diskaddr_t *sb)
}
return (err);
}
#endif

/*
* determine where a partition starts on a disk in the current
Expand All @@ -126,6 +128,9 @@ read_efi_label(nvlist_t *config, diskaddr_t *sb)
static diskaddr_t
find_start_block(nvlist_t *config)
{
#ifdef TRUENAS_SCALE_NEVER_WHOLEDISK
(void) config;
#else
nvlist_t **child;
uint_t c, children;
diskaddr_t sb = MAXOFFSET_T;
Expand All @@ -149,6 +154,7 @@ find_start_block(nvlist_t *config)
return (sb);
}
}
#endif
return (MAXOFFSET_T);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@

verify_runnable "global"

log_unsupported "SKIP because auto partitioning removed for SCALE"

function cleanup
{
poolexists $TESTPOOL1 && destroy_pool $TESTPOOL1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

verify_runnable "global"

log_unsupported "SKIP because auto partitioning removed for SCALE"

function cleanup
{
log_must zinject -c all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
verify_runnable "both"

if is_linux; then
log_unsupported "SKIP because auto partitioning removed for SCALE"
# Add one 512b scsi_debug device (4Kn would generate IO errors)
# NOTE: must be larger than other "file" vdevs and minimum SPA devsize:
# add 32m of fudge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@

verify_runnable "both"

log_unsupported "SKIP because auto partitioning removed for SCALE"

if ! is_physical_device $DISKS; then
log_unsupported "Unsupported disks for this test."
fi
Expand Down

0 comments on commit 6115cf6

Please sign in to comment.