[libvirt] [PATCH] Allow a HTTP URL for cdrom ISO image

Eric Blake eblake at redhat.com
Wed Aug 21 19:56:46 UTC 2013


On 08/21/2013 01:31 PM, Aline Manera wrote:
> From: Aline Manera <alinefm at br.ibm.com>
> 
> QEMU/KVM already allows an HTTP URL for the cdrom ISO image so add this support
> to libvirt as well.
> The xml should be as following:
> 
>     <disk type='network' device='cdrom'>
>       <source protocol='http' name='/url/path'>
>         <host name='host.name' port='80'/>
>       </source>
>     </disk>
> 
> Signed-off-by: Aline Manera <alinefm at br.ibm.com>
> ---
>  src/conf/domain_conf.c                             |    3 +-
>  src/conf/domain_conf.h                             |    1 +
>  src/qemu/qemu_command.c                            |    7 ++++
>  .../qemuxml2argv-disk-cdrom-network.args           |    5 +++
>  .../qemuxml2argv-disk-cdrom-network.xml            |   37 ++++++++++++++++++++
>  tests/qemuxml2argvtest.c                           |    2 ++
>  6 files changed, 54 insertions(+), 1 deletion(-)
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-network.args
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-network.xml

You also need to patch docs/schemas/domaincommon.rng to allow
'virt-xml-validate' to accept the new syntax, as well as
docs/formatdomain.html.in to describe how to use the new syntax.  The
.rng portion is especially important, as your patch fails 'make check'
without it.


> +++ b/src/qemu/qemu_command.c
> @@ -3826,6 +3826,13 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
>                      virBufferEscape(&opt, ',', ",", "%s,", disk->src);
>                  }
>                  break;
> +
> +            case VIR_DOMAIN_DISK_PROTOCOL_HTTP: {
> +                virBufferAsprintf(&opt, "file=http://%s:%s",
> +                                  disk->hosts->name,
> +                                  disk->hosts->port ? disk->hosts->port : "80");
> +                virBufferEscape(&opt, ',', ",", "%s,", disk->src);
> +                }

Missing a break.  Doesn't bite now, but makes future maintenance uglier.


> +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-network.args
> @@ -0,0 +1,5 @@
> +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /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=http://mirror.cogentco.com:80/pub/linux/fedora/linux/releases/19/Fedora/x86_64/iso/Fedora-19-x86_64-netinst.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

Fails 'make syntax-check':

prohibit_long_lines
tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-network.args:4:-drive
file=http://mirror.cogentco.com:80/pub/linux/fedora/linux/releases/19/Fedora/x86_64/iso/Fedora-19-x86_64-netinst.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 \
maint.mk: Wrap long lines in expected output files

Getting closer, though :)

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130821/a842ca16/attachment-0001.sig>


More information about the libvir-list mailing list