Skip to content

Conversation

gthvn1
Copy link
Contributor

@gthvn1 gthvn1 commented Oct 16, 2025

This PR implements the supported image format mechanism proposed in this design document: https://xapi-project.github.io/new-docs/design/sm-supported-image-formats/index.html

  • It adds supported image formats to the SM object if the SM plugin specifies it in its DRIVER_INFO.
  • When the information is available, you can select which image format to use as the destination during a VM or VDI migration.

This feature is particularly useful because XCP-ng is adding support for the Qcow2 format in SMAPI to allow VDIs larger than 2TB. So in the near future (we're currently releasing the beta version), some SRs will support multiple formats such as VHD, RAW, and Qcow2.

With this patch, it becomes possible to migrate a VM with VHD disks on one SR to another SR with Qcow2 disks. If an SM plugin does not provide information about the supported image formats, the behavior remains unchanged.

For more details see the specification.

When running `xe sm-list params=all` you will now have the info of
supported image formats if the SM plugin specified it in its DRIVER_INFO.
The field is called `supported-image-formats`. If the plugin doesn't
provide the info the field will be empty.

This patch modifies the datamodel and add a new field to store this
information into the SM object.

Signed-off-by: Guillaume <[email protected]>
This patch allows specifying the destination format for individual VDIs
mapped to a destination SR. It adds a new parameter to `VM.migrate_send`
and `VM.assert_can_migrate` API. It also adds a new parameter to XE CLI.
The format to specify the image format is `image-format:<source VDI
UUID>=<destination image format>`. If the given image format cannot be
validated, an error is returned.

It also adds a new parameter to `VDI.pool-migrate`. This new parameter
allows to provide a string that is the destination format. This string is
used to check whether the destination SR supports the expected format. If
the check fails or cannot be performed due to missing information on the
destination SR, an error is returned.

Signed-off-by: Guillaume <[email protected]>
A new field supported_image_format and new parameters have been added for:
  - VM.migrate_send
  - VM.assert_can_migrate
  - VDI.pool_migrate

Signed-off-by: Guillaume <[email protected]>
@gthvn1 gthvn1 changed the title Gtn image formats Supported image formats Oct 16, 2025
; field ~lifecycle:[] ~qualifier:DynamicRO
~default_value:(Some (VSet [])) ~ty:(Set String)
"supported_image_formats"
"Image formats supported by the SR (VHD, RAW, Qcow2, ...)"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the capitalisation significant? Would be good to list the supported formats in the exact syntax. The … leaves some imagination.

; ( String
, "dest_img_format"
, "The image format to use on destination SR"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, list supported formats in the exact syntax.

?(host_pending_features = []) ?(configuration = []) ?(other_config = [])
?(driver_filename = "/dev/null") ?(required_cluster_stack = []) () =
?(driver_filename = "/dev/null") ?(required_cluster_stack = [])
?(supported_image_formats = []) () =
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a sensible default? Does this not force to set this parameter? Or is the empty list a special value?

let vdi =
Client.VDI.get_by_uuid ~rpc ~session_id ~uuid:vdi_uuid
in
debug "GTNDEBUG: add image format %s,%s" vdi_uuid vdi_fmt ;
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 GTNDEBUG?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm using it for personal debug "Guillaume ThouveniN" 😉 . It is too make sure to remove them all before before pushing PR 😅 ...

let sr_uuid = Db.SR.get_uuid ~__context ~self:sr_ref in
match List.assoc_opt vdi_ref vdi_format_map with
| None ->
debug "GTNDEBUG: read vdi %s, sr %s. No type specified for the VDI"
Copy link
Contributor

Choose a reason for hiding this comment

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

GTNDEBUG?

Copy link
Contributor Author

@gthvn1 gthvn1 Oct 16, 2025

Choose a reason for hiding this comment

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

Oops 😅 I will check whether we want to keep this debug message. If yes, I'll remove GTNDEBUG. I will also check for others GTNDEBUG as well 👍

@lindig
Copy link
Contributor

lindig commented Oct 16, 2025

I would like to see more explicitly documented and checked the supported image formats. These appear to be some mysterious strings but the user of neither API or CLI should have to guess them,

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.

2 participants