Xen: xenconfig: remove disks from '(image)' sexpr

It has been quite some time since xend required specifying cdroms
and fds in '(image (hvm ...))'. Remove the code from the parsing
and formatting functions and fixup the associated tests.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
This commit is contained in:
Jim Fehlig 2015-12-14 17:44:30 -07:00
parent 87dce7a762
commit bec993d60a
20 changed files with 19 additions and 113 deletions

View File

@ -1317,74 +1317,6 @@ xenParseSxpr(const struct sexpr *root,
vncport) < 0)
goto error;
/* Old style cdrom config from Xen <= 3.0.2 */
if (hvm &&
xendConfigVersion == XEND_CONFIG_VERSION_3_0_2) {
tmp = sexpr_node(root, "domain/image/hvm/cdrom");
if ((tmp != NULL) && (tmp[0] != 0)) {
virDomainDiskDefPtr disk;
if (!(disk = virDomainDiskDefNew(NULL)))
goto error;
if (virDomainDiskSetSource(disk, tmp) < 0) {
virDomainDiskDefFree(disk);
goto error;
}
virDomainDiskSetType(disk, VIR_STORAGE_TYPE_FILE);
disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
if (VIR_STRDUP(disk->dst, "hdc") < 0) {
virDomainDiskDefFree(disk);
goto error;
}
if (virDomainDiskSetDriver(disk, "file") < 0) {
virDomainDiskDefFree(disk);
goto error;
}
disk->bus = VIR_DOMAIN_DISK_BUS_IDE;
disk->src->readonly = true;
if (VIR_APPEND_ELEMENT(def->disks, def->ndisks, disk) < 0) {
virDomainDiskDefFree(disk);
goto error;
}
}
}
/* Floppy disk config */
if (hvm) {
const char *const fds[] = { "fda", "fdb" };
size_t i;
for (i = 0; i < ARRAY_CARDINALITY(fds); i++) {
tmp = sexpr_fmt_node(root, "domain/image/hvm/%s", fds[i]);
if ((tmp != NULL) && (tmp[0] != 0)) {
virDomainDiskDefPtr disk;
if (!(disk = virDomainDiskDefNew(NULL)))
goto error;
if (virDomainDiskSetSource(disk, tmp) < 0) {
virDomainDiskDefFree(disk);
goto error;
}
virDomainDiskSetType(disk, VIR_STORAGE_TYPE_FILE);
disk->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY;
if (VIR_STRDUP(disk->dst, fds[i]) < 0) {
virDomainDiskDefFree(disk);
goto error;
}
if (virDomainDiskSetSource(disk, "file") < 0) {
virDomainDiskDefFree(disk);
goto error;
}
disk->bus = VIR_DOMAIN_DISK_BUS_FDC;
if (VIR_APPEND_ELEMENT(def->disks, def->ndisks, disk) < 0) {
virDomainDiskDefFree(disk);
goto error;
}
}
}
}
/* in case of HVM we have USB device emulation */
if (hvm &&
xenParseSxprUSB(def, root) < 0)
@ -2357,32 +2289,6 @@ xenFormatSxpr(virConnectPtr conn,
}
virBufferAsprintf(&buf, "(boot %s)", bootorder);
/* some disk devices are defined here */
for (i = 0; i < def->ndisks; i++) {
const char *src = virDomainDiskGetSource(def->disks[i]);
switch (def->disks[i]->device) {
case VIR_DOMAIN_DISK_DEVICE_CDROM:
/* Only xend <= 3.0.2 wants cdrom config here */
if (xendConfigVersion != XEND_CONFIG_VERSION_3_0_2)
break;
if (STRNEQ(def->disks[i]->dst, "hdc") || !src)
break;
virBufferEscapeSexpr(&buf, "(cdrom '%s')", src);
break;
case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
/* all xend versions define floppies here */
virBufferEscapeSexpr(&buf, "(%s ", def->disks[i]->dst);
virBufferEscapeSexpr(&buf, "'%s')", src);
break;
default:
break;
}
}
if (def->features[VIR_DOMAIN_FEATURE_ACPI] == VIR_TRISTATE_SWITCH_ON)
virBufferAddLit(&buf, "(acpi 1)");
if (def->features[VIR_DOMAIN_FEATURE_APIC] == VIR_TRISTATE_SWITCH_ON)

View File

@ -2,7 +2,7 @@
(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
(on_reboot 'restart')(on_crash 'restart')\
(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial none)\
(acpi 1)(usb 1)(parallel none)(serial none)\
(device_model '/usr/lib64/xen/bin/qemu-dm')(hpet 1)(vnc 1)))\
(localtime 0)\
(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))\

View File

@ -2,7 +2,7 @@
(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
(on_reboot 'restart')(on_crash 'restart')\
(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial none)\
(acpi 1)(usb 1)(parallel none)(serial none)\
(device_model '/usr/lib64/xen/bin/qemu-dm')(hpet 0)(vnc 1)))\
(localtime 0)\
(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))\

