filesystem: pass _netdev option for mounts on remote storage
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
parent
c3de13d10c
commit
376131b04d
|
@ -42,7 +42,9 @@ class FilesystemManipulator:
|
||||||
def create_mount(self, fs, spec):
|
def create_mount(self, fs, spec):
|
||||||
if spec.get("mount") is None:
|
if spec.get("mount") is None:
|
||||||
return
|
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():
|
if self.model.needs_bootloader_partition():
|
||||||
vol = fs.volume
|
vol = fs.volume
|
||||||
if vol.type == "partition" and boot.can_be_boot_device(vol.device):
|
if vol.type == "partition" and boot.can_be_boot_device(vol.device):
|
||||||
|
@ -240,6 +242,9 @@ class FilesystemManipulator:
|
||||||
def partition_disk_handler(self, disk, spec, *, partition=None, gap=None):
|
def partition_disk_handler(self, disk, spec, *, partition=None, gap=None):
|
||||||
log.debug("partition_disk_handler: %s %s %s %s", disk, spec, partition, gap)
|
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 partition is not None:
|
||||||
if "size" in spec and spec["size"] != partition.size:
|
if "size" in spec and spec["size"] != partition.size:
|
||||||
trailing, gap_size = gaps.movable_trailing_partitions_and_gap_size(
|
trailing, gap_size = gaps.movable_trailing_partitions_and_gap_size(
|
||||||
|
@ -294,6 +299,9 @@ class FilesystemManipulator:
|
||||||
|
|
||||||
log.debug("logical_volume_handler: %s %s %s", vg, lv, spec)
|
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 lv is not None:
|
||||||
if "name" in spec:
|
if "name" in spec:
|
||||||
lv.name = spec["name"]
|
lv.name = spec["name"]
|
||||||
|
|
|
@ -2166,10 +2166,13 @@ class FilesystemModel:
|
||||||
raise Exception("can only remove unmounted filesystem")
|
raise Exception("can only remove unmounted filesystem")
|
||||||
self._remove(fs)
|
self._remove(fs)
|
||||||
|
|
||||||
def add_mount(self, fs, path):
|
def add_mount(self, fs, path, *, on_remote_storage=False):
|
||||||
if fs._mount is not None:
|
if fs._mount is not None:
|
||||||
raise Exception(f"{fs} is already mounted")
|
raise Exception(f"{fs} is already mounted")
|
||||||
m = Mount(m=self, device=fs, path=path)
|
options = None
|
||||||
|
if on_remote_storage:
|
||||||
|
options = "defaults,_netdev"
|
||||||
|
m = Mount(m=self, device=fs, path=path, options=options)
|
||||||
self._actions.append(m)
|
self._actions.append(m)
|
||||||
return m
|
return m
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue