Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the user to specify the partition type #328

Merged
merged 1 commit into from
Jun 30, 2017
Merged

Allow the user to specify the partition type #328

merged 1 commit into from
Jun 30, 2017

Conversation

squimrel
Copy link
Contributor

@squimrel squimrel commented Jun 26, 2017

Not sure if I like this implementation since theoretically the partition type can always be guessed correctly except if the partition type should be extended. (Note that doing so would alter existing behavior and therefore break applications that rely on the current behavior.)
Deriving "extended" from the filesystem partition seems legit and is already done by udisks.

Note that on my end the test_fill_with_primary_partitions fails after adding the second partition due to this error:

Error waiting for partition to appear: Timed out waiting for object

I've got no clue why that happens. Help wanted.


Implement feature requested in #318.

Allow the user to specify the "partition-type" option in
"CreatePartition" to explicitly specify whether the partition should be
a primary, extended or logical partition.

Copy link
Contributor

@vpodzime vpodzime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Let's see what our CI thinks about this. The test failure is likely to be cause by some udev-related issues. We have been seeing something similar recently.

@@ -1406,7 +1406,7 @@
@size: The desired size of the partition, in bytes.
@type: The type of partition to create (cf. the #org.freedesktop.UDisks2.Partition:Type property) or blank to use the default for the partition table type and OS.
@name: The name for the new partition or blank if the partition table do not support names.
@options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>).
@options: Options - known options (in addition to <link linkend="udisks-std-options">standard options</link>) includes <parameter>partition-type</parameter> (of type 's').
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include

Copy link
Contributor Author

@squimrel squimrel Jun 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of "includes"? That's what I thought but everywhere else even if there's only one option it also says "includes".

Either this is a consistency thing everyone went with or the writers all somehow read: "includes parameter partition-type" even though the tag is obviously not read.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

known options...include... makes sense to me. Don't really care about consistency here. :)

@@ -1439,7 +1443,7 @@
@size: The desired size of the partition, in bytes.
@type: The type of partition to create (cf. the #org.freedesktop.UDisks2.Partition:Type property) or blank to use the default for the partition table type and OS.
@name: The name for the new partition or blank if the partition table do not support names.
@options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>).
@options: Options - known options (in addition to <link linkend="udisks-std-options">standard options</link>) includes <parameter>partition-type</parameter> (of type 's').
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here with include

@@ -95,7 +95,7 @@ def test_create_mbr_partition(self):
sys_num = int(self.read_file('%s/partition' % part_syspath))
dbus_num.assertEqual(sys_num)

def test_create_extended_partition(self):
def create_extended_partition(self, ext_options, log_options, fstype=''):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not fstype, it is the partition type (see the docs for details)

@vpodzime
Copy link
Contributor

Jenkins, this is ok to test.

@vpodzime vpodzime added this to the udisks 2.7.1 milestone Jun 27, 2017
@vpodzime
Copy link
Contributor

The test failure is likely to be cause by some udev-related issues.

I can confirm I'm seeing very weird issues even without this patch when trying to create 3 partitions on a single disk. The extended tests in this PR probably just it.

@squimrel
Copy link
Contributor Author

So you say I should remove that test? Honestly it's not very good either since it would probably pass without this patch.

@vpodzime
Copy link
Contributor

So you say I should remove that test? Honestly it's not very good either since it would probably pass without this patch.

Could be a good idea for now. We need to deal with the issues when creating partitions in general and it wouldn't make much sense to add tests that would always fail at this point.

@vpodzime
Copy link
Contributor

vpodzime commented Jun 27, 2017

@squimrel, please take a look at #329. We may need to merge that first to give your changes a chance to pass the existing and newly added tests.

@squimrel
Copy link
Contributor Author

squimrel commented Jun 27, 2017

@vpodzime All tests fail with #329 but you already know that since the CI told you. Not sure what exactly I should look at.

@vpodzime
Copy link
Contributor

@vpodzime All tests fail with #329 but you already know that since the CI told you. Not sure what exactly I should look at.

I meant the issues it fixes. It obviously needs more work. :)

@vpodzime
Copy link
Contributor

I meant the issues it fixes. It obviously needs more work. :)

Done. Once merged, we'll see how that affects your newly added tests from here, @squimrel

@squimrel
Copy link
Contributor Author

@vpodzime Ohh wow in fact this fixes the test I just removed! Well done.

@vpodzime
Copy link
Contributor

@vpodzime Ohh wow in fact this fixes the test I just removed! Well done.

Thanks. :) Let's see if it really makes things work better. Please resolve the conflict that was introduced by me extending the tests a bit.

Implement feature requested in #318.

Allow the user to specify the "partition-type" option in
"CreatePartition" to explicitly specify whether the partition should be
a primary, extended or logical partition.
@vpodzime vpodzime merged commit 6c422f0 into storaged-project:master Jun 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants