improve offset and size handling in disk config format

Bug #1477754 reported by Scott Moser
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
curtin
Triaged
Medium
Unassigned

Bug Description

in looking at disk format information provided to curtin, i had some improvements i wanted:

http://paste.ubuntu.com/10939715/
^^ working from that.

offset:
 if 'offset' is present, it can be
   * human friendly unit (5M, 1G). these will be converted to bytes
   * integer : read as bytes
   * <name>+<number>
     name is a reference to an other entry 'id'
     here, number can be friendly (5M) or integer

  curtin quickly converts the provided input, converting 'offset' to bytes.

 if offset is not present, then the offset is assumed to be the end
 of the previous partition on that device in the list.

 if offset is not present for the *first* partition in the list, then it is assumed to be 1M. This allows users to basically specify sizes only and get sane behavior (while possibly wasting 1M).

  given:
    - {id: sda1, device: sda, offset: 1M, size: 10M}
    - {id: sda2, device: sda, size: +}
  result:
    - {id: sda1, device: sda, offset: 1M, size: 10M}
    - {id: sda2, device: sda, offset: 11M, size: <device-size - 11M>}

  given:
    - {id: x0, device: sda, size: 1M}
    - {id: x2, device: sda, size: 2M}
  result:
    - {id: x1, device: sda, offset: 1M, size: 1M}
    - {id: x2, device: sda, offset: 2M, size: 2M}

  A more complete and valid format is
    - {id: sda1, device: sda, offset: 1M, size: 10M, partition_id: 1}
    - {id: sda3, device: sda, offset: 511M, 1M, size: 10M, partition_id: 3}
    - {id: sda2, device: sda, offset: 11M, size: 400M, partition_id: 2}

partition_id:
  a.) ordered interpretation
      if 'partition_id' is not present it will be determined by order in the
      list for any partition on that device.
      given:
        - id: sda3
          device: sda
        - id: sda1 [gets partition_id=2]
      the result is;
        - {id: sda3, device: sda, partition_id: 1}
        - {id: sda1, device: sda, partition_id: 2}

      We do not do string based interpretation on ids. ie, the name 'sda2'
      does *not* imply the partition should be numbered 2.

  b.) if present it will be used, but must be present for all entries for a
      given device (this is just simplification to avoid having to check for
      a specified partition id that is not correct given ordered
      interpretatition)

      valid:
       - {id: sda1, device: sda, partition_id: 1}
       - {id: sda2, device: sda, partition_id: 2}

      valid and equal to above:
       - {id: sda1, device: sda}
       - {id: sda2, device: sda}

      error:
       - {id: sda1, device: sda, partition_id: 1}
       - {id: sda2, device: sda}

Tags: maas storage
tags: added: maas storage
Changed in curtin:
status: New → Triaged
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.