]> xenbits.xensource.com Git - libvirt.git/commitdiff
Add https protocol support for cdrom disk
authorAline Manera <alinefm@br.ibm.com>
Mon, 16 Sep 2013 17:12:51 +0000 (14:12 -0300)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 17 Sep 2013 13:45:02 +0000 (14:45 +0100)
The https protocol is also accepted by qemu/KVM when specifying the cdrom ISO
image.

The xml should be as following:

    <disk type='network' device='cdrom'>
      <source protocol='https' name='/url/path'>
        <host name='host.name' port='443'/>
      </source>
    </disk>

Signed-off-by: Aline Manera <alinefm@br.ibm.com>
docs/formatdomain.html.in
docs/schemas/domaincommon.rng
src/conf/domain_conf.c
src/conf/domain_conf.h
src/qemu/qemu_command.c
tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-network-https.args [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-network-https.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c

index f5a36d903d17dbc42274b006c8264c4f738e11d3..240571fca3cd6657afea5c434b4250daae8ca62c 100644 (file)
       &lt;target dev='hdc' bus='ide' tray='open'/&gt;
       &lt;readonly/&gt;
     &lt;/disk&gt;
+    &lt;disk type='network' device='cdrom'&gt;
+      &lt;driver name='qemu' type='raw'/&gt;
+      &lt;source protocol="https" name="url_path"&gt;
+        &lt;host name="hostname" port="443"/&gt;
+      &lt;/source&gt;
+      &lt;target dev='hdc' bus='ide' tray='open'/&gt;
+      &lt;readonly/&gt;
+    &lt;/disk&gt;
     &lt;disk type='network' device='cdrom'&gt;
       &lt;driver name='qemu' type='raw'/&gt;
       &lt;source protocol="ftp" name="url_path"&gt;
index ecd3a42544f7c4ca40016d954268bfae4d47113e..2f91f0fe43f51891fae551a79e3a825a43d95734 100644 (file)
         <value>gluster</value>
         <value>iscsi</value>
         <value>http</value>
+        <value>https</value>
         <value>ftp</value>
       </choice>
     </attribute>
index e5fe9002419ce810fdc0919250f3fc39b17d3a34..04563f6e73fe86b92ef6556603537b28a3c9607b 100644 (file)
@@ -265,6 +265,7 @@ VIR_ENUM_IMPL(virDomainDiskProtocol, VIR_DOMAIN_DISK_PROTOCOL_LAST,
               "gluster",
               "iscsi",
               "http",
+              "https",
               "ftp")
 
 VIR_ENUM_IMPL(virDomainDiskProtocolTransport, VIR_DOMAIN_DISK_PROTO_TRANS_LAST,
index e4dfee9fc7644e4e99a9b12ccc53bd61afa4d4a6..d54b29e29cafae34ae36a1f9c7cb5aa270b55426 100644 (file)
@@ -543,6 +543,7 @@ enum virDomainDiskProtocol {
     VIR_DOMAIN_DISK_PROTOCOL_GLUSTER,
     VIR_DOMAIN_DISK_PROTOCOL_ISCSI,
     VIR_DOMAIN_DISK_PROTOCOL_HTTP,
+    VIR_DOMAIN_DISK_PROTOCOL_HTTPS,
     VIR_DOMAIN_DISK_PROTOCOL_FTP,
 
     VIR_DOMAIN_DISK_PROTOCOL_LAST
index 152143158f77ab23fa3a0305bb1961f457ce3ae2..883b5130f6425383b8cc5ec5808bca386cd7a04d 100644 (file)
@@ -3905,6 +3905,12 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
                                   disk->hosts->port ? disk->hosts->port : "80");
                 virBufferEscape(&opt, ',', ",", "%s,", disk->src);
                 break;
+            case VIR_DOMAIN_DISK_PROTOCOL_HTTPS:
+                virBufferAsprintf(&opt, "file=https://%s:%s",
+                                  disk->hosts->name,
+                                  disk->hosts->port ? disk->hosts->port : "443");
+                virBufferEscape(&opt, ',', ",", "%s,", disk->src);
+                break;
             case VIR_DOMAIN_DISK_PROTOCOL_FTP:
                 virBufferAsprintf(&opt, "file=ftp://%s:%s",
                                   disk->hosts->name,
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-network-https.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-network-https.args
new file mode 100644 (file)
index 0000000..affa794
--- /dev/null
@@ -0,0 +1,8 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/kvm -S \
+-M pc-1.2 -m 1024 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -boot d -usb \
+-drive \
+file=https://host.name:443/url/path/file.iso,if=none,media=cdrom,id=drive-ide0-1-0 \
+-device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-network-https.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-network-https.xml
new file mode 100644 (file)
index 0000000..b8a60ed
--- /dev/null
@@ -0,0 +1,37 @@
+<domain type='kvm'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-1.2'>hvm</type>
+    <boot dev='cdrom'/>
+  </os>
+  <features>
+    <acpi/>
+    <apic/>
+    <pae/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/bin/kvm</emulator>
+    <disk type='network' device='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source protocol='https' name='/url/path/file.iso'>
+        <host name='host.name' port='443'/>
+      </source>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <alias name='ide0-1-0'/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
index fdf1d3147da7452691dbb43d3848b4ce90118b7c..a11c9a88121e39c0dbd7da95e8c8e5445f05c297 100644 (file)
@@ -445,6 +445,8 @@ mymain(void)
     DO_TEST("disk-cdrom", NONE);
     DO_TEST("disk-cdrom-network-http", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE,
             QEMU_CAPS_DRIVE);
+    DO_TEST("disk-cdrom-network-https", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE,
+            QEMU_CAPS_DRIVE);
     DO_TEST("disk-cdrom-network-ftp", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE,
             QEMU_CAPS_DRIVE);
     DO_TEST("disk-cdrom-empty", QEMU_CAPS_DRIVE);