Skip to content

Commit 61c6cd5

Browse files
committed
fixup! Design proposal to support import/export of Qcow2 VDI
1 parent d137934 commit 61c6cd5

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

doc/content/design/add-qcow-tool-for-vdi-import-export.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ add streaming support to `qcow-tool`.
5656
- Since the format is checked in the handler, we need to add support for `Qcow2`,
5757
as currently only `Raw`, `Tar`, and `Vhd` are supported.
5858
- This requires adding a new type in the `Importexport.Format` module and a new
59-
content type: `"application/qcow2"`.
59+
content type: `application/x-qemu-disk`.
60+
See [mime-types format](https://www.digipres.org/formats/mime-types/#application/x-qemu-disk).
6061
- This allows the format to be properly decoded. Currently, all formats use a
6162
wrapper called `Vhd_tool_wrapper`, which sets up parameters for `vhd-tool`.
6263
We need to add a new wrapper for the Qcow2 format, which will instead use
@@ -77,8 +78,44 @@ add streaming support to `qcow-tool`.
7778
`Vhd_tool_wrapper.send`, which calls `vhd-tool stream`.
7879
- It writes data from the source to a destination. Unlike `vhd-tool`, which
7980
supports multiple destinations, we will only support Qcow2 files.
81+
- Here is a typicall call to `vhd-tool stream`
82+
```sh
83+
/bin/vhd-tool stream \
84+
--source-protocol none \
85+
--source-format hybrid \
86+
--source /dev/sm/backend/ff1b27b1-3c35-972e-76ec-a56fe9f25e36/87711319-2b05-41a3-8ee0-3b63a2fc7035:/dev/VG_XenStorage-ff1b27b1-3c35-972e-76ec-a56fe9f25e36/VHD-87711319-2b05-41a3-8ee0-3b63a2fc7035 \
87+
--destination-protocol none \
88+
--destination-format vhd \
89+
--destination-fd 2585f988-7374-8131-5b66-77bbc239cbb2 \
90+
--tar-filename-prefix \
91+
--progress \
92+
--machine \
93+
--direct \
94+
--path /dev/mapper:.
95+
```
8096

8197
- To import a VDI from a Qcow2 file, we need to implement functionality similar
8298
to `Vhd_tool_wrapper.receive`, which calls `vhd-tool serve`.
8399
- This is the reverse of the export process. As with export, we will only
84100
support a single type of import: from a Qcow2 file.
101+
- Here is a typical call to `vhd-tool serve`
102+
```sh
103+
/bin/vhd-tool serve \
104+
--source-format raw \
105+
--source-protocol none \
106+
--source-fd 3451d7ed-9078-8b01-95bf-293d3bc53e7a \
107+
--tar-filename-prefix \
108+
--destination file:///dev/sm/backend/f939be89-5b9f-c7c7-e1e8-30c419ee5de6/4868ac1d-8321-4826-b058-952d37a29b82 \
109+
--destination-format raw \
110+
--progress \
111+
--machine \
112+
--direct \
113+
--destination-size 180405760 \
114+
--prezeroed
115+
```
116+
117+
- We don't need to propose different protocol and different format. As we will
118+
not support different formats we just to handle data copy from socket into file
119+
and from file to socket. Sockets and files will be managed into the
120+
`qcow_tool_wrapper`. The `forkhelpers.ml` manages the list of file descriptors
121+
and we will mimic what the vhd tool wrapper does to link a UUID to socket.

0 commit comments

Comments
 (0)