Merge pull request #1591 from mwhudson/install-same-disk
allow autoinstalls to use the disk the installer booted from
This commit is contained in:
commit
18346e3f74
|
@ -1124,13 +1124,14 @@ class FilesystemModel(object):
|
||||||
if self._probe_data is not None:
|
if self._probe_data is not None:
|
||||||
self._orig_config = storage_config.extract_storage_config(
|
self._orig_config = storage_config.extract_storage_config(
|
||||||
self._probe_data)["storage"]["config"]
|
self._probe_data)["storage"]["config"]
|
||||||
self._actions = self._actions_from_config(
|
self._actions, self._exclusions = self._actions_from_config(
|
||||||
self._orig_config,
|
self._orig_config,
|
||||||
self._probe_data['blockdev'],
|
self._probe_data['blockdev'],
|
||||||
is_probe_data=True)
|
is_probe_data=True)
|
||||||
else:
|
else:
|
||||||
self._orig_config = []
|
self._orig_config = []
|
||||||
self._actions = []
|
self._actions = []
|
||||||
|
self._exclusions = set()
|
||||||
self.swap = None
|
self.swap = None
|
||||||
self.grub = None
|
self.grub = None
|
||||||
self.guided_configuration = None
|
self.guided_configuration = None
|
||||||
|
@ -1154,9 +1155,10 @@ class FilesystemModel(object):
|
||||||
'blockdev': status.blockdev,
|
'blockdev': status.blockdev,
|
||||||
'dasd': status.dasd,
|
'dasd': status.dasd,
|
||||||
}
|
}
|
||||||
self._actions = self._actions_from_config(
|
self._actions, self._exclusions = self._actions_from_config(
|
||||||
status.config,
|
status.config,
|
||||||
status.blockdev)
|
status.blockdev,
|
||||||
|
is_probe_data=False)
|
||||||
|
|
||||||
def _make_matchers(self, match):
|
def _make_matchers(self, match):
|
||||||
matchers = []
|
matchers = []
|
||||||
|
@ -1280,7 +1282,7 @@ class FilesystemModel(object):
|
||||||
disks.remove(disk)
|
disks.remove(disk)
|
||||||
action['path'] = disk.path
|
action['path'] = disk.path
|
||||||
action['serial'] = disk.serial
|
action['serial'] = disk.serial
|
||||||
self._actions = self._actions_from_config(
|
self._actions, self._exclusions = self._actions_from_config(
|
||||||
ai_config, self._probe_data['blockdev'], is_probe_data=False)
|
ai_config, self._probe_data['blockdev'], is_probe_data=False)
|
||||||
|
|
||||||
self.assign_omitted_offsets()
|
self.assign_omitted_offsets()
|
||||||
|
@ -1324,7 +1326,7 @@ class FilesystemModel(object):
|
||||||
else:
|
else:
|
||||||
p.size = dehumanize_size(p.size)
|
p.size = dehumanize_size(p.size)
|
||||||
|
|
||||||
def _actions_from_config(self, config, blockdevs, is_probe_data=False):
|
def _actions_from_config(self, config, blockdevs, *, is_probe_data):
|
||||||
"""Convert curtin storage config into action instances.
|
"""Convert curtin storage config into action instances.
|
||||||
|
|
||||||
curtin represents storage "actions" as defined in
|
curtin represents storage "actions" as defined in
|
||||||
|
@ -1399,8 +1401,6 @@ class FilesystemModel(object):
|
||||||
|
|
||||||
log.debug("exclusions %s", {e.id for e in exclusions})
|
log.debug("exclusions %s", {e.id for e in exclusions})
|
||||||
|
|
||||||
objs = [o for o in objs if o not in exclusions]
|
|
||||||
|
|
||||||
if is_probe_data:
|
if is_probe_data:
|
||||||
for o in objs:
|
for o in objs:
|
||||||
if o.type == "partition" and o.flag == "swap":
|
if o.type == "partition" and o.flag == "swap":
|
||||||
|
@ -1408,7 +1408,7 @@ class FilesystemModel(object):
|
||||||
objs.append(Filesystem(
|
objs.append(Filesystem(
|
||||||
m=self, fstype="swap", volume=o, preserve=True))
|
m=self, fstype="swap", volume=o, preserve=True))
|
||||||
|
|
||||||
return objs
|
return objs, exclusions
|
||||||
|
|
||||||
def _render_actions(self,
|
def _render_actions(self,
|
||||||
mode: ActionRenderMode = ActionRenderMode.DEFAULT):
|
mode: ActionRenderMode = ActionRenderMode.DEFAULT):
|
||||||
|
@ -1466,7 +1466,7 @@ class FilesystemModel(object):
|
||||||
log.debug('mountpoints %s', mountpoints)
|
log.debug('mountpoints %s', mountpoints)
|
||||||
|
|
||||||
if mode == ActionRenderMode.ALL:
|
if mode == ActionRenderMode.ALL:
|
||||||
work = list(self._actions)
|
work = [a for a in self._actions if a not in self._exclusions]
|
||||||
else:
|
else:
|
||||||
work = [
|
work = [
|
||||||
a for a in self._actions if not getattr(a, 'preserve', False)
|
a for a in self._actions if not getattr(a, 'preserve', False)
|
||||||
|
|
|
@ -428,8 +428,10 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
|
||||||
|
|
||||||
async def POST(self, config: list):
|
async def POST(self, config: list):
|
||||||
log.debug(config)
|
log.debug(config)
|
||||||
self.model._actions = self.model._actions_from_config(
|
self.model._actions, self.model._exclusions = \
|
||||||
config, self.model._probe_data['blockdev'], is_probe_data=False)
|
self.model._actions_from_config(
|
||||||
|
config, self.model._probe_data['blockdev'],
|
||||||
|
is_probe_data=False)
|
||||||
await self.configured()
|
await self.configured()
|
||||||
|
|
||||||
def potential_boot_disks(self, check_boot=True, with_reformatting=False):
|
def potential_boot_disks(self, check_boot=True, with_reformatting=False):
|
||||||
|
@ -453,7 +455,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
|
||||||
if can_be_boot:
|
if can_be_boot:
|
||||||
continue
|
continue
|
||||||
disks.append(disk)
|
disks.append(disk)
|
||||||
return disks
|
return [d for d in disks if d not in self.model._exclusions]
|
||||||
|
|
||||||
async def guided_GET(self, wait: bool = False) -> GuidedStorageResponse:
|
async def guided_GET(self, wait: bool = False) -> GuidedStorageResponse:
|
||||||
probe_resp = await self._probe_response(wait, GuidedStorageResponse)
|
probe_resp = await self._probe_response(wait, GuidedStorageResponse)
|
||||||
|
@ -641,7 +643,9 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
|
||||||
probe_resp = await self._probe_response(wait, StorageResponseV2)
|
probe_resp = await self._probe_response(wait, StorageResponseV2)
|
||||||
if probe_resp is not None:
|
if probe_resp is not None:
|
||||||
return probe_resp
|
return probe_resp
|
||||||
disks = model._all(type='disk')
|
disks = [
|
||||||
|
d for d in model._all(type='disk') if d not in model._exclusions
|
||||||
|
]
|
||||||
minsize = self.calculate_suggested_install_min()
|
minsize = self.calculate_suggested_install_min()
|
||||||
return StorageResponseV2(
|
return StorageResponseV2(
|
||||||
status=ProbeStatus.DONE,
|
status=ProbeStatus.DONE,
|
||||||
|
|
Loading…
Reference in New Issue