Merge lp:~daniel-thewatkins/cloud-init/lp1460715 into lp:~cloud-init-dev/cloud-init/trunk
| Status: | Merged |
|---|---|
| Merge reported by: | Scott Moser |
| Merged at revision: | not available |
| Proposed branch: | lp:~daniel-thewatkins/cloud-init/lp1460715 |
| Merge into: | lp:~cloud-init-dev/cloud-init/trunk |
| Diff against target: |
135 lines (+76/-8) 2 files modified
cloudinit/config/cc_disk_setup.py (+8/-8) tests/unittests/test_handler/test_handler_disk_setup.py (+68/-0) |
| To merge this branch: | bzr merge lp:~daniel-thewatkins/cloud-init/lp1460715 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Server Team CI bot | continuous-integration | Needs Fixing on 2016-07-22 | |
| cloud-init commiters | 2015-10-19 | Pending | |
|
Review via email:
|
|||
Commit Message
[cc_disk_setup] Use sectors to resize MBR disks
The version of sfdisk in wily (and onwards) only accepts sectors as a valid disk size. As such, this refactors the MBR code path in cc_disk_setup to use sectors.
Description of the Change
X-CPC-Summary-Skip: 1
| Scott Moser (smoser) wrote : | # |
| Scott Moser (smoser) wrote : | # |
Dan and I discussed some and both of us were not sure if sfdisk's sectors were physical or logical sectors.
I did some testing with kvm and it turns out it uses logical sectors.
That unit is the same you'd get back from 'blockdev --getss' that value can also be read from /sys/
see http://
- 1152. By Dan Watkins on 2015-10-20
-
Switch to using sectors for MBR disk setup.
| Dan Watkins (daniel-thewatkins) wrote : | # |
Right, I've updated the patch to use blockdev to find the size and sector size, which allows us to calculate the size of a disk in sectors.
I've tested this on wily and trusty, and it worked in both cases.
| Scott Moser (smoser) wrote : | # |
I'd like to read /sys if we can. blockdev is fine, but that costs us 2 subprocesses for information that we could conceivably read.
one last comment i should have added for reference later was that an example qemu command line where we provide all the sizes is like:
qemu-system-x86_64 -enable-kvm -drive file=/tmp/
| Scott Moser (smoser) wrote : | # |
Dan,
I'm ok to go with blockdev usage for now.
Could you set a nice commit message on this MP?
| Dan Watkins (daniel-thewatkins) wrote : | # |
Nice commit message set.
FAILED: Continuous integration, rev:1152
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
| Scott Moser (smoser) wrote : | # |
Merged with some updates at git commit 18203bf101dc04c
https:/


some comments inline.
other thing.. it seems like it would make sense to partition assuming sectors of 4096 bytes. just to ensure alignment or to round all partition sizes to 1MB or even 4MB.
if the user has just given us such course grained data as percentage, it seems we have some wiggle room to work with and should try to do same things.
for reference it seems that /sys/block/ sda/queue/ hw_sector_ size has sector sizes. i'm not sure that i'd bother caring though wether there was 512 or 4096 there. I'm thinking just easiest to never partition in smaller units than 4096.