Commit Graph

112 Commits

Author SHA1 Message Date
Ryan Harper 13c06bd5c1 Update identity UX
- Model inputs after Ubiquity layout
- Add Servername (hostname)
- Add SSH ID import (import from launchpad or github)
- Include information under important fields
- Drop old/unused hostname MVC files

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-20 16:00:10 -06:00
Ryan Harper 9872bdfb94 Don't display partition menu options if not allow
- Skip add_partition entry for bcache, raid, and lvm devices
- Don't display Format entire partition if it's already been formated

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-19 18:31:30 -06:00
Ryan Harper 35c5a0b279 Protect mountpoint from relative paths and duplicate pathsep
Use os.path.realpath() to clean up any path manipulations

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-19 16:28:36 -06:00
Ryan Harper 83554513e1 Add Blockdev tags to indicate device usage
Allow installer to tag devices with purpose for display
in USED DISKS in the filesystem view.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-17 16:12:45 -06:00
Ryan Harper 71e2706455 Allow multiple backing devices per cache device
- Add backing/cache properties to Bcachedev class
- Add filesystem model method for listing bcache cache devices
- Update bcache view
  - Allow bcache cache devices to always be listed
  - Don't display existing bcache devices

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-17 15:02:23 -06:00
Ryan Harper e3d8f9003a Rework async curtin install commands
Return to spawning curtin in two stages, and include additional
signals and flags to control when we spawn the postinstall
config operation.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-16 14:59:59 -06:00
Ryan Harper 75a3171d57 Fix up blockdev holder support to mark raid and bcache holders
Fixing this prevents devices that are part of a bcache from being
presented as available.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-13 13:42:36 -06:00
Ryan Harper 0385e754ab Initial working bcache UX connected to fs model
Panel up and adds a bcache device.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-13 12:29:18 -06:00
Ryan Harper d786676366 Line up usage of BcacheAction, Bcachedev and model
Ensure they all use backing_dev, cache_dev parameter ordering
Added properties to BcacheAction for involved devices

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-13 10:59:38 -06:00
Ryan Harper 040382ac21 Implment add_bcache_device to filesystem model
Very similiar to adding a raid device, bcache has
fewer inputs and calculations.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-13 10:27:57 -06:00
Ryan Harper e2d9ea0f50 Update BcacheAction object
Add __eq__ method and use action_id as parameter.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-13 10:10:33 -06:00
Ryan Harper bd31dea5c6 Fix lint in actions.py
make check missed when fixing wiping superblock by default

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-11 09:34:20 -06:00
Ryan Harper 6f0a7cbbbb NetAction should initialize params and subnets
We initialized params and subnets to empty lists.
Params is expected to be a dictionary while subnets
is a list.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-11 08:36:52 -06:00
Ryan Harper cca4ff1fbe Always wipe disks by default
Update DiskAction to defaulting to wipe the superblock

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-10 22:49:34 -06:00
Ryan Harper cebce4db6c Fix add-raid-dev signal
Rework of the menu signals broke add-raid-dev by mapping a
menu signal to a completion signal.  Revert add-raid-dev back
to non-menu signal to fix.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-10 22:32:59 -06:00
Ryan Harper 408cdbfb71 Add initial bonding UX panels and model connections
We now have a bonding UX panel, modeled after the raid menu
where we have a list of interfaces and a radiobox for
selecting the bond mode.  This calls into the network
model to add the bond interface.

- Update the network view to only display the Bond option if we have
more than one interface that is available (ie, not already part of
a bond).
- Also update the bond info to include the bond interface composition
in the hardware info such that it displays according to spec
- Add iface_is_bonded_slave to model
- Update network model info dict to include bond_{slave,master}.  This
helps us display the (Bonded) attribute for slaves, but not the primary
bond iface.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-09 15:34:43 -06:00
Ryan Harper 1ab56772b4 Fix network view for setting default route
- Spec calls for a list of gateway ips followed by a list of interfaces
  which are associated to be displayed
- Use updated model.set_default_gateway() method
- Add Default gateway status message to Network View
- Ensure that manually assigned gateways are displayed in the set default
  route view by extracting the 'gateway' value from the subnets in
  the Networkdev object.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-06 13:38:21 -06:00
