Commit Graph

45 Commits

Author SHA1 Message Date
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 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
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
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 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
Ryan Harper f5aff668c5 Don't display mounted disks except during dry-run
Enhance our mounted disk detection. Don't display these
devices unless we're in dry-run mode.  Add support for
the case where we don't have any disks and prevent
the installer from progressing.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-09-28 11:28:26 -05:00
Adam Stokes ec60674b9a Comment out some menu items
For alpha release we comment out the menu items
that are not yet supported by curtin.

Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
2015-09-24 08:53:15 -04:00
Adam Stokes 2ff52fdaec Add disk info view
Adds ability to view disk information via hdparm
if run as root, otherwise, will print error to
the ui (ie. permission denied.)

As a result updated the run_command routine
to be a little more robust.

Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
2015-09-02 15:21:14 -04:00
Ryan Harper 7ff3f549c2 Fix partition size selection and logging
- Fix max size partition edge case
- Ensure if nothing is entered we select the max size
- Adjust offset and size calculations for actions

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-09-01 11:28:23 -05:00
Ryan Harper d3b7189328 Fix issue with partition size inputs and units
There was a mismatch between what human size units we accepted
and what we matched for in the view validator.  Fix that by
ensuring all places use the HUMAN_BYTES variable, including building
the multiplier from the listed HUMAN_BYTES.

Also drop the use of mixed case for the units, now all size units
must be capital (B, K, M, G, T, P) etc.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-08-28 15:30:34 -05:00
Ryan Harper 8a0e9ebdfd Add new cli option to read machine probe data from file
Allow user to specify a probert machine configuration file to be
used during the installer.  If presented with the config file
no probing of the host will occur.

In the case that disks don't have a size in the data collected then
they'll be marked as USED.

Add a few example machines and update the README on how to specify.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-08-28 13:22:29 -05:00
Adam Stokes 0100ed708c Merge pull request #29 from CanonicalLtd/fix_add_partition_default_values
Valid partition size input on AddPartition View
2015-08-28 09:40:03 -04:00
Ryan Harper a16c301eed Drop python3-parted use
Using parted required root privileges since it opened the underlying device.
Instead create our own Disk model and use sysfs interface for extracting
size information.
This also clears the way for providing device data via probert input.  This
means we can feed subiquity a probert dump and have it present that to
the installer UI even if we're running on a different system.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-08-27 14:26:37 -05:00
Ryan Harper ba3b97f9d8 Valid partition size input on AddPartition View
- Ensure we don't explode on input for partition size
- Don't append error messages to input fields as it
  can DOS the input boxes.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-08-25 11:49:27 -05:00
Ryan Harper dce4bcf7aa Fix Filesystem and AddPartition Views
- Remove the error when converting sizes between input and initial value
  there is a rounding error in the floating point convertion when
  passing values between humanize() and dehumanize().
- Fix the error when using the full size of the disk as the first
  partition and not accounting for the GPT bios size
- Implement percentage used in Filesystem Views
- Consolidate on unit keywords (single char only)
- use humanize() to append the correct unit size, remove all
  hard-coded sizes when fetching size
- fix bug in calculating total disk size by only asking for the
  largest available partition from parted.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-08-21 13:07:42 -05:00
Adam Stokes 10a1c76d8f Revert organization
The previous organization was in place to reduce the number of open
files when working on getting the demo into shape. Since we've completed
the demo revert back to our MVC model incorporating the latest changes
that were made during that time leading up to the demo.

Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
2015-08-10 09:42:19 -04:00
Adam Stokes f429372d3c refactor controller code and signal handling
Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
2015-07-21 11:55:02 -04:00
Adam Stokes f2cc6edb12 Add partition controller/views
Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
2015-07-16 20:06:13 -04:00
Adam Stokes aa8623bebc extend the signal support, add disk paritition view
Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
2015-07-16 17:58:32 -04:00
Adam Stokes 095f2f84da Add start of DiskPartition model and controller
Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
2015-07-13 13:45:48 -04:00
Adam Stokes 4539a22bbc Sort list of available disks
Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
2015-07-13 10:17:53 -04:00
Ryan Harper cfffcf34e4 Implement parted device model for handling partition building
Partial implementation using parted to model new partitions.
Add a method to track sequential actions taken against block
device and can write out a storage config file for curtin.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-07-10 15:58:25 -05:00
Ryan Harper 47540e6bf2 Switch storage module logging to debug and json format
The logging data generated during storage probing is
hard to read, so instead, dump the data out via json.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-07-06 15:52:48 -05:00
Ryan Harper 2b06bdc1da Call curtin to complete install
- Use updated probert *Info class for accessing object data
- Add --dry-run parameter to prevent invoking curtin when testing
- Add new make target to run ui-view by default with --dry-run
- Use a template to write out curtin config file for installation
- Use virtio disks and multiple nics to test probing.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-07-06 12:34:24 -05:00
Adam Stokes c6572f4663 Update filesystem view pane
Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
2015-07-01 17:20:17 -04:00
Adam Stokes 37527abd60 render existing partition devices
Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
2015-06-30 16:08:16 -04:00
Ryan Harper 8902942fc0 Fix storage size
Disk attributes are in sector size, so scale by 512.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-06-25 21:54:03 -05:00
Ryan Harper 4418c94521 Fix up lint and errors in filesystems
Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-06-25 21:22:49 -05:00
Ryan Harper fa80b0cabe Add probert to subiquity
Update subiquity welcome controller to call probert to extract
host information and present it to the user briefly before
invokin the curtin installer.

Add the install_src to git clone probert.  Pack this as a tarball
in the user-data like subiquity.

Update user-data package installs for new probert deps.

Modify boot parameters to handle systemd persistent nic naming;
we may not always have eth0 as a nic.  Subsequently update
user-data to use bootcmd to automatically attempt to bring up
nics during the boot before the installer.

Finally fix commandline parsing/output in geninstaller.
Implement version parameter and better caching of previous
maas ephemeral images.

Fix issue with removing cache after unpacking rootfs which is
now owned by root (add sudo to rm of cache).

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-06-25 21:12:42 -05:00
Adam Stokes dcb0337fdc additional models
Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
2015-06-22 16:34:37 -04:00