2
2
title : Add supported image formats in sm-list
3
3
layout : default
4
4
design_doc : true
5
- revision : 2
5
+ revision : 3
6
6
status : proposed
7
7
---
8
8
@@ -22,32 +22,16 @@ available formats.
22
22
# Design Proposal
23
23
24
24
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.
27
27
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:
45
29
46
30
``` bash
47
31
# xe sm-list params=all
48
32
```
49
33
50
- will output something like:
34
+ Output of the command will look like (Note: The ` xe ` CLI displays field names with hyphens.) :
51
35
52
36
```
53
37
uuid ( RO) : c6ae9a43-fff6-e482-42a9-8c3f8c533e36
@@ -65,12 +49,64 @@ required-cluster-stack ( RO) :
65
49
supported-image-formats ( RO) : vhd, raw, qcow2
66
50
```
67
51
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
+ ```
70
104
71
105
# Impact
72
106
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.
74
111
- ** Client Awareness:** Clients like the ` xe ` CLI will now be able to query and display the supported image formats for a given SR.
75
112
- ** Database Versioning:** The XAPI database version will be updated to reflect this change.
76
-
0 commit comments