commit
9636b7a9ef
|
@ -20,6 +20,17 @@ 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
|
||||
- obj: [interface name bond10]
|
||||
action: DELETE
|
||||
- action: create-bond
|
||||
data:
|
||||
name: bond10
|
||||
devices:
|
||||
- [interface index 0]
|
||||
- action: done
|
||||
Proxy:
|
||||
proxy: ""
|
||||
|
|
|
@ -18,6 +18,7 @@ import json
|
|||
import logging
|
||||
import os
|
||||
import select
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
import pyudev
|
||||
|
@ -140,7 +141,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)
|
||||
|
@ -175,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')
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -86,16 +89,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
|
||||
|
||||
|
@ -151,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)))
|
||||
|
@ -179,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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue