-
Notifications
You must be signed in to change notification settings - Fork 71
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
Test-Layout s390x #483
Test-Layout s390x #483
Changes from 1 commit
561ce19
a724048
7065052
a054be9
cf9728d
c3c1000
58c42a8
83d6f29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,15 +117,15 @@ func (c Config) processBootDevice(config *types.Config, ts *translate.Translatio | |
|
||
// check for high-level features | ||
wantLuks := util.IsTrue(c.BootDevice.Luks.Tpm2) || len(c.BootDevice.Luks.Tang) > 0 | ||
wantLuksDevice := len(c.BootDeviceLuks.Device) > 0 && len(c.BootDevice.Luks.Tang) > 0 | ||
wantLuksDevice := len(c.BootDevice.Luks.Device) > 0 | ||
wantMirror := len(c.BootDevice.Mirror.Devices) > 0 | ||
|
||
if !wantLuks && !wantMirror { | ||
return r | ||
} | ||
|
||
// s390x zfcp and dasd does not support mirror | ||
if wantLuksDevice && wantMirror { | ||
return r | ||
|
||
if wantLuksDevice && wantLuks { | ||
panic("can't happen") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not a very useful panic. Lets add more detail on why this can't happen. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll remove and add another logic to check. |
||
} | ||
|
||
// compute layout rendering options | ||
|
@@ -134,7 +134,6 @@ func (c Config) processBootDevice(config *types.Config, ts *translate.Translatio | |
var wantPRePPart bool | ||
var wantMBR bool | ||
var wantDasd bool | ||
var wantKVM bool | ||
layout := c.BootDevice.Layout | ||
switch { | ||
case layout == nil || *layout == "x86_64": | ||
|
@@ -144,11 +143,11 @@ func (c Config) processBootDevice(config *types.Config, ts *translate.Translatio | |
wantEFIPart = true | ||
case *layout == "ppc64le": | ||
wantPRePPart = true | ||
case *layout == "s390x-zfcp": | ||
case *layout == "s390x-zfcp" && wantLuksDevice: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What makes is "&& wantLuksDevice" relevant to the layout? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The intention is as per the design validation in github issue #453 (comment) by Benjamin. The concern is Sometimes user forgot to provide the device like dasda or sd in luks.device and tend to use the label. For that purpose i made a condition. So that User must provide the device corresponding to the layout. I'll re-write with another logic as if the wantLuksDevice could not found it panics and crashes rather than just giving an error message like device is must for s390x layouts. |
||
wantMBR = true | ||
case *layout == "s390x-eckd": | ||
case *layout == "s390x-eckd" && wantLuksDevice: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above |
||
wantDasd = true | ||
case *layout == "s390x-virt": | ||
case *layout == "s390x-virt" && !wantLuksDevice: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above |
||
wantBIOSPart = true | ||
wantEFIPart = true | ||
default: | ||
|
@@ -283,18 +282,18 @@ func (c Config) processBootDevice(config *types.Config, ts *translate.Translatio | |
} | ||
|
||
//encrypted root partition for s390x | ||
if wantLuksDevice { | ||
if wantMBR || wantDasd { | ||
var luksDevice string | ||
dasd := dasdRe.FindString(c.BootDeviceLuks.Device) | ||
sd := sdRe.FindString(c.BootDeviceLuks.Device) | ||
dasd := dasdRe.FindString(c.BootDevice.Luks.Device) | ||
sd := sdRe.FindString(c.BootDevice.Luks.Device) | ||
|
||
switch { | ||
case wantMBR && len(sd) != 0: | ||
luksDevice = sd + strconv.Itoa(2) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we get a comment explaining the luks device value? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also why strconv.Itoa()? and not "2" and is there a better way so there is not string magic? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will add the comment explaining the luks device value.. Also why strconv.Itoa()? and not "2" and is there a better way so there is not string magic? |
||
case wantDasd && len(dasd) != 0: | ||
luksDevice = dasd + strconv.Itoa(2) | ||
default: | ||
panic("can't happen") | ||
panic("Incorrect Device Parameter") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we could give the Device parameter that is incorrect it would go a long way for debugging. |
||
} | ||
clevis, ts2, r2 := translateBootDeviceLuks(c.BootDevice.Luks, options) | ||
rendered.Storage.Luks = []types.Luks{{ | ||
|
@@ -327,9 +326,12 @@ func (c Config) processBootDevice(config *types.Config, ts *translate.Translatio | |
case wantMirror: | ||
// RAID without LUKS | ||
rootDevice = "/dev/md/md-root" | ||
case wantLuksDevice: | ||
//Only Luks for s390x | ||
rootDevice = "/dev/mapper/root" | ||
default: | ||
panic("can't happen") | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: White space after '}' |
||
rootFilesystem := types.Filesystem{ | ||
Device: rootDevice, | ||
Format: util.StrToPtr("xfs"), | ||
|
@@ -420,4 +422,4 @@ func buildGrubConfig(gb Grub) string { | |
} | ||
superUserCmd := fmt.Sprintf("set superusers=\"%s\"\n", strings.Join(allUsers, " ")) | ||
return "# Generated by Butane\n\n" + superUserCmd + strings.Join(cmds, "\n") + "\n" | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: random change in formatting. |
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.
Commit 561ce19 should be amended with a724048
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 create a new PR with less clutter on spaces and new line. This PR was not supposed to raised, As i need some assistance is some of the logic in coding which i am not able to meet. I'll work upon.