Ryan Harper 1788d89557 Update manual network config ux to use network model objects
- Use get_interface method to obtain and Networkdev object
and interact with this.  Validates {add,remove}_subnet methods
on Networkdev objects.
- Add method in model for setting and validating gateway values

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-06 09:52:05 -06:00
Ryan Harper a164fffad7 Overhaul networkin model and networking actions
The network model wasn't not prepared to allow manual configuration
to affect the state such that after manual configuration the view
would be able to extract the current state of a network device
config.  Reuse the Blockdev model as Networkdev as well as encapsulating
the use of the action objects as a means of storting the current
configuration.

Adjust the views to use the updated model.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-06 09:19:44 -06:00
Ryan Harper 5086b00263 Fetch manual configuration
Collect and apply manual ipv4 interface configuration and update
the model.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-04 09:50:58 -06:00
Ryan Harper c6b3298f84 Clean up network configure interface view
- Call into model to extract interface info to populate view
- Clearly display two modes, ipv4 and v6
- Change button style, ideally we'd make a new one that doesn't indent by two
  chars
- Disabled ipv6 button for now

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-03 16:57:27 -06:00
Ryan Harper 4e0ae6a44e Refactor signals to improve navigation
Implement a stack-based signal class to push and pop menu levels
Switch navigation signals to use 'menu:' for filtering
Ensure all view classes subclass from ViewPolicy for common keypress

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-03 09:03:16 -06:00
Adam Stokes 0702ac9c95 Merge pull request #115 from CanonicalLtd/hide_raid_menu_as_needed
Hide raid menu as needed
2015-11-02 19:50:30 -05:00
Adam Stokes 6caf75b990 Merge pull request #116 from CanonicalLtd/run_flake8_via_python3
Run flake8 via python3
2015-11-02 19:50:17 -05:00
Ryan Harper 1dbd8f52c8 Complete flake8 fix across the tree
Now that we're using python3 flake8, let's fix all of those issues!

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-02 16:48:37 -06:00
Ryan Harper f7f817bab5 models:filesystem reset devices and info blocks
When we create virtual deviecs (raid, lvm and bcache)
we store constructed info dictionaries; these must be
removed when we reset the model state.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-02 15:19:50 -06:00
Adam Stokes be8b4d53b7 Merge pull request #114 from CanonicalLtd/fix-show-disk-info
Fix show-disk-info from breaking on devices without a bus
2015-11-02 14:44:35 -05:00
Ryan Harper 57be9d82b9 Fix show-disk-info from breaking on devices without a bus
When fixing show-disk-info on virtio devices, a thinko when
indexing the info structure caused issues when looking at
a secondary clause in a compound statement.  Fix this by
extracting the value via a .get and checking.
- Also include a probert dump of a virtio-based cloud image
for testing with virtio devices.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-02 13:39:09 -06:00
Ryan Harper 55203050f3 Impose PATH_MAX on mountpoint
Don't allow very long paths.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-02 12:06:51 -06:00
Ryan Harper 43fd6034bb Consolidate mountpoint validation
- Move mountpoint validation into the model for re-use now that
we have two users of it (AddFormat, AddPartition).
- Use Exceptions to pass back the error message to be updated on
the widget.
- Fix issue with repeated checking of the mountpoint which would
grow the error message continually.
- Fix issue with selected device indexing.  This was missed due to
a misspelling of the signal it emitted and accidently behaved as
we expected.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-11-02 11:43:33 -06:00
Ryan Harper 09c337b012 Fix blockdev mount ordering
Ensure that the / mount point is always first
but returning an explict value (0) for / mount action.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-27 10:12:28 -05:00
Ryan Harper d048b58811 Fix install when using raid devices
RAID devices require special handling since they cannot be partitioned.
Adjust the blockdev model to accomodate this.
Fix sorting of our actions to handle proper ordering when using RAID devices
Implement whole-disk formatting view and controller
Update cloud-init configuration to ensure repeated runs of installer work

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-27 10:12:28 -05:00
Adam Stokes a93f6b8f33 Merge pull request #98 from CanonicalLtd/fix_div_by_zero
Fix div by zero in blockdev available check
2015-10-26 12:26:31 -04:00
Ryan Harper 0b3170bae8 Fix div by zero in blockdev available check
Some blockdevices make report a size of zero; don't
explode when calculating percent free.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-26 10:37:01 -05:00
Adam Stokes f03665e67d add hostname view
Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
2015-10-26 10:50:06 -04:00
raharper e442350213 Merge pull request #93 from CanonicalLtd/fix-disk-info-root-privs
Don't require root for disk info
2015-10-26 08:34:05 -05:00
Ryan Harper da166e6dd1 Implement ErrorView
When we encounter an error before we invoke curtin, emit
a new signal, filesystem:error and present an error
UI for the user and return them to main, from there they
can quit.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-22 16:12:59 -05:00
Ryan Harper 03f8e1d438 Don't require root for disk info
The spec calls for invoking hdparm -i on the device, but not all of our
devices will display hdparm data (virtual, ceph, or other such devices).
Additionally the bulk if the data in hdparm itself is not really useful
in helping users identify a specific device.  Instead, display a short
set of helpful info about the device:
  - /dev/XXXX
  - Vendor
  - Model
  - Serial
  - Size (in human-readable and bytes)
  - devpath (/devices/XXXX)
  - rotational (true or false)

