-
Notifications
You must be signed in to change notification settings - Fork 70
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
fcos: add s390x boot_device sugar #484
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.
This is a high level code review, I will come back for a more in-depth one once I understand the issue better.
We prob want to change the commit message to be something like
"fcos: add s390x boot_device
sugar"
Additionally in the future if working on an issue its customary to address issues raised in the PR rather then closing and re-making them. It makes it more easy to review and know what is changed.
edit: structurally regarding the issue this is attempting to solve I am a bit confused, trying to formulate questions as I go.
config/fcos/v1_6_exp/translate.go
Outdated
@@ -133,6 +135,13 @@ func (c Config) processBootDevice(config *types.Config, ts *translate.Translatio | |||
wantEFIPart = true | |||
case *layout == "ppc64le": | |||
wantPRePPart = true | |||
case *layout == "s390x-eckd": |
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.
Since s390x-zfcp is the same as s390x-eckd, we could have both cases fall into the same logic
IE
case x:
case y:
dowork = true
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.
Yes logically it does not do anything with two different layout with one input.
But the plan was user to force use /dev/dasd[a-z] for eckd and /dev/sd[a-z] so that during the layout preference it set appropriate root device; let say for dasd /dev/dasda2
. But , I was not able to achieve that under translate.go. I tried with regexp. Somehow it was crashing with memory error. I thought once created the PR will add the device arch once it is discuss within PR.. That's why made it open.
1, imported regexp.
2. then did `diskRe = regexp.MustCompile("(/dev/dasd[a-z]$|/dev/sd[a-z]$)")
3. diskRe.FindString(*c.BootDevice.Luks.Device)
while validating with appropriate layouts getting panic on memory error
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.
Can we use the following conditions?
In translate.go will have one logic as you corrected
case s390x-zfcp:
case s390x-eckd:
wantS390X = true
below condition in validate.go to fix , so that user force to use either dasd[a-z] or sd[a-z]. If not then it give an error.
var dasdRe = regexp.MustCompile("(/dev/dasd[a-z]$)")
var sdRe = regexp.MustCompile("(/dev/sd[a-z]$)")
if d.Layout != nil && (*d.Layout == "s390x-zfcp" || *d.Layout == "s390x-eckd") {
if util.NilOrEmpty(d.Luks.Device) {
r.AddOnError(c.Append(*d.Layout), common.ErrNoLuksBootDevice)
}
if len(d.Mirror.Devices) > 0 {
r.AddOnError(c.Append(*d.Layout), common.ErrMirrorNotSupport)
}
if *d.Layout == "s390x-zfcp" && util.NotEmpty(d.Luks.Device) && !sdRe.MatchString(*d.Luks.Device) {
r.AddOnError(c.Append(*d.Layout), common.ErrNoLuksBootDevice)
}
if *d.Layout == "s390x-eckd" && util.NotEmpty(d.Luks.Device) && !dasdRe.MatchString(*d.Luks.Device) {
r.AddOnError(c.Append(*d.Layout), common.ErrNoLuksBootDevice)
}
}
config/fcos/v1_6_exp/translate.go
Outdated
var luksDevice string | ||
var device_s390x string | ||
switch { | ||
case wantMBR: |
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.
So what is the difference between the work done in the wantMBR
case and the wantDasd
case? to my eye they are doing the same thing?
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've explained above...
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.
here we provide only one condition common to both layouts under switch statement.
var device_S390x string
switch {
case wantS390x:
device_s390x = *c.BootDevice.Luks.Device
luksDevice = device_s390x + "2"
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.
For more readability I made the changes as follows.
case *layout == "s390x-eckd":
wantS390x = true
case *layout == "s390x-zfcp":
wantS390x = true
// encrypted root partition
if wantLuks {
var luksDevice string
var device_s390x string
switch {
case wantS390x:
//Luks Device for dasd and zFCP-scsi
device_s390x = *c.BootDevice.Luks.Device
luksDevice = device_s390x + "2"
config/fcos/v1_6_exp/schema.go
Outdated
@@ -32,6 +32,7 @@ type BootDevice struct { | |||
|
|||
type BootDeviceLuks struct { | |||
Discard *bool `yaml:"discard"` | |||
Device *string `yaml:"device-s390x"` |
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.
Why are we adding a new field?
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.
Correct me if am wrong.
I added the Device
for s390x disk as new field. So that when user generate ignition from butane config they must provide s390x device like /dev/dasda or /dev/sda. Else it use the label which we do not expect for s390x.
Hi @prestist , Can you please review the comments? |
Hi Team, Would you please check if the patch can be approved? or further review required? Thanks |
I'm not really a maintainer here and I don't know the code involved, but in case it's useful I can say this looks superficially sane to me at least! |
I'd recommend squashing your changes into one commit (and avoid merge commits back from main) etc. |
This will need a full rebase on top of #491 once it lands. |
7662ec6
to
4ac37f1
Compare
Hi, |
@madhu-pillai sorry, by mistake instead of suggestion i've committed a change on top of yours. One question: FCP disks have |
config/fcos/v1_6_exp/schema.go
Outdated
@@ -32,6 +32,7 @@ type BootDevice struct { | |||
|
|||
type BootDeviceLuks struct { | |||
Discard *bool `yaml:"discard"` | |||
Device *string `yaml:"s390x-device"` |
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.
Device *string `yaml:"s390x-device"` | |
Device *string `yaml:"blockdev"` |
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.
Is prefix s390x-
help in identifying what layout the user trying to use and avoid confusion on device parameter from other arch?
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.
My suggestion is to keep this as device
and document that it's only valid on the s390x-eckd
and s390x-zfcp
layouts. Having the s390x-
prefix makes it feel less integrated than other arches.
docs/config-openshift-v4_15-exp.md
Outdated
* **_luks_** (object): describes the clevis configuration for encrypting the root filesystem. | ||
* **s390x-device** (string): describes device specific to s390x `dasd[a-z]` or `sd[a-z]`. |
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.
* **s390x-device** (string): describes device specific to s390x `dasd[a-z]` or `sd[a-z]`. | |
* **s390x-device** (string): underlying block device`dasd[a-z]` or `sd[a-z]`. |
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.
Initially i was using device naming device
however steven perstist reviewed and suggest to prefix s390x -device.
That is right... 2 is only valid for dasd disk |
Accidently click on close PR. Kindly ignore.. |
3805b29
to
ae67e22
Compare
Almost LGTM. |
ae67e22
to
6a4a8b0
Compare
Have fixed the doc and translate and validate version check. |
Hi, Could you help me how to run the test similar to the CI? I just running |
6a4a8b0
to
7f9b2c2
Compare
Looks like the |
/cc @prestist |
Sorry for the delay; I plan on taking a look at this today. |
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.
Overall approach LGTM. Mostly minor things and one concern re. BIOS/EFI.
config/fcos/v1_6_exp/schema.go
Outdated
@@ -32,6 +32,7 @@ type BootDevice struct { | |||
|
|||
type BootDeviceLuks struct { | |||
Discard *bool `yaml:"discard"` | |||
Device *string `yaml:"s390x-device"` |
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.
My suggestion is to keep this as device
and document that it's only valid on the s390x-eckd
and s390x-zfcp
layouts. Having the s390x-
prefix makes it feel less integrated than other arches.
config/fcos/v1_6_exp/translate.go
Outdated
case *layout == "s390x-virt": | ||
wantBIOSPart = true | ||
wantEFIPart = true |
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.
This doesn't look right; we don't have BIOS or EFI partitions on s390x. Why is this there?
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, I think I added this because Benjamin suggested that KVM Virt does not need /dev/vda
as /dev/disk/by-partlabel
similar to x86
. I'll correct by removing this case statement and append following case statement.
case *layout == "s390x-eckd" || *layout == "s390x-zfcp" || *layout == "s390x-virt"
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.
Initially I used device
but Steve suggested something specific to s390x
that's why I added s390x-device
. I'll correct that to device
.
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'll correct by removing this case statement and append following case statement.
Yes, that makes sense to me.
Initially I used
device
but Steve suggested something specific tos390x
that's why I addeds390x-device
. I'll correct that todevice
.
Yeah, I think it's debatable either way but I would lean towards device
. Having to repeat "s390x" in both the layout name and this field's name is a bit awkward.
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.
Yeah; 100% thinking about it again and having talked to @jlebon I agree device
is certainly better.
### Mirrored boot disk | ||
|
||
This example uses the shortcut `boot_device` syntax to configure an encrypted root filesystem in s390x KVM unlocked with a network Tang server. |
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 move this example down to be the last of this subsection and keep the more common scenarios as first?
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.
Yes, That is right. I'll move that to the last subsection.
docs/release-notes.md
Outdated
@@ -63,6 +64,7 @@ key](https://getfedora.org/security/). | |||
- Document `key_file` `compression` field _(openshift 4.8.0 - 4.9.0)_ | |||
- Document support for special mode bits and `arn` URLs _(r4e 1.1.0+)_ | |||
- Improve rendering of spec docs on docs site | |||
- Document `luks.s390x-device` spec _(fcos, openshift 4.14.0+)_ |
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.
Not sure if we need this given that it's a new feature. I think this section is more for doc changes for pre-existing features.
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, I shall remove this.
internal/doc/butane.yaml
Outdated
- name: s390x-device | ||
transforms: | ||
- regex: $ | ||
replacement: the whole-disk device (not partitions), referenced by their absolute path. One device must be specified with s390x-* layout except s390x-virt. |
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.
We should mention the expected prefixes.
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.
Does that mean change to - name: device
?
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 mean mention that on s390x-eckd
, it should start with /dev/dasd
and similarly for the other layout.
But yes, the field name itself will also need to be updated when we rename it.
02914a5
to
6c80516
Compare
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.
Some minor comments, but LGTM overall!
Were you able to do a final test on this with all three layouts?
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.
Thank you @madhu-pillai and @nikita-dubrovskii LGTM; I am deferring my approval to @jlebon's
I have two small nits;
No big deal but would be nice to fix.
Thank you again for all your work.
config/fcos/v1_6_exp/translate.go
Outdated
case *layout == "s390x-virt": | ||
wantBIOSPart = true | ||
wantEFIPart = true |
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.
Yeah; 100% thinking about it again and having talked to @jlebon I agree device
is certainly better.
4503eb1
to
f8338bd
Compare
Co-authored-by: Nikita Dubrovski <[email protected]> Co-authored-by: Jonathan Lebon <[email protected]>
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.
Just did a small tweak to the transform regex bits.
Nice work! Thanks for working through all the comments.
It depends on fcos 1.6.0-experimental See: coreos#484 See: coreos#514
It depends on fcos 1.6.0-experimental See: coreos#484 See: coreos#514 Fixes: coreos#517
It depends on fcos 1.6.0-experimental See: coreos#484 See: coreos#514 Fixes: coreos#517
Hi,
I've closed the earlier pr 483 due to some errors. Here is the new PR.
As per the GitHub issue [https://github.com//issues/453#issuecomment-1655441505]. The PR contains following conditional changes exclusively for s390x.
Added boot_device.luks.device specifically for s390x-zfcp s390x-eckd and forbidden for other arch including s390x-virt.
The configuration will generate only with boot_device.luks and it fails if mirror boot_device.mirror configuration is specified for s390x-eckd and s390x-zfcp .