View File

@ -2,7 +2,7 @@
(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
(on_reboot 'restart')(on_crash 'restart')\
(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial none)\
(acpi 1)(usb 1)(parallel none)(serial none)\
(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))\
(localtime 1)\
(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))\

View File

@ -2,7 +2,7 @@
(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
(on_reboot 'restart')(on_crash 'restart')\
(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel tcp:localhost:9999)\
(acpi 1)(usb 1)(parallel tcp:localhost:9999)\
(serial none)(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))\
(localtime 0)\
(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))\

View File

@ -2,7 +2,7 @@
(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
(on_reboot 'restart')(on_crash 'restart')\
(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)\
(acpi 1)(usb 1)(parallel none)\
(serial (/dev/ttyS0 /dev/ttyS1))(device_model '/usr/lib64/xen/bin/qemu-dm')\
(vnc 1)))(localtime 0)\
(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')\

View File

@ -2,7 +2,7 @@
(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
(on_reboot 'restart')(on_crash 'restart')\
(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)\
(acpi 1)(usb 1)(parallel none)\
(serial (none /dev/ttyS1))(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))\
(localtime 0)\
(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))\

View File

@ -2,7 +2,7 @@
(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
(on_reboot 'restart')(on_crash 'restart')\
(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)\
(acpi 1)(usb 1)(parallel none)\
(serial file:/tmp/serial.log)(device_model '/usr/lib64/xen/bin/qemu-dm')\
(vnc 1)))(localtime 0)\
(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')\

View File

@ -2,7 +2,7 @@
(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
(on_reboot 'restart')(on_crash 'restart')\
(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial null)\
(acpi 1)(usb 1)(parallel none)(serial null)\
(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))\
(localtime 0)\
(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))\

View File

@ -2,7 +2,7 @@
(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
(on_reboot 'restart')(on_crash 'restart')\
(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)\
(acpi 1)(usb 1)(parallel none)\
(serial pipe:/tmp/serial.pipe)(device_model '/usr/lib64/xen/bin/qemu-dm')\
(vnc 1)))(localtime 0)\
(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')\

View File

@ -2,7 +2,7 @@
(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
(on_reboot 'restart')(on_crash 'restart')\
(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial pty)\
(acpi 1)(usb 1)(parallel none)(serial pty)\
(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))\
(localtime 0)\
(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))\

View File

@ -2,7 +2,7 @@
(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
(on_reboot 'restart')(on_crash 'restart')\
(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial stdio)\
(acpi 1)(usb 1)(parallel none)(serial stdio)\
(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))\
(localtime 0)\
(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))\

View File

@ -2,7 +2,7 @@
(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
(on_reboot 'restart')(on_crash 'restart')\
(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)\
(acpi 1)(usb 1)(parallel none)\
(serial telnet:localhost:9999,server,nowait)\
(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))\
(localtime 0)\

View File

@ -2,7 +2,7 @@
(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
(on_reboot 'restart')(on_crash 'restart')\
(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)\
(acpi 1)(usb 1)(parallel none)\
(serial tcp:localhost:9999,server,nowait)\
(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))\
(localtime 0)\

View File

@ -2,7 +2,7 @@
(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
(on_reboot 'restart')(on_crash 'restart')\
(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)\
(acpi 1)(usb 1)(parallel none)\
(serial udp:localhost:9998@localhost:9999)\
(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))\
(localtime 0)\

View File

@ -2,7 +2,7 @@
(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
(on_reboot 'restart')(on_crash 'restart')\
(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)\
(acpi 1)(usb 1)(parallel none)\
(serial unix:/tmp/serial.sock,server,nowait)\
(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))\
(localtime 0)\

View File

@ -2,7 +2,7 @@
(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
(on_reboot 'restart')(on_crash 'restart')\
(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial none)\
(acpi 1)(usb 1)(parallel none)(serial none)\
(soundhw 'sb16,es1370')(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))\
(localtime 0)\
(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))\

View File

@ -2,7 +2,7 @@
(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
(on_reboot 'restart')(on_crash 'restart')\
(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
(cdrom '/root/boot.iso')(acpi 1)(usb 1)(usbdevice mouse)(parallel none)\
(acpi 1)(usb 1)(usbdevice mouse)(parallel none)\
(serial none)(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))\
(localtime 0)\
(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))\

View File

@ -2,7 +2,7 @@
(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
(on_reboot 'restart')(on_crash 'restart')\
(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial none)\
(acpi 1)(usb 1)(parallel none)(serial none)\
(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))\
(localtime 0)\
(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))\

View File

@ -2,7 +2,7 @@
(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
(on_reboot 'restart')(on_crash 'restart')\
(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial none)\
(acpi 1)(usb 1)(parallel none)(serial none)\
(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))\
(localtime 0)\
(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))\