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

handle system storage events #311

Merged
merged 34 commits into from
Feb 5, 2016

Conversation

dwlehman
Copy link
Contributor

These patches add support to blivet for updating the DeviceTree to reflect changes made to system storage from outside of blivet.

This is functionally complete, but needs some more refinement. The remaining improvements that occur to me now are:

  1. more unit tests
  2. move event handlers into a separate mixin class
  3. further auditing of existing calls to udev.settle
  4. move event masking from DiskLabelFormatPopulator.update to DiskLabel.partedDisk or similar

Probably the most important thing is that I need to build up good test coverage. Manually dinking around running commands on a shell in a vm while watching the output of examples/uevents.py is not a good long-term plan.

@vpodzime
Copy link
Contributor

Looks good to me otherwise.

@dwlehman
Copy link
Contributor Author

dwlehman commented Feb 1, 2016

Changes from last version:

  • made a blivet.events package w/ manager, handler, changes modules
  • added wrapper methods to Populator for getting format helpers
    • this avoids circular import issues with EventHandlerMixin
  • moved event masking from DiskLabelFormatPopulator.update to DiskLabel.update_parted_disk

@dwlehman
Copy link
Contributor Author

dwlehman commented Feb 1, 2016

Oh -- I also fixed all the stuff @vpodzime flagged in his review.

@vpodzime
Copy link
Contributor

vpodzime commented Feb 4, 2016

Looks good to me now.

@vpodzime vpodzime added the ACK label Feb 4, 2016
udev generates ("synthesizes") a change event whenever a read/write
file descriptor to a block device is closed, so there is no reason
we should have to notify the kernel ourselves after writing to a
block device.
update_size is the place to go get the current size.
That includes any actions related by way of containers, too.
This is intended to be used under a very limited set of circumstances,
such as resize of inactive LVs from outside of blivet.
libparted's clobber does not remove a protective MBR, which makes it
useless for our purposes.
There are several such mechanisms being employed elsewhere in blivet
and even in the lvm tools themselves. This should not be needed anymore.
With this flag the method will recursively clear a device without
removing it. This is the same behavior it has always had for disks.
When we're removing partitions to account for changes
made to disklabels outside of blivet we'll need to be
able to skip the remove_hook.
Waiting for the udev queue to settle doesn't make sense as part of
handling uevents.
The primary purpose of this is to be called from an event handler
for "change" uevents.
Callers can register a callback which blivet can use to report
exceptions that occur in event handling threads. If they do not
register such a callback, the following will happen: 1) The exception
and traceback will be logged using the ERROR facility. 2) The next time
a method that has been wrapped using the SynchronizedMeta metaclass is
called in the main thread, the exception will be re-raised.
Each event is handled in a separate thread, so we use thread-local
data to store an ordered list of the changes made while handling
each event.
dwlehman added a commit that referenced this pull request Feb 5, 2016
@dwlehman dwlehman merged commit f557187 into storaged-project:master Feb 5, 2016
@dwlehman dwlehman deleted the outside-events branch February 5, 2016 13:06
@dwlehman dwlehman mentioned this pull request Feb 9, 2016
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.

None yet

2 participants