Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
a4602b5
CP-308253: `Task.destroy` spans should no longer be orphaned
GabrielBuica Jun 18, 2025
63eef6f
CP-308392: Create specialized functions
GabrielBuica Jun 18, 2025
3b76902
xapi-idl: Clean up xenops-related interfaces
last-genius Jun 19, 2025
c568697
xapi_xenops: Remove unnecessary Helpers.get_localhost call
last-genius Jun 18, 2025
fa28105
xapi_xenops: Split update_vm internals into a separate function
last-genius Jun 18, 2025
fa3488f
Clean up `xapi_xenops` and more (#6543)
last-genius Jun 19, 2025
58e9def
CA-408552: 1/3 Improve bootstrom performance by save db ops
liulinC Jun 20, 2025
e8440b3
CA-408552: 2/3 Improve bootstrom performance by save db ops
liulinC Jun 20, 2025
e1a57fa
CA-408552: 3/3 Improve bootstrom performance by save db ops
liulinC Jun 20, 2025
d236751
xenops_server_plugin: Refer to the type alias instead of its definition
last-genius Jun 19, 2025
7a3788a
xapi-idl/updates: Make filterfn in inject_barrier only look at keys
last-genius Jun 19, 2025
4316e6b
xapi_xenops: Refactor update_vm_internal
last-genius Jun 20, 2025
efdf9a1
CP-308253: `Task.destroy` spans should no longer be orphaned (#6542)
GabrielBuica Jun 20, 2025
ba144c2
CP-308253: Instrument `Consumers` Spans in `Message-switch`.
GabrielBuica Jun 5, 2025
7a49235
CP-50001: Instrument `xapi_xenops.ml` -- `dbg` carrier
GabrielBuica Jun 5, 2025
d9a3268
CP-50001: Instrument `xapi_xenops.ml` -- `context` carrier
GabrielBuica Jun 6, 2025
cb64cd6
CP-50001: Instrument `Xapi_xenops.events_watch`
GabrielBuica Jun 6, 2025
7bede83
CP-50001: Add attributes to updates in `events_watch`
GabrielBuica Jun 18, 2025
4210768
CA-408552: Improve bootstrom performance by save db ops (#6541)
liulinC Jun 21, 2025
9d24689
CA-406770: Improve error message
BengangY Jun 16, 2025
e572953
CP-308253 & CP-50001: Instruments `Message-switch` process and `xapi…
psafont Jun 23, 2025
ad5cbe5
xenopsd: Remove data/updated from the list of watched paths
last-genius Jun 23, 2025
a7e874d
CA-406770: Improve error message (#6537)
BengangY Jun 23, 2025
5d0fb87
xapi_xenops: Simplify update_* functions
last-genius Jun 23, 2025
acb9732
CP-308201: make unimplemented function more obvious
snwoods Jun 20, 2025
95b765f
Optimize `xapi<->xenopsd` communication (#6549)
last-genius Jun 23, 2025
f7ee5aa
CP-308201: make unimplemented function more obvious (#6548)
psafont Jun 23, 2025
3ae8ff9
Use just id_of vbd for attached_vdis key instead of the (VM, VBD) tuple
snwoods Apr 2, 2025
0728527
CA-410965: Modify default ref of console
BengangY Jun 24, 2025
38256eb
Design proposal for supported image formats (v3)
gthvn1 Mar 13, 2025
ec612ae
CA-411477: Fix SM API version check failure
BengangY Jun 24, 2025
1f346bd
Design proposal for supported image formats (v3) (#6550)
psafont Jun 25, 2025
5351b0b
CP-54207: Move VBD_attach outside of VM migrate downtime
snwoods Apr 2, 2025
4697489
xenopsd/xc: do try to allocate pages to a particular NUMA node
psafont Jun 19, 2025
d09bcec
xenopsd/xc: Expect an error when claiming pages from a single NUMA node
psafont Jun 19, 2025
43a7ab2
xenopsd/xc: fail when claiming pages for a single NUMA node
psafont Jun 19, 2025
1a68634
xenopsd/xc: upstream more NUMA changes (#6554)
psafont Jun 25, 2025
ee85085
CA-410965: Modify default ref of console (#6553)
BengangY Jun 26, 2025
24ebb5b
idl: Remove unused vm_lacks_feature_* errors
last-genius Jun 26, 2025
d9233f9
python: Add qcow2-to-stdout.py script
last-genius Apr 22, 2025
978765b
python3/qcow2-to-stdout: Remove unused code
last-genius Jun 26, 2025
7708c45
python3/qcow2-to-stdout: Update to handle block special files
last-genius Apr 22, 2025
8d3bf09
python3/qcow2-to-stdout: Add --diff option to export only changed clu…
last-genius May 15, 2025
2f3eec3
idl: Remove unused `vm_lacks_feature_*` errors (#6558)
last-genius Jun 26, 2025
b92d19e
CA-411477: Fix SM API version check failure (#6552)
BengangY Jun 27, 2025
c115a6d
rrdp-squeezed: Don't collect metrics from a domain with missing counters
psafont Jun 26, 2025
165bdec
rrdp-squeezed: generate per-vm memory target datasources
psafont Jun 26, 2025
a38ee7f
rrdp-squeezed: collect agent-collected per-vm free memory metrics
psafont Jun 26, 2025
0fef829
monitor_mem: Prepare xapi to consolidate memory metrics into a single…
psafont Jun 12, 2025
f601c12
rrdp-squeezed: move remaining memory metrics to this plugin
psafont Jun 12, 2025
fa5bc72
xcp-rrdd: remove duplicated code to fetch domains
psafont Jun 26, 2025
1b20f51
Move collection of memory metrics from xcp-rrdd to rrdp-squeezed (#6561)
psafont Jun 27, 2025
57cbad4
Move common retry_econnrefused function to xcp_client
snwoods Jun 25, 2025
f9e7969
CP-54207: Move VBD_attach outside of VM migrate downtime (#6489)
snwoods Jul 1, 2025
267c414
CA-412636: hostname changed to localhost with static IP and reboot
liulinC Jun 17, 2025
aa1653a
CA-412636: hostname changed to localhost with static IP and reboot (#…
liulinC Jul 1, 2025
4927eef
Add mlis for observer_helpers and observer_skeleton
snwoods Jun 16, 2025
fc5f98b
CA-393417: Drop device controller of cgroup v1
liulinC Jul 1, 2025
83a4888
xenopsd: set xen-platform-pci-bar-uc key in xenstore
AnthoineB Jun 27, 2025
56bd7c6
CP-308455 VM.sysprep start with skeleton
Jun 9, 2025
8d35ebc
CP-308455 VM.sysprep implement mkdtemp
Jun 11, 2025
c6bee52
CP-308455 VM.sysprep make iso
Jun 12, 2025
0e6f6ee
CP-308455 VM.sysprep Add logging
Jun 12, 2025
b88c199
CP-308455 VM.sysprep Add SR creation
Jun 12, 2025
2061e2e
CP-308455 VM.sysprep Find VBD for VM's CDR
Jun 16, 2025
b22f441
CP-308455 VM.sysprep Implement trigger
Jun 17, 2025
84e5a47
CP-308455 VM.sysprep log sysprep status
Jun 18, 2025
6372672
CP-308455 VM.sysprep watch execution, clean up
Jun 18, 2025
bf3ef79
CP-308455 VM.sysprep add feature flag
Jun 19, 2025
4c3e27d
CP-308455 VM.syspreo add some comments
Jun 19, 2025
20e33e7
CP-308455 VM.sysprep unify error handling
Jun 20, 2025
57dbab7
CP-308455 VM.sysprep list genisoimage as resource
Jun 23, 2025
b16b6d8
CP-308455 VM.sysprep improve error handling, use API.Client
Jun 23, 2025
c9e3bfd
CP-308455 VM.sysprep declare XML content as SecretString
Jul 1, 2025
903737d
Revert "CP-308455 VM.sysprep declare XML content as SecretString"
Jul 2, 2025
6118d47
xapi_vm_lifecycle: Stop assuming PV driver's presence implies all fea…
last-genius Jun 30, 2025
3209c5f
Add mlis for observer_helpers and observer_skeleton (#6539)
snwoods Jul 2, 2025
a215870
CP-308455 Save backtrace in error case
Jul 2, 2025
01981bd
CP-308455 VM.sysprep create better SR name label
Jul 2, 2025
9ce41c5
CP-308455 improve locating local ISO SR
Jul 2, 2025
191db16
CP-308455 VM.sysprep save backtrace
Jul 2, 2025
d736b73
CP-308455 VM.sysprep fix saving backtrace
Jul 2, 2025
630ec57
CP-308455 VM.sysprep write VDI UUID to xenstore
Jul 2, 2025
eaf2050
CP-308455 VM.sysprep make delay configurable
Jul 2, 2025
9153fb5
CP-308455 VM.sysprep guard on_startup with feature flag
Jul 2, 2025
4fb79a7
Move common retry_econnrefused function to xcp_client (#6564)
snwoods Jul 3, 2025
813b8ec
Add VM.sysprep API call (#6547)
lindig Jul 3, 2025
c895469
xapi_vm_lifecycle: Disallow suspend when cant_suspend_reason is present
last-genius Jul 2, 2025
30c0ba1
CA-413304: Restore VBD.unplug function to keep old functionality
snwoods Jul 3, 2025
8017a4e
CP-308455 VM.sysprep make delay configurable
lindig Jul 3, 2025
232013d
CP-308455 VM.sysprep make delay configurable (#6570)
edwintorok Jul 3, 2025
5733419
`xapi_vm_lifecycle`: Improve feature handling, avoid crashes (#6569)
last-genius Jul 4, 2025
c941af3
Add a `qcow2-to-stdout` Python script (#6559)
last-genius Jul 4, 2025
0fd510f
CA-393417: Bind mount /proc/<pid> into chroot
liulinC Jul 4, 2025
7501f70
CA-413304: Restore VBD.unplug function to keep old functionality (#6571)
BengangY Jul 4, 2025
c725281
xapi-stdext-threads: calibrate ratio for delay times
psafont Jul 3, 2025
ce39acf
xapi-stdext-threads: calibrate ratio for delay times (#6568)
psafont Jul 7, 2025
51a97e7
Downgrade unknown SM.feature errors to warnings
gthvn1 Jul 7, 2025
03980fc
CP-308455 VM.sysprep use watch to detect sysprep running
edwintorok Jul 3, 2025
a124c37
Downgrade unknown SM.feature errors to warnings (#6578)
lindig Jul 7, 2025
5be84a4
CP-308455 VM.sysprep use watch to detect sysprep running (#6579)
last-genius Jul 7, 2025
5416081
CA-393417: Fix CI failure
liulinC Jul 7, 2025
5a4e109
CA-393417: Drop device controller of cgroup v1 and fix USB passthroug…
liulinC Jul 8, 2025
41cb7df
datamodel_lifecycle: automatic update
BengangY Jul 8, 2025
9c145a0
datamodel_lifecycle: automatic update (#6581)
psafont Jul 8, 2025
12826e8
CA-413412: Fail to designate new master
BengangY Jul 8, 2025
278ab35
CA-413412: Fail to designate new master (#6582)
BengangY Jul 9, 2025
97e50cf
CA-413424: Enhance xe help output
BengangY Jul 10, 2025
d958124
XSI-1954: Only block pool join for clustering on non-management VLAN
gangj Jul 10, 2025
a182d52
XSI-1954: Only block pool join for clustering on non-management VLAN …
gangj Jul 10, 2025
761ca78
CP-308455 VM.sysprep add timeout parameter
Jul 10, 2025
db14926
CP-308455 VM.sysprep wait for shutdown
Jul 11, 2025
25154ce
CP-308455 VM.sysprep update documentation
Jul 11, 2025
e75712e
CP-308455 VM.sysprep wait for "action" key to disappear
Jul 11, 2025
6005231
xapi_sr_operations: Report more useful info when raising other_operat…
last-genius Jul 11, 2025
fd6d4f8
CP-308455 VM.sysprep wait for shutdown (#6587)
lindig Jul 14, 2025
d80df84
CA-413713: Change bash-completion shortcut
rosslagerwall Jul 14, 2025
11e9e2b
CA-413713: Change bash-completion shortcut (#6589)
edwintorok Jul 14, 2025
f721629
Replace `List.fold_left (||) false (List.map f lst)` with `List.exist…
last-genius Jul 15, 2025
b03d87d
Replace `List.fold_left (||) false (List.map f lst)` with `List.exist…
last-genius Jul 15, 2025
8378a9d
xenopsd: set xen-platform-pci-bar-uc key in xenstore (#6566)
edwintorok Jul 15, 2025
37a42e0
CP-308875: set Xen PCI MMIO BAR to WB
edwintorok Jul 11, 2025
19fa4d2
CP-308875: set Xen PCI MMIO BAR to WB (#6591)
edwintorok Jul 15, 2025
ac52de9
Add message argument to LICENSE_CHECKOUT_ERROR
robhoes Jul 11, 2025
bef6739
Add message argument to LICENSE_CHECKOUT_ERROR (#6592)
robhoes Jul 16, 2025
2ec4461
xapi_cluster_helpers: Correctly report other_operation_in_progress error
last-genius Jul 11, 2025
b6fb47c
xapi_vm_lifecycle: Correctly report other_operation_in_progress error
last-genius Jul 11, 2025
0f57ba8
qcow-stream-tool: Add a minimal CLI wrapper for Qcow_stream
last-genius Jul 16, 2025
d5d9999
{export,import}_raw_vdi: add qcow as supported format
last-genius May 1, 2025
c86e261
export_raw_vdi: Add support for differential QCOW2 export with base
last-genius May 15, 2025
2364685
Integrate QCOW2 VDI import-export (#6593)
last-genius Jul 16, 2025
832eda5
CP-52334 MVD - add -d option to mock driver-tool
Jul 17, 2025
e8ade77
xapi_vbd_helpers: Fix operation reporting when raising other_operatio…
last-genius Jul 11, 2025
d8a24ef
xapi_vdi: Report more useful information when raising other_operation…
last-genius Jul 11, 2025
8015edb
xapi_{vif,vusb}_helpers: Report more useful information when raising …
last-genius Jul 11, 2025
cbd5f17
message_forwarding: Report more info when raising other_operation_in_…
last-genius Jul 11, 2025
c5773da
xapi_pool_helpers: Report more info when raising other_operation_in_p…
last-genius Jul 11, 2025
8923f7a
xapi_pif: Report more info when raising other_operation_in_progress e…
last-genius Jul 11, 2025
443a317
xapi_vm_appliance_lifecycle: Report more info when raising other_oper…
last-genius Jul 11, 2025
0b843b6
xapi_vbd: Report more useful info when raising other_operation_in_pro…
last-genius Jul 11, 2025
d797d79
xapi_host_helpers: Report more useful info when raising other_operati…
last-genius Jul 14, 2025
3500de1
xapi/helpers: Fix handling of other_operation_in_progress delays
last-genius Jul 11, 2025
615aa21
idl/datamodel_errors: Add operation_{type,ref} to other_operation_in_…
last-genius Jul 14, 2025
5e895af
Adjust tests after other_operation_in_progress refactoring
last-genius Jul 14, 2025
577186e
Improve `other_operation_in_progress` error users, fix handling of it…
last-genius Jul 18, 2025
f6238a0
CP-52334 MVD - add -d option to mock driver-tool (#6595)
lindig Jul 18, 2025
c185101
CA-413424: Enhance xe help output (#6584)
lindig Jul 18, 2025
db5ad7d
Merge master to feature branch
LunfanZhang Jul 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ install-extra:
DESTDIR=$(DESTDIR) SBINDIR=$(SBINDIR) QEMU_WRAPPER_DIR=$(QEMU_WRAPPER_DIR) XENOPSD_LIBEXECDIR=$(XENOPSD_LIBEXECDIR) ETCDIR=$(ETCDIR) ./ocaml/xenopsd/scripts/make-custom-xenopsd.conf

# common flags and packages for 'dune install' and 'dune uninstall'
DUNE_IU_PACKAGES1=-j $(JOBS) --destdir=$(DESTDIR) --prefix=$(PREFIX) --libdir=$(LIBDIR) --mandir=$(MANDIR)
DUNE_IU_COMMON=-j $(JOBS) --destdir=$(DESTDIR) --libdir=$(LIBDIR) --mandir=$(MANDIR)
DUNE_IU_PACKAGES1=$(DUNE_IU_COMMON) --prefix=$(PREFIX)
DUNE_IU_PACKAGES1+=--libexecdir=$(XENOPSD_LIBEXECDIR) --datadir=$(SDKDIR)
DUNE_IU_PACKAGES1+=xapi-client xapi-schema xapi-consts xapi-cli-protocol xapi-datamodel xapi-types
DUNE_IU_PACKAGES1+=xen-api-client xen-api-client-lwt rrdd-plugin rrd-transport
Expand All @@ -163,17 +164,17 @@ install-dune1:
# dune can install libraries and several other files into the right locations
dune install $(DUNE_IU_PACKAGES1)

DUNE_IU_PACKAGES2=-j $(JOBS) --destdir=$(DESTDIR) --prefix=$(OPTDIR) --libdir=$(LIBDIR) --mandir=$(MANDIR) --libexecdir=$(OPTDIR)/libexec --datadir=$(DOCDIR) xapi xe
DUNE_IU_PACKAGES2=$(DUNE_IU_COMMON) --prefix=$(OPTDIR) --libexecdir=$(OPTDIR)/libexec --datadir=$(DOCDIR) xapi xe

install-dune2:
dune install $(DUNE_IU_PACKAGES2)

DUNE_IU_PACKAGES3=-j $(JOBS) --destdir=$(DESTDIR) --prefix=$(OPTDIR) --libdir=$(LIBDIR) --mandir=$(MANDIR) --libexecdir=$(OPTDIR)/libexec --bindir=$(OPTDIR)/debug --datadir=$(OPTDIR)/debug xapi-debug
DUNE_IU_PACKAGES3=$(DUNE_IU_COMMON) --prefix=$(OPTDIR) --libexecdir=$(OPTDIR)/libexec --bindir=$(OPTDIR)/debug --datadir=$(OPTDIR)/debug xapi-debug

install-dune3:
dune install $(DUNE_IU_PACKAGES3)

DUNE_IU_PACKAGES4=-j $(JOBS) --destdir=$(DESTDIR) --prefix=$(PREFIX) --libdir=$(LIBDIR) --libexecdir=/usr/libexec --mandir=$(MANDIR) vhd-tool forkexec
DUNE_IU_PACKAGES4=$(DUNE_IU_COMMON) --prefix=$(PREFIX) --libexecdir=/usr/libexec vhd-tool forkexec qcow-stream-tool

install-dune4:
dune install $(DUNE_IU_PACKAGES4)
Expand All @@ -186,7 +187,7 @@ install:
chmod +x $(DESTDIR)$(DOCDIR)/doc-convert.sh
# backward compat with existing specfile, to be removed after it is updated
find $(DESTDIR) -name '*.cmxs' -delete
for pkg in xapi-debug xapi xe xapi-tools xapi-sdk vhd-tool; do for f in CHANGELOG LICENSE README.markdown; do rm $(DESTDIR)$(OPTDIR)/doc/$$pkg/$$f $(DESTDIR)$(PREFIX)/doc/$$pkg/$$f -f; done; for f in META dune-package opam; do rm $(DESTDIR)$(LIBDIR)/$$pkg/$$f -f; done; done;
for pkg in xapi-debug xapi xe xapi-tools xapi-sdk vhd-tool qcow-stream-tool; do for f in CHANGELOG LICENSE README.markdown; do rm $(DESTDIR)$(OPTDIR)/doc/$$pkg/$$f $(DESTDIR)$(PREFIX)/doc/$$pkg/$$f -f; done; for f in META dune-package opam; do rm $(DESTDIR)$(LIBDIR)/$$pkg/$$f -f; done; done;


uninstall:
Expand Down
138 changes: 114 additions & 24 deletions doc/content/design/sm-supported-image-formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Add supported image formats in sm-list
layout: default
design_doc: true
revision: 2
revision: 3
status: proposed
---

Expand All @@ -22,32 +22,16 @@ available formats.
# Design Proposal

To expose the available image formats to clients (e.g., XenCenter, XenOrchestra, etc.),
we propose adding a new field called `supported-image-formats` to the Storage Manager (SM)
module. This field will be included in the output of the `SM.get_all_records` call.
we propose adding a new field called `supported_image_formats` to the Storage Manager
(SM) module. This field will be included in the output of the `SM.get_all_records` call.

The `supported-image-formats` field will be populated by retrieving information
from the SMAPI drivers. Specifically, each driver will update its `DRIVER_INFO`
dictionary with a new key, `supported_image_formats`, which will contain a list
of strings representing the supported image formats
(for example: `["vhd", "raw", "qcow2"]`).

The list designates the driver's preferred VDI format as its first entry. That
means that when migrating a VDI, the destination storage repository will
attempt to create a VDI in this preferred format. If the default format cannot
be used (e.g., due to size limitations), an error will be generated.

If a driver does not provide this information (as is currently the case with existing
drivers), the default value will be an empty array. This signifies that it is the
driver that decides which format it will use. This ensures that the modification
remains compatible with both current and future drivers.

With this new information, listing all parameters of the SM object will return:
- With this new information, listing all parameters of the SM object will return:

```bash
# xe sm-list params=all
```

will output something like:
Output of the command will look like (notice that CLI uses hyphens):

```
uuid ( RO) : c6ae9a43-fff6-e482-42a9-8c3f8c533e36
Expand All @@ -65,12 +49,118 @@ required-cluster-stack ( RO) :
supported-image-formats ( RO) : vhd, raw, qcow2
```

This change impacts the SM data model, and as such, the XAPI database version will
be incremented.
## Implementation details

The `supported_image_formats` field will be populated by retrieving information
from the SMAPI drivers. Specifically, each driver will update its `DRIVER_INFO`
dictionary with a new key, `supported_image_formats`, which will contain a list
of strings representing the supported image formats
(for example: `["vhd", "raw", "qcow2"]`). Although the formats are listed as a
list of strings, they are treated as a set-specifying the same format multiple
times has no effect.

### Driver behavior without `supported_image_formats`

If a driver does not provide this information (as is currently the case with
existing drivers), the default value will be an empty list. This signifies
that the driver determines which format to use when creating VDI. During a migration,
the destination driver will choose the format of the VDI if none is explicitly
specified. This ensures backward compatibility with both current and future drivers.

### Specifying image formats for VDIs creation

If the supported image format is exposed to the client, then, when creating new VDI,
user can specify the desired format via the `sm_config` parameter `image-format=qcow2` (or
any format that is supported). If no format is specified, the driver will use its
preferred default format. If the specified format is not supported, an error will be
generated indicating that the SR does not support it. Here is how it can be achieved
using the XE CLI:

```bash
# xe vdi-create \
sr-uuid=cbe2851e-9f9b-f310-9bca-254c1cf3edd8 \
name-label="A new VDI" \
virtual-size=10240 \
sm-config:image-format=vhd
```

### Specifying image formats for VDIs migration

When migrating a VDI, an API client may need to specify the desired image format if
the destination SR supports multiple storage formats.

#### VDI pool migrate

To support this, a new parameter, `dest_img_format`, is introduced to
`VDI.pool_migrate`. This field accepts a string specifying the desired format (e.g., *qcow2*),
ensuring that the VDI is migrated in the correct format. The new signature of
`VDI.pool_migrate` will be
`VDI ref pool_migrate (session ref, VDI ref, SR ref, string, (string -> string) map)`.

If the specified format is not supported or cannot be used (e.g., due to size limitations),
an error will be generated. Validation will be performed as early as possible to prevent
disruptions during migration. These checks can be performed by examining the XAPI database
to determine whether the SR provided as the destination has a corresponding SM object with
the expected format. If this is not the case, a `format not found` error will be returned.
If no format is specified by the client, the destination driver will determine the appropriate
format.

```bash
# xe vdi-pool-migrate \
uuid=<VDI_UUID> \
sr-uuid=<SR_UUID> \
dest-img-format=qcow2
```

#### VM migration to remote host

A VDI migration can also occur during a VM migration. In this case, we need to
be able to specify the expected destination format as well. Unlike `VDI.pool_migrate`,
which applies to a single VDI, VM migration may involve multiple VDIs.
The current signature of `VM.migrate_send` is `(session ref, VM ref, (string -> string) map,
bool, (VDI ref -> SR ref) map, (VIF ref -> network ref) map, (string -> string) map,
(VGPU ref -> GPU_group ref) map)`. Thus there is already a parameter that maps each source
VDI to its destination SR. We propose to add a new parameter that allows specifying the
desired destination format for a given source VDI: `(VDI ref -> string)`. It is
similar to the VDI-to-SR mapping. We will update the XE cli to support this new format.
It would be `image_format:<source-vdi-uuid>=<destination-image-format>`:

```bash
# xe vm-migrate \
host-uuid=<HOST_UUID> \
remote-master=<IP> \
remote-password=<PASS> \
remote-username=<USER> \
vdi:<VDI1_UUID>=<SR1_DEST_UUID> \
vdi:<VDI2_UUID>=<SR2_DEST_UUID> \
image-format:<VDI1_UUID>=vhd \
image-format:<VDI2_UUID>=qcow2 \
uuid=<VM_UUID>
```
The destination image format would be a string such as *vhd*, *qcow2*, or another
supported format. It is optional to specify a format. If omitted, the driver
managing the destination SR will determine the appropriate format.
As with VDI pool migration, if this parameter is not supported by the SM driver,
a `format not found` error will be returned. The validation must happen before
sending a creation message to the SM driver, ideally at the same time as checking
whether all VDIs can be migrated.

To be able to check the format, we will need to modify `VM.assert_can_migrate` and
add the mapping from VDI references to their image formats, as is done in `VM.migrate_send`.

# Impact

- **Data Model:** A new field (`supported-image-formats`) is added to the SM records.
It should have no impact on existing storage repositories that do not provide any information
about the supported image format.

This change impacts the SM data model, and as such, the XAPI database version will
be incremented. It also impacts the API.

- **Data Model:**
- A new field (`supported_image_formats`) is added to the SM records.
- A new parameter is added to `VM.migrate_send`: `(VDI ref -> string) map`
- A new parameter is added to `VM.assert_can_migrate`: `(VDI ref -> string) map`
- A new parameter is added to `VDI.pool_migrate`: `string`
- **Client Awareness:** Clients like the `xe` CLI will now be able to query and display the supported image formats for a given SR.
- **Database Versioning:** The XAPI database version will be updated to reflect this change.

9 changes: 9 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,15 @@
:with-test
(>= "2.4.0")))))

(package
(name qcow-stream-tool)
(synopsis "Minimal CLI wrapper for qcow-stream")
(depends
qcow-stream
cmdliner
)
)

(package
(name varstored-guard))

Expand Down
30 changes: 8 additions & 22 deletions ocaml/idl/datamodel_errors.ml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ let _ =
"The license-server connection details (address or port) were missing or \
incomplete."
() ;
error Api_errors.license_checkout_error ["reason"]
error Api_errors.license_checkout_error ["code"; "message"]
~doc:"The license for the edition you requested is not available." () ;
error Api_errors.license_file_deprecated []
~doc:
Expand Down Expand Up @@ -532,31 +532,14 @@ let _ =
"You attempted an operation on a VM which requires a more recent version \
of the PV drivers. Please upgrade your PV drivers."
() ;
error Api_errors.vm_lacks_feature_shutdown ["vm"]
~doc:
"You attempted an operation which needs the cooperative shutdown feature \
on a VM which lacks it."
() ;
error Api_errors.vm_lacks_feature_vcpu_hotplug ["vm"]
~doc:
"You attempted an operation which needs the VM hotplug-vcpu feature on a \
VM which lacks it."
() ;
error Api_errors.vm_lacks_feature_suspend ["vm"]
~doc:
"You attempted an operation which needs the VM cooperative suspend \
feature on a VM which lacks it."
() ;
error Api_errors.vm_lacks_feature_static_ip_setting ["vm"]
~doc:
"You attempted an operation which needs the VM static-ip-setting feature \
on a VM which lacks it."
() ;
error Api_errors.vm_lacks_feature ["vm"]
~doc:"You attempted an operation on a VM which lacks the feature." () ;
error Api_errors.vm_non_suspendable ["vm"; "reason"]
~doc:"You attempted an operation on a VM which is not suspendable." () ;
error Api_errors.vm_is_template ["vm"]
~doc:"The operation attempted is not valid for a template VM" () ;
error Api_errors.other_operation_in_progress ["class"; "object"]
error Api_errors.other_operation_in_progress
["class"; "object"; "operation_type"; "operation_ref"]
~doc:"Another operation involving the object is currently in progress" () ;
error Api_errors.vbd_not_removable_media ["vbd"]
~doc:"Media could not be ejected because it is not removable" () ;
Expand Down Expand Up @@ -2071,6 +2054,9 @@ let _ =
enable it in XC or run xe pool-enable-tls-verification instead."
() ;

error Api_errors.sysprep ["vm"; "message"]
~doc:"VM.sysprep error with details in the message" () ;

message
(fst Api_messages.ha_pool_overcommitted)
~doc:
Expand Down
2 changes: 2 additions & 0 deletions ocaml/idl/datamodel_lifecycle.ml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ let prototyped_of_message = function
Some "25.2.0"
| "host", "set_numa_affinity_policy" ->
Some "24.0.0"
| "VM", "sysprep" ->
Some "25.24.0"
| "VM", "get_secureboot_readiness" ->
Some "24.17.0"
| "VM", "set_uefi_mode" ->
Expand Down
15 changes: 15 additions & 0 deletions ocaml/idl/datamodel_vm.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2211,6 +2211,7 @@ let operations =
; ("reverting", "Reverting the VM to a previous snapshotted state")
; ("destroy", "refers to the act of uninstalling the VM")
; ("create_vtpm", "Creating and adding a VTPM to this VM")
; ("sysprep", "Performing a Windows sysprep on this VM")
]
)

Expand Down Expand Up @@ -2369,6 +2370,19 @@ let restart_device_models =
~allowed_roles:(_R_VM_POWER_ADMIN ++ _R_CLIENT_CERT)
()

let sysprep =
call ~name:"sysprep" ~lifecycle:[]
~params:
[
(Ref _vm, "self", "The VM")
; (String, "unattend", "XML content passed to sysprep")
; (Float, "timeout", "timeout in seconds for expected reboot")
]
~doc:
"Pass unattend.xml to Windows sysprep and wait for the VM to shut down \
as part of a reboot."
~allowed_roles:_R_VM_ADMIN ()

let vm_uefi_mode =
Enum
( "vm_uefi_mode"
Expand Down Expand Up @@ -2571,6 +2585,7 @@ let t =
; set_blocked_operations
; add_to_blocked_operations
; remove_from_blocked_operations
; sysprep
]
~contents:
([
Expand Down
2 changes: 1 addition & 1 deletion ocaml/idl/schematest.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ let hash x = Digest.string x |> Digest.to_hex
(* BEWARE: if this changes, check that schema has been bumped accordingly in
ocaml/idl/datamodel_common.ml, usually schema_minor_vsn *)

let last_known_schema_hash = "a030fa0233a69a33200b628af0f030c7"
let last_known_schema_hash = "7586cb039918e573594fc358e90b0f04"

let current_schema_hash : string =
let open Datamodel_types in
Expand Down
Loading
Loading