Re: [PATCH] Allow a HTTP URL for cdrom ISO image

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/21/2013 01:31 PM, Aline Manera wrote:
> From: Aline Manera <alinefm@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
> ---
>  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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]