Skip to content

Commit

Permalink
feat(disk_setup): Add support for nvme devices (#5263)
Browse files Browse the repository at this point in the history
Fixes GH-5246
  • Loading branch information
holmanb committed May 30, 2024
1 parent 461fc1d commit 4df6416
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cloudinit/config/cc_disk_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import logging
import os
import shlex
from pathlib import Path
from textwrap import dedent

from cloudinit import subp, util
Expand Down Expand Up @@ -908,7 +909,15 @@ def mkfs(fs_cfg):
if not partition or partition.isdigit():
# Handle manual definition of partition
if partition.isdigit():
# nvme support
# https://github.com/torvalds/linux/blob/45db3ab/block/partitions
# /core.c#L330
if device[-1].isdigit():
device = f"{device}p"
device = "%s%s" % (device, partition)
if not Path(device).is_block_device():
LOG.warning("Path %s does not exist or is not a block device")
return
LOG.debug(
"Manual request of partition %s for %s", partition, device
)
Expand Down

0 comments on commit 4df6416

Please sign in to comment.