Skip to content

ceph-volume: revert partition as disk#25390

Merged
alfredodeza merged 4 commits intoceph:masterfrom
jan--f:c-v-revert-partition-as-disk
Dec 12, 2018
Merged

ceph-volume: revert partition as disk#25390
alfredodeza merged 4 commits intoceph:masterfrom
jan--f:c-v-revert-partition-as-disk

Conversation

@jan--f
Copy link
Contributor

@jan--f jan--f commented Dec 4, 2018

This reverts two commits from PR #25330. Really sorry I didn't catch this in the review. The main reason for this revert is, that it breaks ceph-volume inventory as it is not prepared to deal with partitions being reported as disks (and the dict carrying a different set of keys...see example output below).

Fixes: http://tracker.ceph.com/issues/37506

Furthermore I think there're other arguments to be made against this change:

  • It dramatically changes what disk.get_devices() has done in the past and is very different from what the name suggests.
  • It simply duplicates the information. As illustrated in the output below, the exact same partition information is already part of the device itself. Why does it need to be duplicated?
  • So far I could not find where this additional data is used? Other then the test case (also reverted here) this new functionality seems not used. I'm sure I just didn't look closely enough but I'm certain, that the same functionality can be implemented based on the existing partition reporting done by disk.get_devices()
{'/dev/vda': {'human_readable_size': '40.00 GB',
              'locked': 1,
              'model': '',
              'nr_requests': '256',
              'partitions': {'vda1': {'holders': [],
                                      'sectors': '83884032',
                                      'sectorsize': 512,
                                      'size': '40.00 GB',
                                      'start': '2048'}},
              'path': '/dev/vda',
              'removable': '0',
              'rev': '',
              'ro': '0',
              'rotational': '1',
              'sas_address': '',
              'sas_device_handle': '',
              'scheduler_mode': 'mq-deadline',
              'sectors': 0,
              'sectorsize': '512',
              'size': 42949672960.0,
              'support_discard': '',
              'vendor': '0x1af4'},
 '/dev/vda1': {'holders': [],
               'sectors': '83884032',
               'sectorsize': 512,
               'size': '40.00 GB',
               'start': '2048'},
}

@alfredodeza
Copy link
Contributor

Mind expanding how it breaks? There aren't details of this in the ticket either.

The information is needed because the way the Device() class gets populated with metadata is with get_devices(), this information is then used throughout the object to detect things like if the partition is encrypted (and if it is a partition). This PR can't simply revert commits like this because it breaks zapping.

The functional tests in tests/functional/lvm will probably report breakage on any scenario

@andrewschoen
Copy link
Contributor

jenkins test ceph-volume lvm all

@andrewschoen
Copy link
Contributor

jenkins test ceph-volume batch all

Copy link
Contributor

@andrewschoen andrewschoen left a comment

Choose a reason for hiding this comment

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

The CI is finding failures with lvm zap because of this change. I think the correct thing to do here is modify ceph-volume inventory to handle this new format. However, if you still feel strongly about changing the structure then you'll also need to provide a fix for lvm zap to accommodate that along with the revert.

@jan--f
Copy link
Contributor Author

jan--f commented Dec 4, 2018

So far I could not find where this additional data is used? Other then the test case (also reverted here) this new functionality seems not used. I'm sure I just didn't look closely enough but I'm certain, that the same functionality can be implemented based on the existing partition reporting done by disk.get_devices()

As I said I'm sure the zap functionality can be done with the existing code. I'll take a closer look.

@jan--f jan--f force-pushed the c-v-revert-partition-as-disk branch from 875a00a to 1879ba7 Compare December 4, 2018 16:05
@jan--f
Copy link
Contributor Author

jan--f commented Dec 4, 2018

jenkins test ceph-volume lvm all

@jan--f
Copy link
Contributor Author

jan--f commented Dec 4, 2018

Mind expanding how it breaks? There aren't details of this in the ticket either.

It tries to print the human_readable_size, but this key doesn' exist for partitions.

The information is needed because the way the Device() class gets populated with metadata is with get_devices(), this information is then used throughout the object to detect things like if the partition is encrypted (and if it is a partition). This PR can't simply revert commits like this because it breaks zapping.

I'm wondering why the existing partition property on a device can not be used for that. It's the same information after all.

@andrewschoen
Copy link
Contributor

It tries to print the human_readable_size, but this key doesn' exist for partitions.

Seems like inventory could handle a missing key pretty easily. Or I'm sure we could add that key if that's all you're missing.

