Commit Graph

26 Commits

Author SHA1 Message Date
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
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
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 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
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
Ryan Harper d85bb52a63 Finish enabling EFI boot mode
- Fix up issues with efi mode grub serial configuration
- Modify blockdev model to order storage configuration output
- Handle when we're running in uefi mode

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-09-22 22:19:54 -05:00
Ryan Harper fbee724441 Split out curtin configuration files
Break out curtin configuration data into multiple configuration files
This sets up our initial install (network +storage) and our secondary
run (postinstall user config).

- encrypt the users password and never log the original value

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>

Conflicts:
	subiquity/controllers/filesystem.py
2015-09-21 16:40:26 -05:00
Ryan Harper fbb8eb09fb Adjust partition alignment for GPT and curtin sgdisk
Curtin uses sgdisk to create partitions.  To avoid sgdisk
fixing alignment issues we ensure that all partitions are
1M aligned.

GPT partitions also require space at the end, reserve the
same number of sectors (1K, 2048 512b sectors) at the
start and end of the disk.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-09-01 17:01:07 -05: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 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
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 66ebf89944 Filter out the disk the installer is running from so curtin doesn't format the device during install preventing the reboot
Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-08-24 17:34:55 -05:00
Ryan Harper 0e05593897 Implement mountpoint checking
Don't let user pass the same mount twice.  TODO is to
include an error message widget and place the error
there instead of in the mountpoint widget value.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-08-21 13:49:45 -05:00
Ryan Harper dde90cd42d Implement auto-increment partition numbers
- Remove the (1-4) since GPT partition doesn't have a limit
- Calculate the lastpartition value and handle the case where
  we don't have any at first

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-08-21 13:36:19 -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
Ryan Harper d32abf0d93 Format filesystem table size as float value.
Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-08-21 11:43:18 -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
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