mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
Add ftp protocol support for cdrom disk
The ftp protocol is already recognized by qemu/KVM so add this support to libvirt as well. The xml should be as following: <disk type='network' device='cdrom'> <source protocol='ftp' name='/url/path'> <host name='host.name' port='21'/> </source> </disk> Signed-off-by: Aline Manera <alinefm@br.ibm.com>
This commit is contained in:
parent
3485ce4e9d
commit
796513d7cc
@ -1509,6 +1509,14 @@
|
|||||||
<target dev='hdc' bus='ide' tray='open'/>
|
<target dev='hdc' bus='ide' tray='open'/>
|
||||||
<readonly/>
|
<readonly/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<disk type='network' device='cdrom'>
|
||||||
|
<driver name='qemu' type='raw'/>
|
||||||
|
<source protocol="ftp" name="url_path">
|
||||||
|
<host name="hostname" port="21"/>
|
||||||
|
</source>
|
||||||
|
<target dev='hdc' bus='ide' tray='open'/>
|
||||||
|
<readonly/>
|
||||||
|
</disk>
|
||||||
<disk type='block' device='lun'>
|
<disk type='block' device='lun'>
|
||||||
<driver name='qemu' type='raw'/>
|
<driver name='qemu' type='raw'/>
|
||||||
<source dev='/dev/sda'/>
|
<source dev='/dev/sda'/>
|
||||||
|
@ -1212,6 +1212,7 @@
|
|||||||
<value>gluster</value>
|
<value>gluster</value>
|
||||||
<value>iscsi</value>
|
<value>iscsi</value>
|
||||||
<value>http</value>
|
<value>http</value>
|
||||||
|
<value>ftp</value>
|
||||||
</choice>
|
</choice>
|
||||||
</attribute>
|
</attribute>
|
||||||
<optional>
|
<optional>
|
||||||
|
@ -262,7 +262,8 @@ VIR_ENUM_IMPL(virDomainDiskProtocol, VIR_DOMAIN_DISK_PROTOCOL_LAST,
|
|||||||
"sheepdog",
|
"sheepdog",
|
||||||
"gluster",
|
"gluster",
|
||||||
"iscsi",
|
"iscsi",
|
||||||
"http")
|
"http",
|
||||||
|
"ftp")
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virDomainDiskProtocolTransport, VIR_DOMAIN_DISK_PROTO_TRANS_LAST,
|
VIR_ENUM_IMPL(virDomainDiskProtocolTransport, VIR_DOMAIN_DISK_PROTO_TRANS_LAST,
|
||||||
"tcp",
|
"tcp",
|
||||||
|
@ -541,6 +541,7 @@ enum virDomainDiskProtocol {
|
|||||||
VIR_DOMAIN_DISK_PROTOCOL_GLUSTER,
|
VIR_DOMAIN_DISK_PROTOCOL_GLUSTER,
|
||||||
VIR_DOMAIN_DISK_PROTOCOL_ISCSI,
|
VIR_DOMAIN_DISK_PROTOCOL_ISCSI,
|
||||||
VIR_DOMAIN_DISK_PROTOCOL_HTTP,
|
VIR_DOMAIN_DISK_PROTOCOL_HTTP,
|
||||||
|
VIR_DOMAIN_DISK_PROTOCOL_FTP,
|
||||||
|
|
||||||
VIR_DOMAIN_DISK_PROTOCOL_LAST
|
VIR_DOMAIN_DISK_PROTOCOL_LAST
|
||||||
};
|
};
|
||||||
|
@ -3833,6 +3833,12 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
disk->hosts->port ? disk->hosts->port : "80");
|
disk->hosts->port ? disk->hosts->port : "80");
|
||||||
virBufferEscape(&opt, ',', ",", "%s,", disk->src);
|
virBufferEscape(&opt, ',', ",", "%s,", disk->src);
|
||||||
break;
|
break;
|
||||||
|
case VIR_DOMAIN_DISK_PROTOCOL_FTP:
|
||||||
|
virBufferAsprintf(&opt, "file=ftp://%s:%s",
|
||||||
|
disk->hosts->name,
|
||||||
|
disk->hosts->port ? disk->hosts->port : "21");
|
||||||
|
virBufferEscape(&opt, ',', ",", "%s,", disk->src);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else if (disk->type == VIR_DOMAIN_DISK_TYPE_VOLUME) {
|
} else if (disk->type == VIR_DOMAIN_DISK_TYPE_VOLUME) {
|
||||||
if (qemuBuildVolumeString(conn, disk, &opt) < 0)
|
if (qemuBuildVolumeString(conn, disk, &opt) < 0)
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
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=ftp://host.name:21/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
|
@ -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='ftp' name='/url/path/file.iso'>
|
||||||
|
<host name='host.name' port='21'/>
|
||||||
|
</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>
|
@ -445,6 +445,8 @@ mymain(void)
|
|||||||
DO_TEST("disk-cdrom", NONE);
|
DO_TEST("disk-cdrom", NONE);
|
||||||
DO_TEST("disk-cdrom-network-http", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE,
|
DO_TEST("disk-cdrom-network-http", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE,
|
||||||
QEMU_CAPS_DRIVE);
|
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);
|
DO_TEST("disk-cdrom-empty", QEMU_CAPS_DRIVE);
|
||||||
DO_TEST("disk-cdrom-tray",
|
DO_TEST("disk-cdrom-tray",
|
||||||
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_TX_ALG);
|
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_TX_ALG);
|
||||||
|
Loading…
Reference in New Issue
Block a user