The current UX requires us to select another disk after returning to
the list, with this patch though we enable switching between the
available disks via 'n' and 'p', or 'j' and 'k', which will be switched
to 'tab' and 'shift tab'.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-21 16:53:25 -05:00
Adam Stokes 4d8f113b10 Merge pull request #90 from CanonicalLtd/disk-no-serial-fallback-path
Use storage path if disks don't have valid serial numbers
2015-10-21 10:34:44 -04:00
Ryan Harper b5bea5110f Use storage path if disks don't have valid serial numbers
Some disk devices (virtio) don't have serial numbers by default.
This breaks curtin which requires a serial or a path to uniquely
find the target disks.  Add a fallback to device path if the
current device includes the eye catcher 'Unknown Serial' which
is set by probert for devices that do not have a serial number.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-21 09:28:51 -05:00
Ryan Harper f60759d4ab unittest: fsm:bootable,installable
- Unittests for bootable and installable
- Fix not bootable, missing False return

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-09 08:57:38 -05:00
Ryan Harper 525ae944b6 Go ahead and sort the partition list
We were using sorted but not storing the result. Do so now.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-09 08:57:38 -05:00
Ryan Harper c652650e1c unittest: add tests, filesystemmodel, blockdev
- add blockdev tests on available_partitions
- fix type issue in Disk.partition OrderedDict keys, always use integers
- Add __repr__ for Disk related Actions
- Fix issue with available partition logic, ensure we and them together
- Filter out 'leave unformatted' fstype, set to None as needed.
- Whitespace cleanup in unittests
- add fsm test on get_partitions

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-09 08:57:38 -05:00
Ryan Harper c6e1f547df Add equality for Actions, Disks and Blockdev classes
Unittest on filesystem model require equality methods for
the various storage classes.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-09 08:57:38 -05:00
Ryan Harper ed2f427ac9 Blockdev and unit test cleanups
- Use nosetests3 to call unit tests
- Ensure all Actions use the 'type' property
- Implement remaining Blockdev unit tests

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-09 08:57:38 -05:00
Ryan Harper bc34835918 Add tests/__init__.py and add new blockdev partition tests
Forgot to add __init__.py in tests subdir to make module.
Add a few blockdev partition tests and fixes for their issues.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-09 08:57:38 -05:00
Ryan Harper 7f3fc15426 Fix handling of empty disks and partitions for raid menu
mdadm supports using whole disks and empty partitions.
Update model to define empty disks and empty partitions.
This allows one to construct a raid, and then use that raid
to construct further raid (raid0 multiple raid1s).

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-09 08:57:38 -05:00
Ryan Harper f02c5e49f9 Don't allow multiple devices to be bootable
- Update filesystem model to check if we have an existing device
that's marked bootable.
- Update look at all disk mount points, not just the current one

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-09 08:57:38 -05:00
Ryan Harper eddc55faa0 First cut on raid ux and model integration
Introduce a new Raiddev class to hold raid virtual device.
Add RaidAction to emit correct storage config
Tested with raid level 0 only.
Not sure if we can allow partitioning of raid devices.  Documentation
says it can be done but curtin will need to 'make it correctly'.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-09 08:57:37 -05:00
Adam Stokes 7ecda311cd Dont dump pyyaml syntax
Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
2015-10-08 20:13:37 -04:00