Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Allow /dev devices for NVMe SSD's and vagrant disks #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ can be provisioned with 'Slot 01/Slot 12' which directly correlates with slot na
found in sysfs. The two addressing modes can be used interchangably thus
configuration like 'Slot 01/2:0:0:0' is permissible.

Finally, /dev device names can be used when needed, though they should
not be used for physical SATA/SAS disks running on metal. This handles
problems such as NVMe PCIe SSD's (which do not have SCSI addresses)
and differences in assigned disk SCSI addresses between vagrant providers.
Thus a physical disk with an NVMe journal can be provisioned with
'0:0:0:1/nvme0n1', and a vagrant second disk can be 'sdb/sdb' to ensure
it would work in either VirtualBox or VMware.

## Setup

### Setup Requirements
Expand Down
6 changes: 4 additions & 2 deletions lib/puppet/provider/osd/ceph_disk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ def enclosure_slot_to_dev(slot)

# Redirect the request to the correct SCSI backend
# Params:
# +indetifier+:: SCSI address or enclosure slot number
# +identifier+:: SCSI address, enclosure slot number, or /dev device name
def identifier_to_dev(identifier)
if identifier.start_with?('Slot')
enclosure_slot_to_dev(identifier)
else
elsif identifier =~ /^\d+:\d+:\d+:\d+/
scsi_address_to_dev(identifier)
else
identifier
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/type/osd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
newparam(:name) do
desc 'OSD and journal SCSI addresses which can be specified as "H:B:T:L" for direct attached or "Slot 01" for expander devices'
validate do |value|
unless value =~ /^(\d+:\d+:\d+:\d+|Slot \d{2})\/(\d+:\d+:\d+:\d+|Slot \d{2})$/
unless value =~ /^(\d+:\d+:\d+:\d+|Slot \d{2}|sd[a-z]+|nvme)\/(\d+:\d+:\d+:\d+|Slot \d{2}|sd[a-z]+|nvme.+)$/
raise ArgumentError, 'osd::name invalid'
end
end
Expand Down