Usage Examples - xenserver/transfervm GitHub Wiki

Using the CLI

Shows expose, get_record, unexpose, downloading the whole VDI via HTTP GET, and modifying a range via HTTP PUT.

Linebreaks added for readability.

[engp:root@sunburn ~]# xe host-call-plugin host-uuid=6ffb1440-2e99-4a76-ac07-e5d9c26cb47d plugin=transfer fn=expose \
args:vdi_uuid=4b26aeff-bc12-44f0-a5b6-2e07ec37e75c args:network_uuid=4f2b1664-cc89-f5cc-2404-fcba5da53c40 \
args:transfer_mode=http
dda7a17f-2621-a77a-0464-6d95a19fbbc3

[engp:root@sunburn ~]# xe host-call-plugin host-uuid=6ffb1440-2e99-4a76-ac07-e5d9c26cb47d plugin=transfer \
fn=get_record args:record_handle=dda7a17f-2621-a77a-0464-6d95a19fbbc3

<?xml version="1.0"?>
<transfer_record
  username="70f8e0b297fcdd94"
  status="exposed"
  url_path="/vdi_uuid_4b26aeff-bc12-44f0-a5b6-2e07ec37e75c"
  record_handle="dda7a17f-2621-a77a-0464-6d95a19fbbc3"
  ip="10.80.238.238"
  transfer_mode="http"
  url_full="http://70f8e0b297fcdd94:[email protected]:80/vdi_uuid_4b26aeff-bc12-44f0-a5b6-2e07ec37e75c"
  device="xvdn"
  use_ssl="false"
  password="8c21f66590fcb08e"
  port="80"
  vdi_uuid="4b26aeff-bc12-44f0-a5b6-2e07ec37e75c">
</transfer_record>

[engp:root@sunburn ~]# curl http://70f8e0b297fcdd94:[email protected]:80/vdi_uuid_4b26aeff-bc12-44f0-a5b6-2e07ec37e75c -o vdi

[engp:root@sunburn ~]# hexdump vdi
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
6800000

[engp:root@sunburn ~]# telnet 10.80.239.146 80
Trying 10.80.239.146...
Connected to 10.80.239.146.
Escape character is '^]'.
PUT /vdi_uuid_4b26aeff-bc12-44f0-a5b6-2e07ec37e75c HTTP/1.1
Authorization: Basic NTdkOTQxY2YzNDM4YTllYjo4MDU2YzNkMTMyNjg2ZGE5
Host: 10.80.239.146
Content-Range: bytes 100-107/109051904
Content-Length: 8

new data
HTTP/1.1 200 OK
Connection: close
Date: Mon, 21 Sep 2009 12:29:35 GMT
Server: lighttpd/1.4.20

[engp:root@sunburn ~]# curl http://70f8e0b297fcdd94:[email protected]:80/vdi_uuid_4b26aeff-bc12-44f0-a5b6-2e07ec37e75c -o vdi

[engp:root@sunburn ~]# hexdump -c vdi
0000000  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
*
0000060  \0  \0  \0  \0   n   e   w       d   a   t   a  \0  \0  \0  \0
0000070  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
*
6800000

[engp:root@sunburn ~]# xe host-call-plugin host-uuid=6ffb1440-2e99-4a76-ac07-e5d9c26cb47d plugin=transfer \
fn=unexpose args:record_handle=dda7a17f-2621-a77a-0464-6d95a19fbbc3
OK

[engp:root@sunburn ~]# xe host-call-plugin host-uuid=6ffb1440-2e99-4a76-ac07-e5d9c26cb47d plugin=transfer \
fn=get_record args:vdi_uuid=4b26aeff-bc12-44f0-a5b6-2e07ec37e75c
{'status': 'unused', 'vdi_uuid': '4b26aeff-bc12-44f0-a5b6-2e07ec37e75c'}