Skip to content
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

[WIP] Add config for FML mode custom resolution #4264

Closed
wants to merge 1 commit into from

Conversation

shjala
Copy link
Member

@shjala shjala commented Sep 17, 2024

Add a new config value app.fml.resolution to set custom resolution for FML apps. This is a string value in the format of "widthxheight" and must be one of the predefined values, it can be a global config set by zcli :

zcli edge-node update <name> --config="app.fml.resolution:1024x768"

or it can be set per-vm as part of the "cloud-config" top-level values:

#cloud-config

hostname: vm01
manage_etc_hosts: true
app.fml.resolution: 800x600

ethernets:
    eth0:
        addresses:
        - 192.168.1.3/24
        dhcp4: false
        gateway4: 192.168.1.1
        match:
            macaddress: DE:AD:BE:EF:06:97
        nameservers:
            addresses:
            - 1.1.1.1
            - 8.8.8.8
        set-name: eth0
version: 2

This needs to be reworked and go after we #4261.

Tests

I've successfully tested the followings :

  1. Config is received if set either via cloud-config or global config ✅
  2. app.fml.resolution does not make cloud-config invalid and it is not affecting the other configs in the cloud-config (tested with Ubuntu) ✅
  3. If both global and cloud-config are set, cloud-config takes precedence ✅
  4. If no cloud-config is set, the global config is used ✅

@shjala shjala changed the title Add global config for FML mode custom resolution [WIP] Add global config for FML mode custom resolution Sep 17, 2024
@shjala shjala marked this pull request as draft September 17, 2024 10:11
@github-actions github-actions bot requested a review from rucoder September 17, 2024 10:11
@OhmSpectator
Copy link
Member

Great! Thank you! Later based on it we will choose the OVMF file...

@milan-zededa
Copy link
Contributor

Would it make sense to have it configurable per app? Or is device-wide setting sufficient?
Also, don't forget to mention this in CONFIG-PROPERTIES.md

@shjala
Copy link
Member Author

shjala commented Sep 17, 2024

I will split the doc commit later.

@shjala
Copy link
Member Author

shjala commented Sep 17, 2024

Would it make sense to have it configurable per app? Or is device-wide setting sufficient? Also, don't forget to mention this in CONFIG-PROPERTIES.md

Sure it can be, but that is the ask, It is needed to be device-wide, so they can set it and then deploy windows based FML apps and it should come up with the enforced resolution.

@shjala shjala force-pushed the fml.cus.res branch 2 times, most recently from 1baaf14 to 054a98e Compare September 17, 2024 10:30
@@ -943,6 +955,15 @@ func validateSyslogKernelLevel(level string) error {
return nil
}

func validateCustomResolution(res string) error {
// it can be notset or one of the predefined resolutions
if res == FmlResolutionNotSet || res == FmlResolution1024x768 || res == FmlResolution1920x1080 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is limiting the set of available resolutions? Qemu or our code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we need to create custom OVMF variable (a binary that we can't generate on the fly) with predefined resolution and load it via qemu, so it needs to be one of the values we already created OVMF_vars for.

There is the -device VGA,xres=1280,yres=800 option too, but I'm not sure if that works, but if later works, then I will remove the limitation.

@OhmSpectator
Copy link
Member

Would it make sense to have it configurable per app?

I'm just curious: do we support per-vm config props?

@shjala
Copy link
Member Author

shjala commented Sep 17, 2024

Would it make sense to have it configurable per app?

I'm just curious: do we support per-vm config props?

I think we do, like VmMode or EnableVnc.

@milan-zededa
Copy link
Contributor

Would it make sense to have it configurable per app?

I'm just curious: do we support per-vm config props?

Not that I'm aware of.
I was just thinking if it would make sense to add resolution enum into VmConfig
It requires an EVE API enhancement, so not suitable for the current issue, but long-term it might make sense to create something more user-friendly.

@OhmSpectator
Copy link
Member

I was just thinking if it would make sense to add resolution enum into VmConfig
It requires an EVE API enhancement, so not suitable for the current issue, but long-term it might make sense to create something more user-friendly.

Yeah, we have it in mind but do not go the "proper" way now, as we need to avoid API changes...

@shjala shjala force-pushed the fml.cus.res branch 2 times, most recently from 1f57b55 to 20b6443 Compare September 19, 2024 08:18
@shjala shjala changed the title [WIP] Add global config for FML mode custom resolution [WIP] Add config for FML mode custom resolution Sep 19, 2024
@@ -796,6 +807,33 @@ func (ctx KvmContext) CreateDomConfig(domainName string,
isVncShimVMEnabled(globalConfig, config)
tmplCtx.DomainConfig.DisplayName = domainName

// if we are not getting the resolution from the cloud-init, check the
// global config.
fmlResolutions := status.FmlCustomResolution
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, we need the resolution to be known earlier before calling CreateDomConfig. The resolution is used to define the OVMF file at the beginning of the Setup() function...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, this hasn't been updated with the changes of 9.4 backport.

@OhmSpectator
Copy link
Member

I took the commits from this PR as part of #4261

@shjala
Copy link
Member Author

shjala commented Sep 20, 2024

I took the commits from this PR as part of #4261

this needs to be updated.

Add a new global config value app.fml.resolution to set custom resolution
for FML apps. This is a string value in the format of "widthxheight".

This value can be set device-wide as a global config value or set
in a per-app/vm setting by defining it as top-level variable in
the cloud-config.

Signed-off-by: Shahriyar Jalayeri <[email protected]>
@OhmSpectator
Copy link
Member

Closing the PR as we moved the commits into #4261

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants