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

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

 



On Wed, Aug 21, 2013 at 04:31:03PM -0300, 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
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index ea49d2c..461cc95 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -261,7 +261,8 @@ VIR_ENUM_IMPL(virDomainDiskProtocol, VIR_DOMAIN_DISK_PROTOCOL_LAST,
>                "rbd",
>                "sheepdog",
>                "gluster",
> -              "iscsi")
> +              "iscsi",
> +              "http")
>  
>  VIR_ENUM_IMPL(virDomainDiskProtocolTransport, VIR_DOMAIN_DISK_PROTO_TRANS_LAST,
>                "tcp",
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 500a5be..77fa00c 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -540,6 +540,7 @@ enum virDomainDiskProtocol {
>      VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG,
>      VIR_DOMAIN_DISK_PROTOCOL_GLUSTER,
>      VIR_DOMAIN_DISK_PROTOCOL_ISCSI,
> +    VIR_DOMAIN_DISK_PROTOCOL_HTTP,
>  
>      VIR_DOMAIN_DISK_PROTOCOL_LAST
>  };
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index f151173..a7c6c8e 100644
> --- a/src/qemu/qemu_command.c
> +++ 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);
> +                }

No need for {} around case blocks which don't have local variables
defined. As Eric mentions, missing 'break' here.


While you're doing this, how about also adding 'ftp' protocol support ?

>              }
>          } else if (disk->type == VIR_DOMAIN_DISK_TYPE_VOLUME) {
>              if (qemuBuildVolumeString(conn, disk, &opt) < 0)

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
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]