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

emhttp events on init and shutdown. #125

Closed
gfjardim opened this issue Apr 28, 2015 · 8 comments

Comments

@gfjardim
Copy link
Collaborator

commented Apr 28, 2015

Hi Tom, I'm developing this plugin here: http://lime-technology.com/forum/index.php?topic=38635.0

What I need are two more events triggered by emhttp, one on it's init and one on it's shutdown, so disks can be safely mounted/unmounted on boot/shutdown without any go commands.

Is this feasible?

@eschultz

This comment has been minimized.

Copy link
Collaborator

commented Apr 28, 2015

@gfjardim

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 28, 2015

I don't think so, Eric. The driver_loaded is triggered every time you update the webgui with the array stopped. The driver_unloaded could, but it's already in place?

@limetech

This comment has been minimized.

Copy link
Owner

commented Apr 28, 2015

Doing this will break a key unRaid concept: that of "started" and "stopped". The idea is that when "stopped" it's ok to perform maintenance tasks on your storage devices because they are not mounted. For example, plug/unplug from server, move to a different role, etc. Mounting devices outside the normal array mount/unmount events breaks this concept and makes it easier for someone to unintentionally lose data. For that reason, I'm against it.

@gfjardim

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 28, 2015

I do understand Tom. Can you add a starting_svcs after disks_mounted and move Docker and VM starting events to it? The svcs_restarted event is only relevant to network services.

@limetech

This comment has been minimized.

Copy link
Owner

commented Apr 28, 2015

You are trying to have the 'unassigned' devices mounted before docker/vm's are started right?

If so you could tie mount to 'array_started' event which occurs just before the loop which mounts the md devices and cache disk/pool. Tie 'unmount' to 'stopping_array' which occurs just after loop which unmounts the md device and cache disk/pool.

The other thing to do would be to examine vars['startMode']. This is set to 'Normal' for a normal start mode, and to 'Maintenance' for maintenance-mode start where driver is started but devices are not mounted. This is to handle case where a file system check needs to operate on an md device (so that parity is maintained), but can only do so when device is not mounted.

[Interestingly, traditional file systems such as reiserfs and xfs require device to be unmounted in order to fsck, but btrfs required devices to mounted in order to do check/repair.]

So you would need to take this into account (maintenance mode) for your unassigned devices - what are you going to do? Provide file system check utilities, or leave that to user to type the right command?

@gfjardim

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 28, 2015

The plugin is undocumented right now( I'm terrible in documenting things and will wait someone to fix this), but if the disk is unmounted, you can click on it's icon and a r/o instance of the fsck command will run, except the NTFS one, who gives no error on r/o check and will trigger a r/w instance. It's not complete right now, some filesystems still need their correct fsck commands. [Good to know about btrfs, will take a look into it.] The plan here is to run a RO instance and offer the possibility of running the fsck with RW flag.

About the event, some people use custom scripts that are invoked on partition mount or unmount, so things like backups or copy of SD cards can be automated. For this to work right, I need to be sure that the array is mounted prior to scripts execution. This is accomplished by disks_mounted, but some users like me put VM's and Docker images on a small SSD, not large enough to be used as a cache disk, and here some race conditions appear.

About maintenance mode, I didn't know how to implement this. Am I right in assuming that the events still be launched? If so, will need to do some check before auto mounting the disks.

@limetech

This comment has been minimized.

Copy link
Owner

commented Apr 29, 2015

Sorry it took me awhile to get back to you on this. We are going to change the event that starts VM's and docker to ensure that everything is ready by the time those components initialize. I think you will be ok to use the disks_mounted/unmounting_disks events. This way you don't have to mess with maintenance mode either unless you want to use it to determine whether to offer a file system check button.

@gfjardim

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 29, 2015

Thank you very much, Tom.

@gfjardim gfjardim closed this Apr 29, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.