From 293cb187a61337505af8da1aba1e28a3ca273de8 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Fri, 20 Mar 2020 08:41:20 +1300 Subject: [PATCH 1/7] fix formatting an unformatted, pre-existing raid --- subiquity/models/filesystem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subiquity/models/filesystem.py b/subiquity/models/filesystem.py index 82b0928d..b1e446bc 100644 --- a/subiquity/models/filesystem.py +++ b/subiquity/models/filesystem.py @@ -528,7 +528,7 @@ class _Formattable(ABC): if action['type'] == 'format' and action['volume'] == self.id: return action['fstype'] for action in self._m._orig_config: - if action['id'] == self.id and action['flag'] == 'swap': + if action['id'] == self.id and action.get('flag') == 'swap': return 'swap' return None From 0967777a2dd3b5116bcc5affda0e7d75006dd1f6 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Fri, 20 Mar 2020 08:44:03 +1300 Subject: [PATCH 2/7] increase block probe timeout Seeing a few error reports with this timing out and they look sort of real from the logs. Maybe probing is slow just after startup when so much other stuff is going on? Let's just increase the timeout and see if they go away. --- subiquity/controllers/filesystem.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subiquity/controllers/filesystem.py b/subiquity/controllers/filesystem.py index 3cddbdd1..bd83a57e 100644 --- a/subiquity/controllers/filesystem.py +++ b/subiquity/controllers/filesystem.py @@ -140,7 +140,8 @@ class FilesystemController(SubiquityController): # We wait on the task directly here, not # self._probe_once_task.wait as if _probe_once_task # gets cancelled, we should be cancelled too. - await asyncio.wait_for(self._probe_once_task.task, 5.0) + await asyncio.wait_for( + self._probe_once_task.task, 15.0) except Exception: block_discover_log.exception( "block probing failed restricted=%s", restricted) From ac587f9bf66589d9ea3f113ff3b314b3c010729d Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Fri, 20 Mar 2020 08:52:54 +1300 Subject: [PATCH 3/7] remove /target after unmounting it --- subiquity/controllers/filesystem.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/subiquity/controllers/filesystem.py b/subiquity/controllers/filesystem.py index bd83a57e..1f53c638 100644 --- a/subiquity/controllers/filesystem.py +++ b/subiquity/controllers/filesystem.py @@ -18,6 +18,7 @@ import json import logging import os import select +import shutil import sys import pyudev @@ -176,6 +177,8 @@ class FilesystemController(SubiquityController): if self.opts.dry_run: cmd = ['sleep', "0.2"] await arun_command(cmd) + if not self.opts.dry_run: + shutil.rmtree(self.app.base_model.target) context = pyudev.Context() self._monitor = pyudev.Monitor.from_netlink(context) self._monitor.filter_by(subsystem='block') From cc52bb62a50ba891dfea746c7ac4369d71252918 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Fri, 20 Mar 2020 09:01:30 +1300 Subject: [PATCH 4/7] fix enabling dhcp on a virtual interface --- examples/answers-bond.yaml | 4 ++++ subiquitycore/controllers/network.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/answers-bond.yaml b/examples/answers-bond.yaml index 5356bf32..756a8ab1 100644 --- a/examples/answers-bond.yaml +++ b/examples/answers-bond.yaml @@ -20,6 +20,10 @@ Network: subnet: "10.2.0.0/24" address: 10.2.0.1 searchdomains: lab + - obj: [interface name bond10] + action: EDIT_IPV4 + method-data: + method: dhcp - action: done Proxy: proxy: "" diff --git a/subiquitycore/controllers/network.py b/subiquitycore/controllers/network.py index 36b69260..2a171073 100644 --- a/subiquitycore/controllers/network.py +++ b/subiquitycore/controllers/network.py @@ -67,7 +67,8 @@ class SubiquityNetworkEventReceiver(NetworkEventReceiver): netdev = self.model.update_link(ifindex) if netdev is None: return - if not (netdev.info.flags & IFF_UP) and ifindex in self.default_routes: + flags = getattr(netdev.info, "flags", 0) + if not (flags & IFF_UP) and ifindex in self.default_routes: self.default_routes.remove(ifindex) for watcher in self.default_route_watchers: watcher(self.default_routes) From 3856a11186a3e5e45a868821b298caa390766461 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Fri, 20 Mar 2020 09:07:17 +1300 Subject: [PATCH 5/7] fix deleting virtual network devices --- examples/answers-bond.yaml | 7 +++++++ subiquitycore/ui/views/network.py | 21 +++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/examples/answers-bond.yaml b/examples/answers-bond.yaml index 756a8ab1..115b8f5a 100644 --- a/examples/answers-bond.yaml +++ b/examples/answers-bond.yaml @@ -24,6 +24,13 @@ Network: action: EDIT_IPV4 method-data: method: dhcp + - obj: [interface name bond10] + action: DELETE + - action: create-bond + data: + name: bond10 + devices: + - [interface index 0] - action: done Proxy: proxy: "" diff --git a/subiquitycore/ui/views/network.py b/subiquitycore/ui/views/network.py index c54c81f9..f9146732 100644 --- a/subiquitycore/ui/views/network.py +++ b/subiquitycore/ui/views/network.py @@ -129,16 +129,17 @@ class NetworkView(BaseView): _action_EDIT_BOND = _stretchy_shower(BondStretchy) _action_ADD_VLAN = _stretchy_shower(AddVlanStretchy) - def _action_DELETE(self, device): - touched_devs = set() - if device.type == "bond": - for name in device.config['interfaces']: - touched_devs.add(self.model.get_netdev_by_name(name)) - device.config = None - self.del_link(device) - for dev in touched_devs: - self.update_link(dev) - self.controller.apply_config() + def _action_DELETE(self, name, device): + with self.controller.context.child(name): + touched_devs = set() + if device.type == "bond": + for name in device.config['interfaces']: + touched_devs.add(self.model.get_netdev_by_name(name)) + device.config = None + self.del_link(device) + for dev in touched_devs: + self.update_link(dev) + self.controller.apply_config() def _action(self, sender, action, device): action, meth = action From 470be04f460e0b607b5dd7ca1114dbf672e6d124 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Fri, 20 Mar 2020 10:12:48 +1300 Subject: [PATCH 6/7] don't offer tiny disks for the guided options --- subiquity/ui/views/filesystem/guided.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/subiquity/ui/views/filesystem/guided.py b/subiquity/ui/views/filesystem/guided.py index dceb71fb..54950f9a 100644 --- a/subiquity/ui/views/filesystem/guided.py +++ b/subiquity/ui/views/filesystem/guided.py @@ -86,16 +86,22 @@ class GuidedChoiceForm(SubForm): super().__init__(parent) options = [] tables = [] + initial = -1 for disk in parent.model.all_disks(): for obj, cells in summarize_device(disk): table = TablePile([TableRow(cells)]) tables.append(table) - options.append(Option((table, obj is disk, obj))) + enabled = False + if obj is disk and disk.size > 6*(2**30): + enabled = True + if initial < 0: + initial = len(options) + options.append(Option((table, enabled, obj))) t0 = tables[0] for t in tables[1:]: t0.bind(t) self.disk.widget.options = options - self.disk.widget.index = 0 + self.disk.widget.index = initial connect_signal(self.use_lvm.widget, 'change', self._toggle) self.lvm_options.enabled = self.use_lvm.value From 31ce375a1d5613c90e9e1537ad29ea50422b7366 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Fri, 20 Mar 2020 10:25:27 +1300 Subject: [PATCH 7/7] display messages when no big disks and no disks are found probably could do with wordsmithing but better than crashing --- subiquity/ui/views/filesystem/guided.py | 48 ++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/subiquity/ui/views/filesystem/guided.py b/subiquity/ui/views/filesystem/guided.py index 54950f9a..a5779e63 100644 --- a/subiquity/ui/views/filesystem/guided.py +++ b/subiquity/ui/views/filesystem/guided.py @@ -17,6 +17,7 @@ import logging from urwid import ( connect_signal, + Text, ) from subiquitycore.ui.form import ( @@ -30,6 +31,7 @@ from subiquitycore.ui.form import ( SubForm, SubFormField, ) +from subiquitycore.ui.buttons import other_btn from subiquitycore.ui.selector import Option from subiquitycore.ui.table import ( TablePile, @@ -37,6 +39,7 @@ from subiquitycore.ui.table import ( ) from subiquitycore.ui.utils import ( rewrap, + screen, ) from subiquitycore.view import BaseView @@ -157,19 +160,51 @@ at /. """) +no_big_disks = _(""" +Block probing did not discover any disks big enough to support guided storage +configuration. Manual configuration may still be possible. +""") + + +no_disks = _(""" +Block probing did not discover any disks. Unfortunately this means that +installation will not be possible. +""") + + class GuidedDiskSelectionView (BaseView): title = _("Guided storage configuration") def __init__(self, controller): self.controller = controller - self.form = GuidedForm(model=controller.model) - connect_signal(self.form, 'submit', self.done) - connect_signal(self.form, 'cancel', self.cancel) + found_disk = False + found_ok_disk = False + for disk in controller.model.all_disks(): + found_disk = True + if disk.size > 6*(2**30): + found_ok_disk = True + break - super().__init__( - self.form.as_screen(focus_buttons=False, excerpt=_(subtitle))) + if found_ok_disk: + self.form = GuidedForm(model=controller.model) + + connect_signal(self.form, 'submit', self.done) + connect_signal(self.form, 'cancel', self.cancel) + + super().__init__( + self.form.as_screen(focus_buttons=False, excerpt=_(subtitle))) + elif found_disk: + super().__init__( + screen( + [Text(_(rewrap(no_big_disks)))], + [other_btn(_("OK"), on_press=self.manual)])) + else: + super().__init__( + screen( + [Text(_(rewrap(no_disks)))], + [])) def local_help(self): return (_("Help on guided storage configuration"), rewrap(_(HELP))) @@ -185,5 +220,8 @@ class GuidedDiskSelectionView (BaseView): self.controller.guided_direct(disk) self.controller.manual() + def manual(self, sender): + self.controller.manual() + def cancel(self, btn=None): self.controller.cancel()