Skip to content

Refactor provider options - #503

Open
Cristi1324 wants to merge 3 commits into
cloudbase:mainfrom
Cristi1324:refactor-target-options
Open

Cristi1324 wants to merge 3 commits into
cloudbase:mainfrom
Cristi1324:refactor-target-options

Conversation

@Cristi1324

@Cristi1324 Cristi1324 commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

This PR moves common provider options into core so each provider does not have to redefine the same option schema.

Initial common keys are nics_set_dhcp, data_transfer_mechanism, and cloudbase_init_plugins. Core merges those schemas into every import provider.

Also added retain_user_credentials as a separate commit.

Comment thread coriolis/osmorphing/windows.py
Comment thread coriolis/schemas/os_morphing_resources_schema.json Outdated
Comment thread coriolis/osmorphing/destination_option_overrides.py Outdated
Comment thread coriolis/osmorphing/destination_option_overrides.py Outdated
Comment thread coriolis/osmorphing/destination_option_overrides.py Outdated
Comment thread coriolis/osmorphing/destination_options.py Outdated
@Cristi1324
Cristi1324 force-pushed the refactor-target-options branch 2 times, most recently from b03c3c2 to d799e6f Compare August 25, 2026 12:39
@Cristi1324
Cristi1324 force-pushed the refactor-target-options branch 2 times, most recently from 70b1df5 to d757307 Compare September 2, 2026 09:27
@Cristi1324 Cristi1324 changed the title WIP Refactor provider options Refactor provider options Sep 2, 2026
@Cristi1324
Cristi1324 marked this pull request as ready for review September 2, 2026 09:35
Comment thread coriolis/osmorphing/manager.py Outdated

nics_info = osmorphing_info.get('nics_info')
set_dhcp = osmorphing_info.get('nics_set_dhcp', True)
set_dhcp = osmorphing_parameters.get('set_dhcp', True)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This will be properly handled in: https://github.com/cloudbase/coriolis/pull/534/files.
This PR will need to be rebased eventually, and is therefore blocked in the meantime.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is blocked by: #534

@Cristi1324
Cristi1324 marked this pull request as draft October 9, 2026 10:53
@Cristi1324
Cristi1324 force-pushed the refactor-target-options branch 2 times, most recently from 6de4af7 to 328497f Compare October 13, 2026 11:56
@Cristi1324
Cristi1324 marked this pull request as ready for review October 13, 2026 11:59
@Cristi1324
Cristi1324 requested a review from Dany9966 October 15, 2026 09:47
Comment thread coriolis/osmorphing/conf.py Outdated
"title": "Set DHCP",
"description": (
"Sets whether or not to configure the VM to use DHCP "
"during the OSMorphing stage."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit:

Suggested change
"during the OSMorphing stage."
"during the OSMorphing stage. "
"When disabled, guest static IPs will be preserved after the migration."

Comment thread coriolis/osmorphing/conf.py Outdated
Comment on lines +59 to +60
"Keep the guest user accounts during OS morphing. "
"When false, OS morphing creates the cloud-init user."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
"Keep the guest user accounts during OS morphing. "
"When false, OS morphing creates the cloud-init user."
"Prevents the destination cloud provisioning from resetting the pre-existing credentials. "
"When disabled, the destination platform may also create a provisioned cloud guest user."

opts = [
cfg.ListOpt(
"cloudbase_init_plugins",
default=None,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why don't you use the config_defaults from CORE_DESTINATION_OPTIONS as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If we set a default for cloudbase_init_plugins, it will be applied over the provider default because the provider default is not handled in apply_core_destination_overrides. Maybe we should pass enabled_plugins in osmorphing_parameters as cloudbase_init_plugins, but that means that this will no longer be a drop in replacement.
I can still set defaults from CORE_DESTINATION_OPTIONS for the other options.

Comment thread coriolis/osmorphing/conf.py Outdated
LOG = logging.getLogger(__name__)


def merge_core_destination_options(provider_options, option_names=None):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please set type hints for all introduced method args and return types.

Comment thread coriolis/osmorphing/windows.py Outdated
"""
if plugins is None:
return None
if isinstance(plugins, str):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

At what point does this plugins be a string? IMO it shouldn't reach this point and then make a list out of the string, especially since the schema expects it to be a list.
If that happens, it means a schema validation is either not being called or unfunctional.
All of this logic is supposed to be done by the schema validator.

"type": "boolean",
"default": false
"default": false,
"description": "Keep the guest user accounts during OS morphing. When false, OS morphing creates the cloud-init user."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please set the new descriptions here as well.

Comment thread etc/coriolis/coriolis.conf Outdated
# Used when dest-env and the destination provider both omit the key.
# cloudbase_init_plugins = cloudbaseinit.plugins.common.mtu.MTUPlugin,cloudbaseinit.plugins.windows.ntpclient.NTPClientPlugin
# Disk copy mechanism for destination worker VMs: HTTPS (TCP/5566) or SSH (TCP/22).
# data_transfer_mechanism = HTTPS

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

since there's not only osmorphing options in here, maybe we should move these somewhere else, and not in osmorphing_conf?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd also like to see these in a separate section, not under DEFUALT. Something like common_target_option.

@Cristi1324
Cristi1324 force-pushed the refactor-target-options branch from d8e98bb to 6cc5e62 Compare October 16, 2026 10:34
@Cristi1324
Cristi1324 force-pushed the refactor-target-options branch from 6cc5e62 to b89fa1b Compare October 16, 2026 10:51
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