Skip to content

Commit c81e182

Browse files
committed
Design proposal for supported image formats (v3)
In this version we added explanation about how to choose the format when the VDI is created but also the destination format during migration. We also fix some typos. Signed-off-by: Guillaume <[email protected]>
1 parent 5ec5732 commit c81e182

File tree

1 file changed

+61
-25
lines changed

1 file changed

+61
-25
lines changed

doc/content/design/sm-supported-image-formats.md

+61-25
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Add supported image formats in sm-list
33
layout: default
44
design_doc: true
5-
revision: 2
5+
revision: 3
66
status: proposed
77
---
88

@@ -22,32 +22,16 @@ available formats.
2222
# Design Proposal
2323

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

28-
The `supported-image-formats` field will be populated by retrieving information
29-
from the SMAPI drivers. Specifically, each driver will update its `DRIVER_INFO`
30-
dictionary with a new key, `supported_image_formats`, which will contain a list
31-
of strings representing the supported image formats
32-
(for example: `["vhd", "raw", "qcow2"]`).
33-
34-
The list designates the driver's preferred VDI format as its first entry. That
35-
means that when migrating a VDI, the destination storage repository will
36-
attempt to create a VDI in this preferred format. If the default format cannot
37-
be used (e.g., due to size limitations), an error will be generated.
38-
39-
If a driver does not provide this information (as is currently the case with existing
40-
drivers), the default value will be an empty array. This signifies that it is the
41-
driver that decides which format it will use. This ensures that the modification
42-
remains compatible with both current and future drivers.
43-
44-
With this new information, listing all parameters of the SM object will return:
28+
- With this new information, listing all parameters of the SM object will return:
4529

4630
```bash
4731
# xe sm-list params=all
4832
```
4933

50-
will output something like:
34+
Output of the command will look like (Note: The `xe` CLI displays field names with hyphens.):
5135

5236
```
5337
uuid ( RO) : c6ae9a43-fff6-e482-42a9-8c3f8c533e36
@@ -65,12 +49,64 @@ required-cluster-stack ( RO) :
6549
supported-image-formats ( RO) : vhd, raw, qcow2
6650
```
6751

68-
This change impacts the SM data model, and as such, the XAPI database version will
69-
be incremented.
52+
## Implementation details
53+
54+
The `supported_image_formats` field will be populated by retrieving information
55+
from the SMAPI drivers. Specifically, each driver will update its `DRIVER_INFO`
56+
dictionary with a new key, `supported_image_formats`, which will contain a list
57+
of strings representing the supported image formats
58+
(for example: `["vhd", "raw", "qcow2"]`).
59+
60+
### Driver behavior without `supported_image_formats`
61+
62+
If a driver does not provide this information (as is currently the case with
63+
existing drivers), the default value will be an empty array (`[]`). This signifies
64+
that the driver determines which format to use when creating VDI. During a migration,
65+
the destination driver will choose the format of the VDI if none is explicitly
66+
specified. This ensures backward compatibility with both current and future drivers.
67+
68+
### Specifying image formats for VDIs creation
69+
70+
If the supported image format is exposed to the client, then when creating new VDI,
71+
user can specify the desired format via the `sm_config` parameter `type=qcow2` (or
72+
any format that is supported). If no format is specified, the driver will use its
73+
preferred default format.
74+
75+
```bash
76+
# xe vdi-create \
77+
sr-uuid=cbe2851e-9f9b-f310-9bca-254c1cf3edd8 \
78+
name-label="A new VDI" \
79+
virtual-size=10240 \
80+
sm-config:type=vhd
81+
```
82+
83+
### Specifying image formats for VDIs migration
84+
85+
When migrating a VDI, an API client may need to specify the desired image format if
86+
the destination SR supports multiple storage formats.
87+
88+
To support this, a new field, `destination_image_format`, will be introduced as a
89+
new parameter to `VDI.pool_migrate`. This field accepts a string specifying the
90+
desired format (e.g., *qcow2*, ...), ensuring that the VDI is migrated in the correct
91+
format.
92+
93+
If the specified format is unsupported or cannot be used (e.g., due to size limitations),
94+
an error will be returned. Validation will be performed as early as possible to prevent
95+
disruptions during migration. If no format is specified the destination driver will
96+
determine the appropriate format.
97+
98+
```bash
99+
# xe vdi-pool-migrate \
100+
uuid=44b3fe1a-d19a-4132-8513-52f5c3087ecc \
101+
sr-uuid=656bc0aa-a4ef-e378-0c67-1e2ce004989a \
102+
destination-image-format=qcow2
103+
```
70104

71105
# Impact
72106

73-
- **Data Model:** A new field (`supported-image-formats`) is added to the SM records.
107+
This change impacts the SM data model, and as such, the XAPI database version will
108+
be incremented.
109+
110+
- **Data Model:** A new field (`supported_image_formats`) is added to the SM records.
74111
- **Client Awareness:** Clients like the `xe` CLI will now be able to query and display the supported image formats for a given SR.
75112
- **Database Versioning:** The XAPI database version will be updated to reflect this change.
76-

0 commit comments

Comments
 (0)