I'm wondering why the existing partition property on a device can not be used for that. It's the same information after all.

I suspect the partition was added to the top-level to make it easy to access it's information. In lvm zap it'll be common to zap a partition. So instead of taking a partition as input, finding it's parent device and then traversing it's information to find the partition it can just access it directly.

@jan--f jan--f force-pushed the c-v-revert-partition-as-disk branch from 1879ba7 to b233973 Compare December 4, 2018 21:51
@jan--f
Copy link
Contributor Author

jan--f commented Dec 4, 2018

jenkins test ceph-volume lvm all

1 similar comment
@jan--f
Copy link
Contributor Author

jan--f commented Dec 5, 2018

jenkins test ceph-volume lvm all

@jan--f
Copy link
Contributor Author

jan--f commented Dec 5, 2018

@andrewschoen What do you think of this?

Seems like inventory could handle a missing key pretty easily. Or I'm sure we could add that key if that's all you're missing.

Right, that would be straight forward. However I'd rather not see disk.get_devices() change though. I think it's a clear abstraction as it was and adding partitions as top level devices seems confusing and redundant.

I suspect the partition was added to the top-level to make it easy to access it's information. In lvm zap it'll be common to zap a partition. So instead of taking a partition as input, finding it's parent device and then traversing it's information to find the partition it can just access it directly.

Since the number of devices that need to be traversed is bounded (I expect we'll not see nodes with > 100 devices attached any time soon) I think this traversing overhead is bearable in exchange for a clean abstraction in disk.get_devices().

Copy link
Contributor

@alfredodeza alfredodeza left a comment

Choose a reason for hiding this comment

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

This addition doesn't have unit tests to go along with it, please add those. Also, it was mentioned that the inventory command broke, so I think a call to inventory should be done in the functional tests (located in tests/functional/). There are a few calls to ceph-volume lvm list for example, inventory could be run after that, or before too. That way a non-zero exit status will make our functional tests fail and we can catch this problem

@jan--f jan--f force-pushed the c-v-revert-partition-as-disk branch from b233973 to 1c03776 Compare December 7, 2018 09:01
@jan--f
Copy link
Contributor Author

jan--f commented Dec 7, 2018

jenkins test ceph-volume lvm all

@jan--f
Copy link
Contributor Author

jan--f commented Dec 7, 2018

@alfredodeza ping

if not sys_info.devices:
sys_info.devices = disk.get_devices()
self.sys_api = sys_info.devices.get(self.abspath, {})
if not self.sys_api:
Copy link
Contributor

Choose a reason for hiding this comment

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

this looks great, thanks for updating

@jan--f jan--f force-pushed the c-v-revert-partition-as-disk branch from 1c03776 to e724879 Compare December 7, 2018 15:02
@jan--f
Copy link
Contributor Author

jan--f commented Dec 11, 2018

@alfredodeza Can we please get this merged?

@jschmid1
Copy link
Contributor

Is this blocked by anything? I also ran into this bug and can confirm this as a valid solution.

@alfredodeza
Copy link
Contributor

alfredodeza commented Dec 11, 2018

@jan--f @jschmid1 we had some other PRs that needed to get in, we are getting them merged as we review them. @jan--f if you wouldn't mind rebasing this one more time. I believe this is good to go, should probably be merging this today

Jan Fajerski added 4 commits December 11, 2018 15:31
… in get_devices"

This reverts commit 7f3c359.
Fixes: http://tracker.ceph.com/issues/37506

Signed-off-by: Jan Fajerski <jfajerski@suse.com>
…vel keys"

This reverts commit 6dc0177.

Signed-off-by: Jan Fajerski <jfajerski@suse.com>
Signed-off-by: Jan Fajerski <jfajerski@suse.com>
Signed-off-by: Jan Fajerski <jfajerski@suse.com>
@jan--f jan--f force-pushed the c-v-revert-partition-as-disk branch from e724879 to a183a28 Compare December 11, 2018 14:31
@jan--f
Copy link
Contributor Author

jan--f commented Dec 11, 2018

@alfredodeza rebased

@alfredodeza
Copy link
Contributor

jenkins test ceph-volume lvm all

@alfredodeza alfredodeza dismissed andrewschoen’s stale review December 12, 2018 13:11

discussed over IRC, agreed to merge

@alfredodeza alfredodeza merged commit 1dcbf2f into ceph:master Dec 12, 2018
@andrewschoen
Copy link
Contributor

@jan--f this doesn't look to be backported to luminous or mimic, could you please do so? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants