Merged
Conversation
…ory - if cleanup succeeds, err will be set to nil, causing later panic
…. Prefix with brave_ to make bravetools-mounted devices discoverable later. Benefit of reduced collision probability and ability to find device name in future given the unit name and path.
… cleanup of shared mount of err on mulitpass
…h to generate device name
…nal logic of trimming leading/trailing slashes if present.
…s when mounting shared volume
…he function on LXD functionality
…s provided to `brave mount`
…arlier in process to prevent mismatch between expected device path and actual
…this avoids potential clashes between basenames and also allows mounting the same folder to multiple different mount points
…M when unmounting a volume from a unit
… from output - abstracting away that implementation detail from user, who should operate on paths directly
… mount path source and target names
…volumes onto units. Refactor creation and deletion of these volumes to use the LXD API client - faster, improved error handling and less verbose.
… using paths instead of devices now
Collaborator
Author
|
A separate PR showing what the CLI might look like with subcommands has been made here, just for ease of comparison: #181 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR refactors the
brave mountandbrave umountcommands to closer match the behaviour of themountandumoutcommands. Several bugs and other issues were fixed along the way.The biggest change from the perspective of the user comes with how devices are unmounted. Now, instead of having to look for the name of the device that was randomly generated at mount time, the user runs
brave umountusing the path to the mount-point on the target unit, just like theumountcommand.To facilitate easy access to existing mounts, the
brave mountcommand can now list active bravetools-managed mounts similar to themountcommand on Linux. When invoked with no arguments,brave mountwill list all active mounts across all local units. This new command is needed becausebrave unitsnow truncates mount paths that are too long - these were breaking the formatting of the table, and undermining the purpose ofbrave unitsas a quick snapshot of all relevant info relating to units. This separate command allows for the full paths to be printed without disrupting anything else.Examples
An example of the new output of
brave units(note truncated mount paths, and renaming of "volumes" column to "mounts"):The output of
brave mountwithout args:CLI
The current proposed CLI involves no subcommands and looks like this:
On the whole it looks like it works well, despite overloading the args - there shouldn't be much confusion.
The last command ("create a volume and mount onto both units") sits a bit strangely - it acts differently than expected. It creates a blank new volume and mounts it onto both containers, rather than mounting from source->target as might be assumed. Perhaps that command could benefit more from a subcommand, but it feels a bit redundant just for one command.
Backend
Behind the scenes changes have been made to: