mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-08 22:15:21 +00:00
qemu: add new disk device='lun' for bus='virtio' & type='block'
In the past, generic SCSI commands issued from a guest to a virtio disk were always passed through to the underlying disk by qemu, and the kernel would also pass them on. As a result of CVE-2011-4127 (see: http://seclists.org/oss-sec/2011/q4/536), qemu now honors its scsi=on|off device option for virtio-blk-pci (which enables/disables passthrough of generic SCSI commands), and the kernel will only allow the commands for physical devices (not for partitions or logical volumes). The default behavior of qemu is still to allow sending generic SCSI commands to physical disks that are presented to a guest as virtio-blk-pci devices, but libvirt prefers to disable those commands in the standard virtio block devices, enabling it only when specifically requested (hopefully indicating that the requester understands what they're asking for). For this purpose, a new libvirt disk device type (device='lun') has been created. device='lun' is identical to the default device='disk', except that: 1) It is only allowed if bus='virtio', type='block', and the qemu version is "new enough" to support it ("new enough" == qemu 0.11 or better), otherwise the domain will fail to start and a CONFIG_UNSUPPORTED error will be logged). 2) The option "scsi=on" will be added to the -device arg to allow SG_IO commands (if device !='lun', "scsi=off" will be added to the -device arg so that SG_IO commands are specifically forbidden). Guests which continue to use disk device='disk' (the default) will no longer be able to use SG_IO commands on the disk; those that have their disk device changed to device='lun' will still be able to use SG_IO commands. *docs/formatdomain.html.in - document the new device attribute value. *docs/schemas/domaincommon.rng - allow it in the RNG *tests/* - update the args of several existing tests to add scsi=off, and add one new test that will test scsi=on. *src/conf/domain_conf.c - update domain XML parser and formatter *src/qemu/qemu_(command|driver|hotplug).c - treat VIR_DOMAIN_DISK_DEVICE_LUN *almost* identically to VIR_DOMAIN_DISK_DEVICE_DISK, except as indicated above. Note that no support for this new device value was added to any hypervisor drivers other than qemu, because it's unclear what it might mean (if anything) to those drivers.
This commit is contained in:
parent
e8daeeb136
commit
177db08775
@ -1001,8 +1001,17 @@
|
||||
"block", "dir", or "network"
|
||||
and refers to the underlying source for the disk. The optional
|
||||
<code>device</code> attribute indicates how the disk is to be exposed
|
||||
to the guest OS. Possible values for this attribute are "floppy", "disk"
|
||||
and "cdrom", defaulting to "disk". The
|
||||
to the guest OS. Possible values for this attribute are
|
||||
"floppy", "disk", "cdrom", and "lun", defaulting to
|
||||
"disk". "lun" (<span class="since">since 0.9.10</span>) is only
|
||||
valid when type is "block" and the target element's "bus"
|
||||
attribute is "virtio", and behaves identically to "disk",
|
||||
except that generic SCSI commands from the guest are accepted
|
||||
and passed through to the physical device
|
||||
- also note that device='lun' will only be recognized for
|
||||
actual raw devices, never for individual partitions or LVM
|
||||
partitions (in those cases, the kernel will reject the generic
|
||||
SCSI commands, making it identical to device='disk'). The
|
||||
optional <code>snapshot</code> attribute indicates the default
|
||||
behavior of the disk during disk snapshots: "internal"
|
||||
requires a file format such as qcow2 that can store both the
|
||||
|
@ -794,6 +794,7 @@
|
||||
<value>floppy</value>
|
||||
<value>disk</value>
|
||||
<value>cdrom</value>
|
||||
<value>lun</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
|
@ -157,7 +157,8 @@ VIR_ENUM_IMPL(virDomainDisk, VIR_DOMAIN_DISK_TYPE_LAST,
|
||||
VIR_ENUM_IMPL(virDomainDiskDevice, VIR_DOMAIN_DISK_DEVICE_LAST,
|
||||
"disk",
|
||||
"cdrom",
|
||||
"floppy")
|
||||
"floppy",
|
||||
"lun")
|
||||
|
||||
VIR_ENUM_IMPL(virDomainDiskBus, VIR_DOMAIN_DISK_BUS_LAST,
|
||||
"ide",
|
||||
@ -3094,7 +3095,8 @@ virDomainDiskDefParseXML(virCapsPtr caps,
|
||||
if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
|
||||
def->readonly = 1;
|
||||
|
||||
if (def->device == VIR_DOMAIN_DISK_DEVICE_DISK &&
|
||||
if ((def->device == VIR_DOMAIN_DISK_DEVICE_DISK ||
|
||||
def->device == VIR_DOMAIN_DISK_DEVICE_LUN) &&
|
||||
!STRPREFIX((const char *)target, "hd") &&
|
||||
!STRPREFIX((const char *)target, "sd") &&
|
||||
!STRPREFIX((const char *)target, "vd") &&
|
||||
|
@ -230,6 +230,7 @@ enum virDomainDiskDevice {
|
||||
VIR_DOMAIN_DISK_DEVICE_DISK,
|
||||
VIR_DOMAIN_DISK_DEVICE_CDROM,
|
||||
VIR_DOMAIN_DISK_DEVICE_FLOPPY,
|
||||
VIR_DOMAIN_DISK_DEVICE_LUN,
|
||||
|
||||
VIR_DOMAIN_DISK_DEVICE_LAST
|
||||
};
|
||||
|
@ -1878,7 +1878,8 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
}
|
||||
if (bootable &&
|
||||
qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_BOOT) &&
|
||||
disk->device == VIR_DOMAIN_DISK_DEVICE_DISK &&
|
||||
(disk->device == VIR_DOMAIN_DISK_DEVICE_DISK ||
|
||||
disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) &&
|
||||
disk->bus != VIR_DOMAIN_DISK_BUS_IDE)
|
||||
virBufferAddLit(&opt, ",boot=on");
|
||||
if (disk->readonly &&
|
||||
@ -2024,6 +2025,29 @@ qemuBuildDriveDevStr(virDomainDiskDefPtr disk,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) {
|
||||
/* make sure that both the bus and the qemu binary support
|
||||
* type='lun' (SG_IO).
|
||||
*/
|
||||
if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) {
|
||||
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("disk device='lun' is not supported for bus='%s'"),
|
||||
bus);
|
||||
goto error;
|
||||
}
|
||||
if (disk->type != VIR_DOMAIN_DISK_TYPE_BLOCK) {
|
||||
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("disk device='lun' is not supported for type='%s'"),
|
||||
virDomainDiskTypeToString(disk->type));
|
||||
goto error;
|
||||
}
|
||||
if (!qemuCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SG_IO)) {
|
||||
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("disk device='lun' is not supported by this QEMU"));
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
switch (disk->bus) {
|
||||
case VIR_DOMAIN_DISK_BUS_IDE:
|
||||
virBufferAddLit(&opt, "ide-drive");
|
||||
@ -2052,6 +2076,14 @@ qemuBuildDriveDevStr(virDomainDiskDefPtr disk,
|
||||
virBufferAsprintf(&opt, ",event_idx=%s",
|
||||
virDomainVirtioEventIdxTypeToString(disk->event_idx));
|
||||
}
|
||||
if (qemuCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SCSI)) {
|
||||
/* if sg_io is true but the scsi option isn't supported,
|
||||
* that means it's just always on in this version of qemu.
|
||||
*/
|
||||
virBufferAsprintf(&opt, ",scsi=%s",
|
||||
(disk->device == VIR_DOMAIN_DISK_DEVICE_LUN)
|
||||
? "on" : "off");
|
||||
}
|
||||
if (qemuBuildDeviceAddressStr(&opt, &disk->info, qemuCaps) < 0)
|
||||
goto error;
|
||||
break;
|
||||
@ -4251,6 +4283,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
bootFloppy = 0;
|
||||
break;
|
||||
case VIR_DOMAIN_DISK_DEVICE_DISK:
|
||||
case VIR_DOMAIN_DISK_DEVICE_LUN:
|
||||
bootindex = bootDisk;
|
||||
bootDisk = 0;
|
||||
break;
|
||||
|
@ -4987,6 +4987,7 @@ qemuDomainAttachDeviceDiskLive(virConnectPtr conn,
|
||||
ret = qemuDomainChangeEjectableMedia(driver, vm, disk, false);
|
||||
break;
|
||||
case VIR_DOMAIN_DISK_DEVICE_DISK:
|
||||
case VIR_DOMAIN_DISK_DEVICE_LUN:
|
||||
if (disk->bus == VIR_DOMAIN_DISK_BUS_USB)
|
||||
ret = qemuDomainAttachUsbMassstorageDevice(conn, driver, vm,
|
||||
disk);
|
||||
@ -5109,6 +5110,7 @@ qemuDomainDetachDeviceDiskLive(struct qemud_driver *driver,
|
||||
|
||||
switch (disk->device) {
|
||||
case VIR_DOMAIN_DISK_DEVICE_DISK:
|
||||
case VIR_DOMAIN_DISK_DEVICE_LUN:
|
||||
if (disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO)
|
||||
ret = qemuDomainDetachPciDiskDevice(driver, vm, dev);
|
||||
else if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI)
|
||||
@ -9586,9 +9588,9 @@ static int qemuDomainSnapshotIsAllowed(virDomainObjPtr vm)
|
||||
* that succeed as well
|
||||
*/
|
||||
for (i = 0; i < vm->def->ndisks; i++) {
|
||||
if (vm->def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK &&
|
||||
(!vm->def->disks[i]->driverType ||
|
||||
STRNEQ(vm->def->disks[i]->driverType, "qcow2"))) {
|
||||
if ((vm->def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_LUN) ||
|
||||
(vm->def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK &&
|
||||
STRNEQ_NULLABLE(vm->def->disks[i]->driverType, "qcow2"))) {
|
||||
qemuReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("Disk '%s' does not support snapshotting"),
|
||||
vm->def->disks[i]->src);
|
||||
|
@ -162,8 +162,10 @@ qemuDomainCheckEjectableMedia(struct qemud_driver *driver,
|
||||
virDomainDiskDefPtr disk = vm->def->disks[i];
|
||||
struct qemuDomainDiskInfo info;
|
||||
|
||||
if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK)
|
||||
if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK ||
|
||||
disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) {
|
||||
continue;
|
||||
}
|
||||
|
||||
memset(&info, 0, sizeof(info));
|
||||
|
||||
|
@ -329,7 +329,8 @@ mymain(void)
|
||||
QEMU_CAPS_DRIVE_AIO,
|
||||
QEMU_CAPS_NO_SHUTDOWN,
|
||||
QEMU_CAPS_PCI_ROMBAR,
|
||||
QEMU_CAPS_NO_ACPI);
|
||||
QEMU_CAPS_NO_ACPI,
|
||||
QEMU_CAPS_VIRTIO_BLK_SG_IO);
|
||||
DO_TEST("qemu-kvm-0.12.1.2-rhel60", 12001, 1, 0,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
@ -376,7 +377,8 @@ mymain(void)
|
||||
QEMU_CAPS_USB_HUB,
|
||||
QEMU_CAPS_NO_SHUTDOWN,
|
||||
QEMU_CAPS_PCI_ROMBAR,
|
||||
QEMU_CAPS_NO_ACPI);
|
||||
QEMU_CAPS_NO_ACPI,
|
||||
QEMU_CAPS_VIRTIO_BLK_SG_IO);
|
||||
DO_TEST("qemu-kvm-0.12.3", 12003, 1, 0,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
@ -416,7 +418,8 @@ mymain(void)
|
||||
QEMU_CAPS_DRIVE_AIO,
|
||||
QEMU_CAPS_NO_SHUTDOWN,
|
||||
QEMU_CAPS_PCI_ROMBAR,
|
||||
QEMU_CAPS_NO_ACPI);
|
||||
QEMU_CAPS_NO_ACPI,
|
||||
QEMU_CAPS_VIRTIO_BLK_SG_IO);
|
||||
DO_TEST("qemu-kvm-0.13.0", 13000, 1, 0,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
@ -472,7 +475,8 @@ mymain(void)
|
||||
QEMU_CAPS_USB_HUB,
|
||||
QEMU_CAPS_NO_SHUTDOWN,
|
||||
QEMU_CAPS_PCI_ROMBAR,
|
||||
QEMU_CAPS_NO_ACPI);
|
||||
QEMU_CAPS_NO_ACPI,
|
||||
QEMU_CAPS_VIRTIO_BLK_SG_IO);
|
||||
DO_TEST("qemu-kvm-0.12.1.2-rhel61", 12001, 1, 0,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
@ -524,7 +528,9 @@ mymain(void)
|
||||
QEMU_CAPS_USB_HUB,
|
||||
QEMU_CAPS_NO_SHUTDOWN,
|
||||
QEMU_CAPS_PCI_ROMBAR,
|
||||
QEMU_CAPS_NO_ACPI);
|
||||
QEMU_CAPS_NO_ACPI,
|
||||
QEMU_CAPS_VIRTIO_BLK_SCSI,
|
||||
QEMU_CAPS_VIRTIO_BLK_SG_IO);
|
||||
DO_TEST("qemu-kvm-0.12.1.2-rhel62-beta", 12001, 1, 0,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
@ -584,7 +590,9 @@ mymain(void)
|
||||
QEMU_CAPS_USB_HUB,
|
||||
QEMU_CAPS_NO_SHUTDOWN,
|
||||
QEMU_CAPS_PCI_ROMBAR,
|
||||
QEMU_CAPS_NO_ACPI);
|
||||
QEMU_CAPS_NO_ACPI,
|
||||
QEMU_CAPS_VIRTIO_BLK_SCSI,
|
||||
QEMU_CAPS_VIRTIO_BLK_SG_IO);
|
||||
DO_TEST("qemu-1.0", 1000000, 0, 0,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
@ -648,7 +656,9 @@ mymain(void)
|
||||
QEMU_CAPS_PCI_ROMBAR,
|
||||
QEMU_CAPS_ICH9_AHCI,
|
||||
QEMU_CAPS_NO_ACPI,
|
||||
QEMU_CAPS_FSDEV_READONLY);
|
||||
QEMU_CAPS_FSDEV_READONLY,
|
||||
QEMU_CAPS_VIRTIO_BLK_SCSI,
|
||||
QEMU_CAPS_VIRTIO_BLK_SG_IO);
|
||||
|
||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
@ -9,9 +9,9 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
|
||||
-monitor unix:/tmp/test-monitor,server,nowait \
|
||||
-no-acpi \
|
||||
-drive file=/tmp/vda.img,if=none,id=drive-virtio-disk0 \
|
||||
-device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=3 \
|
||||
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=3 \
|
||||
-drive file=/tmp/vdb.img,if=none,id=drive-virtio-disk1 \
|
||||
-device virtio-blk-pci,bus=pci.0,addr=0x6,drive=drive-virtio-disk1,id=virtio-disk1 \
|
||||
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x6,drive=drive-virtio-disk1,id=virtio-disk1 \
|
||||
-drive file=/dev/HostVG/hda,if=none,id=drive-ide0-0-0 \
|
||||
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
|
||||
-drive file=/dev/HostVG/hdb,if=none,id=drive-ide0-0-1 \
|
||||
|
@ -10,9 +10,9 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
|
||||
-no-acpi \
|
||||
-boot dnca \
|
||||
-drive file=/tmp/vda.img,if=none,id=drive-virtio-disk0,boot=on \
|
||||
-device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 \
|
||||
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 \
|
||||
-drive file=/tmp/vdb.img,if=none,id=drive-virtio-disk1 \
|
||||
-device virtio-blk-pci,bus=pci.0,addr=0x6,drive=drive-virtio-disk1,id=virtio-disk1 \
|
||||
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x6,drive=drive-virtio-disk1,id=virtio-disk1 \
|
||||
-drive file=/dev/HostVG/hda,if=none,id=drive-ide0-0-0 \
|
||||
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
|
||||
-drive file=/dev/HostVG/hdb,if=none,id=drive-ide0-0-1 \
|
||||
|
@ -12,7 +12,7 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \
|
||||
-drive file=/root/boot.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,bootindex=1 \
|
||||
-drive file=sheepdog:example.org:6000:image,if=none,id=drive-virtio-disk0 \
|
||||
-device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=3 \
|
||||
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=3 \
|
||||
-drive file=/dev/null,if=none,id=drive-fdc0-0-1 \
|
||||
-global isa-fdc.driveB=drive-fdc0-0-1 \
|
||||
-global isa-fdc.bootindexB=4 \
|
||||
|
@ -3,7 +3,7 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
||||
-monitor unix:/tmp/test-monitor,server,nowait -no-acpi \
|
||||
-boot dc -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 \
|
||||
-drive file=/var/lib/libvirt/images/f14.img,if=none,id=drive-virtio-disk0 \
|
||||
-device virtio-blk-pci,ioeventfd=on,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0 \
|
||||
-device virtio-blk-pci,ioeventfd=on,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0 \
|
||||
-drive file=/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.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-net-pci,tx=bh,ioeventfd=off,vlan=0,id=net0,mac=52:54:00:e5:48:58,bus=pci.0,addr=0x3 \
|
||||
|
@ -13,8 +13,8 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \
|
||||
-drive file=/dev/HostVG/QEMUGuest2,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 \
|
||||
-drive file=/tmp/data.img,if=none,id=drive-virtio-disk0 \
|
||||
-device virtio-blk-pci,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,id=virtio-disk0 \
|
||||
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,id=virtio-disk0 \
|
||||
-drive file=/tmp/logs.img,if=none,id=drive-virtio-disk1 \
|
||||
-device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk1,id=virtio-disk1 \
|
||||
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk1,id=virtio-disk1 \
|
||||
-usb \
|
||||
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
|
||||
|
@ -5,6 +5,6 @@ encryptdisk -uuid 496898a6-e6ff-f7c8-5dc2-3cf410945ee9 -nographic -nodefconfig \
|
||||
path=//var/lib/libvirt/qemu/encryptdisk.monitor,server,nowait -mon \
|
||||
chardev=monitor,mode=readline -rtc base=utc -no-acpi -boot c -drive \
|
||||
file=/storage/guest_disks/encryptdisk,if=none,id=drive-virtio-disk0,boot=on,\
|
||||
format=qcow2 -device virtio-blk-pci,bus=pci.0,addr=0x4,\
|
||||
format=qcow2 -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,\
|
||||
drive=drive-virtio-disk0,id=virtio-disk0 -usb -device virtio-balloon-pci,\
|
||||
id=balloon0,bus=pci.0,addr=0x3
|
||||
|
@ -3,7 +3,7 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
||||
-monitor unix:/tmp/test-monitor,server,nowait -no-acpi \
|
||||
-boot dc -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 \
|
||||
-drive file=/var/lib/libvirt/images/f14.img,if=none,id=drive-virtio-disk0 \
|
||||
-device virtio-blk-pci,event_idx=on,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0 \
|
||||
-device virtio-blk-pci,event_idx=on,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0 \
|
||||
-drive file=/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.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-net-pci,event_idx=off,vlan=0,id=net0,mac=52:54:00:e5:48:58,bus=pci.0,addr=0x3 \
|
||||
|
11
tests/qemuxml2argvdata/qemuxml2argv-virtio-lun.args
Normal file
11
tests/qemuxml2argvdata/qemuxml2argv-virtio-lun.args
Normal file
@ -0,0 +1,11 @@
|
||||
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
||||
/usr/bin/qemu -S -M pc-0.13 -m 1024 -smp 1 -nodefaults \
|
||||
-monitor unix:/tmp/test-monitor,server,nowait -no-acpi \
|
||||
-boot dc -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 \
|
||||
-drive file=/dev/sdfake,if=none,id=drive-virtio-disk0 \
|
||||
-device virtio-blk-pci,scsi=on,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0 \
|
||||
-drive file=/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.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-net-pci,vlan=0,id=net0,mac=52:54:00:e5:48:58,bus=pci.0,addr=0x3 \
|
||||
-net user,vlan=0,name=hostnet0 -serial pty -usb -vnc 127.0.0.1:-809 -std-vga \
|
||||
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
|
57
tests/qemuxml2argvdata/qemuxml2argv-virtio-lun.xml
Normal file
57
tests/qemuxml2argvdata/qemuxml2argv-virtio-lun.xml
Normal file
@ -0,0 +1,57 @@
|
||||
<domain type='qemu'>
|
||||
<name>test</name>
|
||||
<uuid>bba65c0e-c049-934f-b6aa-4e2c0582acdf</uuid>
|
||||
<memory>1048576</memory>
|
||||
<currentMemory>1048576</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<os>
|
||||
<type arch='x86_64' machine='pc-0.13'>hvm</type>
|
||||
<boot dev='cdrom'/>
|
||||
<boot dev='hd'/>
|
||||
<bootmenu enable='yes'/>
|
||||
</os>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu</emulator>
|
||||
<disk type='block' device='lun'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<source dev='/dev/sdfake'/>
|
||||
<target dev='vda' bus='virtio'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</disk>
|
||||
<disk type='file' device='cdrom'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/>
|
||||
<target dev='hdc' bus='ide'/>
|
||||
<readonly/>
|
||||
<address type='drive' controller='0' bus='1' unit='0'/>
|
||||
</disk>
|
||||
<controller type='virtio-serial' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
|
||||
</controller>
|
||||
<controller type='ide' index='0'/>
|
||||
<interface type='user'>
|
||||
<mac address='52:54:00:e5:48:58'/>
|
||||
<model type='virtio'/>
|
||||
<driver name='vhost' event_idx='off'/>
|
||||
</interface>
|
||||
<serial type='pty'>
|
||||
<target port='0'/>
|
||||
</serial>
|
||||
<console type='pty'>
|
||||
<target type='serial' port='0'/>
|
||||
</console>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<graphics type='vnc' port='5091' autoport='no' listen='127.0.0.1'>
|
||||
<listen type='address' address='127.0.0.1'/>
|
||||
</graphics>
|
||||
<video>
|
||||
<model type='vga' vram='9216' heads='1'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
||||
</video>
|
||||
<memballoon model='virtio'/>
|
||||
</devices>
|
||||
</domain>
|
@ -342,12 +342,15 @@ mymain(void)
|
||||
QEMU_CAPS_BOOT_MENU, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
|
||||
QEMU_CAPS_BOOTINDEX);
|
||||
DO_TEST("boot-order", false,
|
||||
QEMU_CAPS_BOOTINDEX, QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE);
|
||||
QEMU_CAPS_BOOTINDEX, QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE,
|
||||
QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
|
||||
DO_TEST("boot-complex", false,
|
||||
QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT);
|
||||
QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT,
|
||||
QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
|
||||
DO_TEST("boot-complex-bootindex", false,
|
||||
QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT,
|
||||
QEMU_CAPS_BOOTINDEX);
|
||||
QEMU_CAPS_BOOTINDEX,
|
||||
QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
|
||||
DO_TEST("bootloader", true, QEMU_CAPS_DOMID);
|
||||
DO_TEST("bios", false, QEMU_CAPS_DEVICE, QEMU_CAPS_SGA);
|
||||
DO_TEST("clock-utc", false, NONE);
|
||||
@ -365,7 +368,8 @@ mymain(void)
|
||||
DO_TEST("disk-many", false, NONE);
|
||||
DO_TEST("disk-virtio", false, QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT);
|
||||
DO_TEST("disk-order", false,
|
||||
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE_BOOT);
|
||||
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE_BOOT,
|
||||
QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
|
||||
DO_TEST("disk-xenvbd", false, QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT);
|
||||
DO_TEST("disk-drive-boot-disk", false,
|
||||
QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT);
|
||||
@ -433,14 +437,20 @@ mymain(void)
|
||||
QEMU_CAPS_DRIVE_CACHE_V2, QEMU_CAPS_DRIVE_FORMAT);
|
||||
DO_TEST("disk-ioeventfd", false,
|
||||
QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_IOEVENTFD,
|
||||
QEMU_CAPS_VIRTIO_TX_ALG, QEMU_CAPS_DEVICE);
|
||||
QEMU_CAPS_VIRTIO_TX_ALG, QEMU_CAPS_DEVICE,
|
||||
QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
|
||||
DO_TEST("disk-snapshot", false,
|
||||
QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_CACHE_V2, QEMU_CAPS_DRIVE_FORMAT);
|
||||
DO_TEST("event_idx", false,
|
||||
QEMU_CAPS_DRIVE,
|
||||
QEMU_CAPS_VIRTIO_BLK_EVENT_IDX,
|
||||
QEMU_CAPS_VIRTIO_NET_EVENT_IDX,
|
||||
QEMU_CAPS_DEVICE);
|
||||
QEMU_CAPS_DEVICE,
|
||||
QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
|
||||
DO_TEST("virtio-lun", false,
|
||||
QEMU_CAPS_DRIVE,
|
||||
QEMU_CAPS_DEVICE,
|
||||
QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
|
||||
|
||||
DO_TEST("graphics-vnc", false, NONE);
|
||||
DO_TEST("graphics-vnc-socket", false, NONE);
|
||||
|
@ -190,6 +190,7 @@ mymain(void)
|
||||
DO_TEST("smp");
|
||||
DO_TEST("lease");
|
||||
DO_TEST("event_idx");
|
||||
DO_TEST("virtio-lun");
|
||||
|
||||
DO_TEST("usb-redir");
|
||||
DO_TEST("blkdeviotune");
|
||||
|
Loading…
Reference in New Issue
Block a user