-
Notifications
You must be signed in to change notification settings - Fork 17
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
translate: support deprecated create
filesystem object
#28
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
// If `wipe` is set to `false` but we have a `"create": {...}` section, we try | ||
// to convert it. | ||
if wipe == nil && f.Mount.Create != nil { | ||
wipe = util.BoolP(f.Mount.Create.Force) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Force
is true, it's safe to set WipeFilesystem
true. But if Mount.Create
is non-nil and Force
is false, I think we should fail the translation. In that situation, the config is asking for the FS to be created if it doesn't exist, and for Ignition to fail otherwise. For the case where the filesystem exists and matches the specified parameters (format etc.), Ignition 2.x can't deliver those semantics: provisioning would succeed instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get your point - and this is something I'd like to talk with you; maybe in a dedicated issue. Currently ign-converter
expects a fsMap
to map file systems with path, what if we could generate this value on the fly, with something like:
@@ -49,7 +50,13 @@ func Check2_4(cfg old.Config, fsMap map[string]string) error {
fsMap["root"] = "/"
for _, fs := range cfg.Storage.Filesystems {
if _, ok := fsMap[fs.Name]; !ok {
- return util.NoFilesystemError(fs.Name)
+ // generate a random path
+ p, err := ioutil.TempDir("", fs.Name)
+ if err != nil {
+ return fmt.Errorf("creating tmp fs directory: %w", err)
+ }
+
+ fsMap[fs.Name] = p
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's discuss that change in a separate issue. I don't think it's relevant here, though? The problem here isn't the mountpoint, but what to do if the specified Device
already has a filesystem superblock on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, the issue is created in here: #30
The problem here isn't the mountpoint, but what to do if the specified Device already has a filesystem superblock on it.
Got it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, cool. So let's add an error return in Check2_*
if f.Mount.Create != nil && !f.Mount.Create.Force
, and a comment here referring to that.
since we support `mount.create` object, we need to check that the filesystem will be actually forced in its creation. Otherwise it will conflict with an eventual existing fs on a device. Signed-off-by: Mathieu Tortuyaux <[email protected]>
It can be useful for users interested to translate their ignition config with deprecated fields like the `create` one. We extract the options (`label` and `uuid`) from the `options` array in the `create` object. Signed-off-by: Mathieu Tortuyaux <[email protected]>
we assert that filesystem `create` object is correctly translated to filesystems options. Signed-off-by: Mathieu Tortuyaux <[email protected]>
in this case the check must fail because it does not fulfill the requirements. Signed-off-by: Mathieu Tortuyaux <[email protected]>
c6b931e
to
058ae48
Compare
@bgilbert |
Hi,
In this PR, we add support for
create
object in the filesystem configuration:ign-converter
will try to use value fromf.Mount.WipeFilesystem
if this one isnil
and we have af.Mount.Create
struct, we try to parse the options (label
anduuid
) andwipeFilesystem
is conditionally bound tof.Mount.Create.Force
.Even if
create
object is deprecated, I feel that supporting into theign-converter
will help users to migrate to newer versions ofignition
.