-
Notifications
You must be signed in to change notification settings - Fork 17
translate: support deprecated create filesystem object
#28
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
base: main
Are you sure you want to change the base?
Conversation
bgilbert
left a comment
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 <mtortuyaux@microsoft.com>
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 <mtortuyaux@microsoft.com>
we assert that filesystem `create` object is correctly translated to filesystems options. Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
in this case the check must fail because it does not fulfill the requirements. Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
c6b931e to
058ae48
Compare
|
@bgilbert |
Hi,
In this PR, we add support for
createobject in the filesystem configuration:ign-converterwill try to use value fromf.Mount.WipeFilesystemif this one isniland we have af.Mount.Createstruct, we try to parse the options (labelanduuid) andwipeFilesystemis conditionally bound tof.Mount.Create.Force.Even if
createobject is deprecated, I feel that supporting into theign-converterwill help users to migrate to newer versions ofignition.