Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zpool state module needs support for disk vdev #34762 #34770

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion salt/modules/zpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ def create(zpool, *vdevs, **kwargs):
# make sure files are present on filesystem
ret[zpool] = {}
for vdev in vdevs:
if vdev not in ['mirror', 'log', 'cache', 'raidz1', 'raidz2', 'raidz3', 'spare']:
if vdev not in ['disk', 'mirror', 'log', 'cache', 'raidz1', 'raidz2', 'raidz3', 'spare']:
if not os.path.exists(vdev):
ret[zpool][vdev] = 'not present on filesystem'
continue
Expand Down
11 changes: 7 additions & 4 deletions salt/states/zpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def present(name, properties=None, filesystem_properties=None, layout=None, conf
layout_result = {}
for root_dev in layout:
if '-' in root_dev:
if root_dev.split('-')[0] not in ['mirror', 'log', 'cache', 'raidz1', 'raidz2', 'raidz3', 'spare']:
if root_dev.split('-')[0] not in ['disk', 'mirror', 'log', 'cache', 'raidz1', 'raidz2', 'raidz3', 'spare']:
layout_valid = False
layout_result[root_dev] = 'not a valid vdev type'
layout[root_dev] = layout[root_dev].keys() if isinstance(layout[root_dev], OrderedDict) else layout[root_dev].split(' ')
Expand Down Expand Up @@ -267,9 +267,12 @@ def present(name, properties=None, filesystem_properties=None, layout=None, conf
params.append(name)
for root_dev in layout:
if '-' in root_dev: # special device
params.append(root_dev.split('-')[0]) # add the type by stripping the ID
if root_dev.split('-')[0] in ['mirror', 'log', 'cache', 'raidz1', 'raidz2', 'raidz3', 'spare']:
for sub_dev in layout[root_dev]: # add all sub devices
sub_devs = layout[root_dev]
root_dev = root_dev.split('-')[0]
if root_dev in ['disk', 'mirror', 'log', 'cache', 'raidz1', 'raidz2', 'raidz3', 'spare']:
if root_dev not in ('disk', 'file'):
params.append(root_dev)
for sub_dev in sub_devs: # add all sub devices
if '/' not in sub_dev and config['device_dir'] and os.path.exists(config['device_dir']):
sub_dev = os.path.join(config['device_dir'], sub_dev)
params.append(sub_dev)
Expand Down