Skip to content

Alow specifying the os-morphing user script phase#99

Merged
Dany9966 merged 4 commits into
cloudbase:masterfrom
petrutlucian94:script_phases
May 27, 2026
Merged

Alow specifying the os-morphing user script phase#99
Dany9966 merged 4 commits into
cloudbase:masterfrom
petrutlucian94:script_phases

Conversation

@petrutlucian94
Copy link
Copy Markdown
Member

@petrutlucian94 petrutlucian94 commented May 19, 2026

When deploying replicas, Coriolis users can specify scripts that will be executed during os-morphing, right after the OS partition is mounted on the minion instance.

In some situations, this is too late since user scripts may be needed in order to be able to mount the OS disk, for example if it’s encrypted.

In other situations it’s too early. Some scripts may need to be executed on the replica instance. This may require provider assistance.

To accommodate these use cases, we’ve extended the deployment API, allowing the user to specify when a given script should be executed. Each script may specify one of the following execution phases:

  • osmorphing-pre-os-mount
  • osmorphing-post-os-mount (default)
  • replica-initial-boot (TBD)

Samples:

  • Explicit phase --user-script-global linux=/some/script.sh,phase=osmorphing-pre-os-mount
  • Implicit phase, defaults to osmorphing-post-os-mount --user-script-global linux=/some/script.sh
  • Repeating the flag, specifying multiple scripts:
--user-script-instance some-instance=/some/script.sh,phase=osmorphing-pre-os-mount
--user-script-instance some-instance=/other/script.sh,phase=osmorphing-pre-os-mount
--user-script-instance some-instance=/another/script.sh,phase=osmorphing-post-os-mount

When deploying replicas, Coriolis users can specify scripts that will be executed
during os-morphing, right after the OS partition is mounted on the minion instance.

In some situations, this is too late since user scripts may be needed in order
to be able to mount the OS disk, for example if it’s encrypted.

In other situations it’s too early. Some scripts may need to be executed on
the replica instance. This may require provider assistance.

To accommodate these use cases, we’ve extended the deployment API, allowing the
user to specify when a given script should be executed. Each script may specify
one of the following execution phases:

* osmorphing-pre-os-mount
* osmorphing-post-os-mount (default)
* replica-initial-boot (TBD)

Samples:

* Explicit phase
    --user-script-global linux=/some/script.sh,phase=osmorphing-pre-os-mount
* Implicit phase, defaults to osmorphing-post-os-mount
    --user-script-global linux=/some/script.sh
* Repeating the flag, specifying multiple scripts:
    --user-script-instance some-instance=/some/script.sh,phase=osmorphing-pre-os-mount
    --user-script-instance some-instance=/other/script.sh,phase=osmorphing-pre-os-mount
    --user-script-instance some-instance=/another/script.sh,phase=osmorphing-post-os-mount
@petrutlucian94 petrutlucian94 marked this pull request as draft May 19, 2026 14:52
@petrutlucian94 petrutlucian94 marked this pull request as ready for review May 22, 2026 10:47
Comment thread coriolisclient/cli/deployments.py Outdated
Comment thread coriolisclient/cli/utils.py
Comment thread coriolisclient/cli/utils.py Outdated
Comment thread coriolisclient/cli/utils.py Outdated
Comment thread coriolisclient/cli/utils.py
Comment thread coriolisclient/cli/utils.py Outdated
Comment thread coriolisclient/cli/utils.py
We'll pass type=comma_separated_kv_to_dict when defining
user script args, letting it do the parsing for us.
Older flake8/pycodestyle versions weren't able to properly handle
f strings, so we had to add "noqa" comments.

This issue was addressed in recent versions, all we have to do is
bump the "hacking" dependency, which currently enforces older
flake8 releases.

PyCQA/pycodestyle#1148
* specify the supported phases and which one is the default
* mention the fact that when updating transfers, the script path
  can be omitted in order to unregister it
@Dany9966 Dany9966 merged commit 121576b into cloudbase:master May 27, 2026
2 checks passed
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