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

Nvme o tcp poc #1884

Merged
merged 9 commits into from Feb 9, 2024
58 changes: 58 additions & 0 deletions examples/answers/nvme-over-tcp.yaml
@@ -0,0 +1,58 @@
#machine-config: examples/machines/nvme-over-tcp.json
Source:
source: ubuntu-server
Welcome:
lang: en_US
Refresh:
update: no
Keyboard:
layout: us
Network:
accept-default: yes
Proxy:
proxy: ""
Mirror:
mirror: "http://fr.archive.ubuntu.com"
Filesystem:
# 1. Reformat both disks
# 2. Create the root filesystem on disk 0 (which is a local disk)
# 3. Create the /home filesystem on disk 1 (which is a remote disk)
manual:
- obj: [disk index 0]
action: REFORMAT
- obj: [disk index 1]
action: REFORMAT
- obj: [disk index 0]
action: PARTITION
data:
fstype: ext4
mount: /
- obj: [disk index 1]
action: PARTITION
data:
fstype: ext4
mount: /home
- action: done
Identity:
realname: Ubuntu
username: ubuntu
hostname: ubuntu-server
# ubuntu
password: '$6$wdAcoXrU039hKYPd$508Qvbe7ObUnxoj15DRCkzC3qO7edjH0VV7BPNRDYK4QR8ofJaEEF2heacn0QgD.f8pO8SNp83XNdWG6tocBM1'
UbuntuPro:
token: ""
SSH:
install_server: true
pwauth: false
authorized_keys:
- |
ssh-rsa AAAAAAAAAAAAAAAAAAAAAAAAA # ssh-import-id lp:subiquity
SnapList:
snaps:
hello:
channel: stable
classic: false
InstallProgress:
reboot: yes
Drivers:
install: no
84 changes: 84 additions & 0 deletions examples/machines/imsm.json
Expand Up @@ -1580,6 +1580,90 @@
}
]
},
"nvme": {
"nvme0": {
"DEVNAME": "/dev/nvme0",
"DEVPATH": "/devices/pci0000:b2/0000:b2:05.5/pci10000:00/10000:00:02.0/10000:01:00.0/nvme/nvme0",
"MAJOR": "238",
"MINOR": "0",
"NVME_TRTYPE": "pcie",
"SUBSYSTEM": "nvme",
"attrs": {
"address": "0000:b2:05.5",
"cntlid": "5",
"cntrltype": "io",
"dctype": "none",
"dev": "238:0",
"device": null,
"firmware_rev": "A3550012",
"hmb": "1",
"kato": "0",
"model": "A400 NVMe SanDisk 256GB",
"numa_node": "0",
"power/async": "disabled",
"power/autosuspend_delay_ms": null,
"power/control": "auto",
"power/pm_qos_latency_tolerance_us": "100000",
"power/runtime_active_kids": "0",
"power/runtime_active_time": "0",
"power/runtime_enabled": "disabled",
"power/runtime_status": "unsupported",
"power/runtime_suspended_time": "0",
"power/runtime_usage": "0",
"queue_count": "9",
"rescan_controller": null,
"reset_controller": null,
"serial": "171877421152",
"sqsize": "1023",
"state": "live",
"subsysnqn": "nqn.1994-11.com.sandisk:nvme:A400M.2:171877421152",
"subsystem": "nvme",
"transport": "pcie",
"uevent": "MAJOR=238\nMINOR=0\nDEVNAME=nvme0\nNVME_TRTYPE=pcie"
}
},
"nvme1": {
"DEVNAME": "/dev/nvme1",
"DEVPATH": "/devices/pci0000:b2/0000:b2:05.5/pci10000:00/10000:00:03.0/10000:02:00.0/nvme/nvme1/nvme1n1",
"MAJOR": "238",
"MINOR": "0",
"NVME_TRTYPE": "pcie",
"SUBSYSTEM": "nvme",
"attrs": {
"address": "0000:b2:05.5",
"cntlid": "5",
"cntrltype": "io",
"dctype": "none",
"dev": "238:0",
"device": null,
"firmware_rev": "A3550012",
"hmb": "1",
"kato": "0",
"model": "A400 NVMe SanDisk 256GB",
"numa_node": "0",
"power/async": "disabled",
"power/autosuspend_delay_ms": null,
"power/control": "auto",
"power/pm_qos_latency_tolerance_us": "100000",
"power/runtime_active_kids": "0",
"power/runtime_active_time": "0",
"power/runtime_enabled": "disabled",
"power/runtime_status": "unsupported",
"power/runtime_suspended_time": "0",
"power/runtime_usage": "0",
"queue_count": "9",
"rescan_controller": null,
"reset_controller": null,
"serial": "171877424191",
"sqsize": "1023",
"state": "live",
"subsysnqn": "nqn.1994-11.com.sandisk:nvme:A400M.2:171877424191",
"subsystem": "nvme",
"transport": "pcie",
"uevent": "MAJOR=238\nMINOR=0\nDEVNAME=nvme0\nNVME_TRTYPE=pcie"
}
}
},
"raid": {
"/dev/md126": {
"DEVLINKS": "/dev/disk/by-id/md-uuid-ac4bee3d:2607dd80:76f9390f:f2d72638 /dev/md/subvol",
Expand Down
43 changes: 43 additions & 0 deletions examples/machines/lp-1986676-missing-osprober.json
Expand Up @@ -2872,6 +2872,49 @@
}
}
},
"nvme": {
"nvme0": {
"DEVNAME": "/dev/nvme0",
"DEVPATH": "/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/nvme/nvme0/",
"MAJOR": "238",
"MINOR": "0",
"NVME_TRTYPE": "pcie",
"SUBSYSTEM": "nvme",
"attrs": {
"address": "0000:00:1c.0",
"cntlid": "5",
"cntrltype": "io",
"dctype": "none",
"dev": "238:0",
"device": null,
"firmware_rev": "S2681102",
"hmb": "1",
"kato": "0",
"model": "KINGSTON SKC2000M8250G",
"numa_node": "0",
"power/async": "disabled",
"power/autosuspend_delay_ms": null,
"power/control": "auto",
"power/pm_qos_latency_tolerance_us": "100000",
"power/runtime_active_kids": "0",
"power/runtime_active_time": "0",
"power/runtime_enabled": "disabled",
"power/runtime_status": "unsupported",
"power/runtime_suspended_time": "0",
"power/runtime_usage": "0",
"queue_count": "9",
"rescan_controller": null,
"reset_controller": null,
"serial": "50026B72823D1475",
"sqsize": "1023",
"state": "live",
"subsysnqn": "nqn.1994-11.com.kingston:nvme:SK2000M82560GM.2:50026B72823D1475",
"subsystem": "nvme",
"transport": "pcie",
"uevent": "MAJOR=238\nMINOR=0\nDEVNAME=nvme0\nNVME_TRTYPE=pcie"
}
}
},
"dmcrypt": {},
"dasd": {},
"zfs": {
Expand Down
2 changes: 1 addition & 1 deletion snapcraft.yaml
Expand Up @@ -70,7 +70,7 @@ parts:

source: https://git.launchpad.net/curtin
source-type: git
source-commit: a349105809af6188cb394e300a99846df3d117f0
source-commit: 237053d9d18916dd72cf861280474d4df0e9fd24

override-pull: |
craftctl default
Expand Down
11 changes: 8 additions & 3 deletions subiquity/client/controllers/filesystem.py
Expand Up @@ -193,7 +193,10 @@ def _action_clean_level(self, level):
return raidlevels_by_value[level]

async def _answers_action(self, action):
from subiquity.ui.views.filesystem.delete import ConfirmDeleteStretchy
from subiquity.ui.views.filesystem.delete import (
ConfirmDeleteStretchy,
ConfirmReformatStretchy,
)
from subiquitycore.ui.stretchy import StretchyOverlay

log.debug("_answers_action %r", action)
Expand All @@ -214,9 +217,11 @@ async def _answers_action(self, action):
body = self.ui.body._w
if not isinstance(body, StretchyOverlay):
return
if isinstance(body.stretchy, ConfirmDeleteStretchy):
if isinstance(
body.stretchy, (ConfirmDeleteStretchy, ConfirmReformatStretchy)
):
if action.get("submit", True):
body.stretchy.done()
body.stretchy.confirm()
else:
async for _ in self._enter_form_data(
body.stretchy.form, action["data"], action.get("submit", True)
Expand Down
4 changes: 4 additions & 0 deletions subiquity/common/filesystem/boot.py
Expand Up @@ -336,6 +336,8 @@ def can_be_boot_device(device, *, resize_partition=None, with_reformatting=False

@can_be_boot_device.register(Disk)
def _can_be_boot_device_disk(disk, *, resize_partition=None, with_reformatting=False):
if disk.on_remote_storage():
return False
if with_reformatting:
disk = disk._reformatted()
plan = get_boot_device_plan(disk, resize_partition=resize_partition)
Expand All @@ -344,6 +346,8 @@ def _can_be_boot_device_disk(disk, *, resize_partition=None, with_reformatting=F

@can_be_boot_device.register(Raid)
def _can_be_boot_device_raid(raid, *, resize_partition=None, with_reformatting=False):
if raid.on_remote_storage():
return False
bl = raid._m.bootloader
if bl != Bootloader.UEFI:
return False
Expand Down
9 changes: 8 additions & 1 deletion subiquity/common/filesystem/labels.py
Expand Up @@ -117,6 +117,13 @@ def desc(device):
def _desc_disk(disk):
if disk.multipath:
return _("multipath device")
if disk.on_remote_storage():
if disk.nvme_controller is not None and disk.nvme_controller.transport == "tcp":
return _("NVMe/TCP drive")
# At time of writing, only NVMe/TCP drives will report as "remote".
# Let's set a default label for potential transports that we may
# support in the future.
return _("remote drive")
return _("local disk")


Expand Down Expand Up @@ -318,7 +325,7 @@ def _for_client_disk(disk, *, min_size=0):
partitions=[for_client(p) for p in gaps.parts_and_gaps(disk)],
boot_device=boot.is_boot_device(disk),
can_be_boot_device=boot.can_be_boot_device(disk),
ok_for_guided=disk.size >= min_size,
ok_for_guided=disk.size >= min_size and not disk.on_remote_storage(),
model=getattr(disk, "model", None),
vendor=getattr(disk, "vendor", None),
has_in_use_partition=disk._has_in_use_partition,
Expand Down
10 changes: 9 additions & 1 deletion subiquity/common/filesystem/manipulator.py
Expand Up @@ -42,7 +42,9 @@ class FilesystemManipulator:
def create_mount(self, fs, spec):
if spec.get("mount") is None:
return
mount = self.model.add_mount(fs, spec["mount"])
mount = self.model.add_mount(
fs, spec["mount"], on_remote_storage=spec.get("on-remote-storage", False)
)
if self.model.needs_bootloader_partition():
vol = fs.volume
if vol.type == "partition" and boot.can_be_boot_device(vol.device):
Expand Down Expand Up @@ -240,6 +242,9 @@ def can_resize_partition(self, partition):
def partition_disk_handler(self, disk, spec, *, partition=None, gap=None):
log.debug("partition_disk_handler: %s %s %s %s", disk, spec, partition, gap)

if disk.on_remote_storage():
spec["on-remote-storage"] = True

if partition is not None:
if "size" in spec and spec["size"] != partition.size:
trailing, gap_size = gaps.movable_trailing_partitions_and_gap_size(
Expand Down Expand Up @@ -294,6 +299,9 @@ def logical_volume_handler(self, vg, spec, *, partition, gap):

log.debug("logical_volume_handler: %s %s %s", vg, lv, spec)

if vg.on_remote_storage():
spec["on-remote-storage"] = True

if lv is not None:
if "name" in spec:
lv.name = spec["name"]
Expand Down