Skip to content

Add VM.sysprep API call #6547

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

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

lindig
Copy link
Contributor

@lindig lindig commented Jun 20, 2025

A new API call that works in collaboration with a guest agent on a Windows VM to pass a unattend.xml to Windows sysprep.

  • Receives the XML content as a parameter. The XE interface supports defining this from a file but an API client has to pass the content as a parameter.
  • The API call creates a local ISO SR; creates an ISO with unattended.xml and inserts the ISO into the VMs CD-ROM, then notifies the VM via xenstore.
  • Outside of scaffolding for the API, everything in vm_sysprep.ml.
  • Exceptions raised are handled in Xapi_vm.sysprep()

Christian Lindig added 13 commits June 19, 2025 14:47
Add a new API call for VM sysprep and the corresponding XE
implementation. This is mostly scaffolding.

Signed-off-by: Christian Lindig <christian.lindig@cloud.com>
We want to create a temporary directory that will be used to hold files
for creating an ISO. There is no existing function that creates all
necessary directories in a predicatble way.

Signed-off-by: Christian Lindig <christian.lindig@cloud.com>
Implement creating an ISO from a temporary directory

Signed-off-by: Christian Lindig <christian.lindig@cloud.com>
Signed-off-by: Christian Lindig <christian.lindig@cloud.com>
Create a local SR unless it exists.

Signed-off-by: Christian Lindig <christian.lindig@cloud.com>
We need to locate the CD drive of the VM.

Signed-off-by: Christian Lindig <christian.lindig@cloud.com>
The VM is notified to perform a sysprep by writing to XenStore. The VM
picks this up via its guest agent.

Signed-off-by: Christian Lindig <christian.lindig@cloud.com>
Signed-off-by: Christian Lindig <christian.lindig@cloud.com>
Introduce on_startup(), called on xapi startup, to clean up the local SR
to avoid accumulating ISO files.

Signed-off-by: Christian Lindig <christian.lindig@cloud.com>
For simplicity, add vm-sysprep-enabled = true/false to xapi.conf rather
than using a full V6D feature flag.

Signed-off-by: Christian Lindig <christian.lindig@cloud.com>
Signed-off-by: Christian Lindig <christian.lindig@cloud.com>
Signed-off-by: Christian Lindig <christian.lindig@cloud.com>
Signed-off-by: Christian Lindig <christian.lindig@cloud.com>
Signed-off-by: Christian Lindig <christian.lindig@cloud.com>
@last-genius
Copy link
Contributor

Did you mean to assign Rob and Edwin as reviewers, not assignees?

@last-genius
Copy link
Contributor

I can guess the big-picture intentions behind this, but as someone not terribly familiar with Windows setup, it could be worth spelling out why this is wanted and what this simplifies and improves

@lindig
Copy link
Contributor Author

lindig commented Jun 20, 2025

It's coming from a customer requirement: supporting a way to customise a Windows VM using Windows tools. The challenge is how to get a file to the VM such that a tool in the VM can read it. My preferred method would have been providing this via the network but this does not work when the VM has no network yet set up. So we end up with a somewhat convoluted approach to create an ISO that we provide via CD ROM to the VM. This is currently disabled via a flag.

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.

4 participants