defaulting to "disk".
<p>
Using "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",
+ valid when type is "block", 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,
virDomainDiskDefPtr *def)
{
/*
- * device = {VIR_DOMAIN_DISK_DEVICE_DISK, VIR_DOMAIN_DISK_DEVICE_CDROM}
+ * device = {VIR_DOMAIN_DISK_DEVICE_DISK,
+ * VIR_DOMAIN_DISK_DEVICE_CDROM,
+ * VIR_DOMAIN_DISK_DEVICE_LUN}
* busType = VIR_DOMAIN_DISK_BUS_SCSI
* controllerOrBus = [0..3] -> controller
* unit = [0..6,8..15]
*
- * device = {VIR_DOMAIN_DISK_DEVICE_DISK, VIR_DOMAIN_DISK_DEVICE_CDROM}
+ * device = {VIR_DOMAIN_DISK_DEVICE_DISK,
+ * VIR_DOMAIN_DISK_DEVICE_CDROM,
+ * VIR_DOMAIN_DISK_DEVICE_LUN}
* busType = VIR_DOMAIN_DISK_BUS_IDE
* controllerOrBus = [0..1] -> bus
* unit = [0..1]
goto cleanup;
}
} else if (virFileHasSuffix(fileName, ".iso") ||
- STRCASEEQ(deviceType, "atapi-cdrom")) {
+ STRCASEEQ(deviceType, "atapi-cdrom") ||
+ STRCASEEQ(deviceType, "cdrom-raw")) {
/*
* This function was called in order to parse a harddisk device,
- * but .iso files and 'atapi-cdrom' devices are for CDROM devices
- * only. Just ignore it, another call to this function to parse a
- * CDROM device may handle it.
+ * but .iso files, 'atapi-cdrom', and 'cdrom-raw' devices are for
+ * CDROM devices only. Just ignore it, another call to this
+ * function to parse a CDROM device may handle it.
*/
goto ignore;
} else {
} else if (STRCASEEQ(deviceType, "atapi-cdrom")) {
(*def)->type = VIR_DOMAIN_DISK_TYPE_BLOCK;
(*def)->src = fileName;
-
+ fileName = NULL;
+ } else if (STRCASEEQ(deviceType, "cdrom-raw")) {
+ /* Raw access CD-ROMs actually are device='lun' */
+ (*def)->device = VIR_DOMAIN_DISK_DEVICE_LUN;
+ (*def)->type = VIR_DOMAIN_DISK_TYPE_BLOCK;
+ (*def)->src = fileName;
fileName = NULL;
} else {
virReportError(VIR_ERR_INTERNAL_ERROR,
switch (def->disks[i]->device) {
case VIR_DOMAIN_DISK_DEVICE_DISK:
case VIR_DOMAIN_DISK_DEVICE_CDROM:
+ case VIR_DOMAIN_DISK_DEVICE_LUN:
if (virVMXFormatDisk(ctx, def->disks[i], &buffer) < 0) {
goto cleanup;
}
/* Check that we got a valid device type */
if (def->device != VIR_DOMAIN_DISK_DEVICE_DISK &&
- def->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
+ def->device != VIR_DOMAIN_DISK_DEVICE_CDROM &&
+ def->device != VIR_DOMAIN_DISK_DEVICE_LUN) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid device type supplied: %s"), deviceType);
return -1;
vmxDeviceType = "cdrom-image";
else
vmxDeviceType = "atapi-cdrom";
+ } else if (def->device == VIR_DOMAIN_DISK_DEVICE_LUN) {
+ vmxDeviceType = "cdrom-raw";
} else {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("%s %s '%s' has an unsupported type '%s'"),
--- /dev/null
+config.version = "8"
+virtualHW.version = "4"
+ide0:0.present = "true"
+ide0:0.deviceType = "cdrom-raw"
+ide0:0.fileName = "/dev/scd0"
--- /dev/null
+<domain type='vmware'>
+ <uuid>00000000-0000-0000-0000-000000000000</uuid>
+ <memory unit='KiB'>32768</memory>
+ <currentMemory unit='KiB'>32768</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686'>hvm</type>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='block' device='lun'>
+ <source dev='/dev/scd0'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
+ </devices>
+</domain>
--- /dev/null
+config.version = "8"
+virtualHW.version = "4"
+scsi0.present = "true"
+scsi0:0.present = "true"
+scsi0:0.deviceType = "cdrom-raw"
+scsi0:0.fileName = "/dev/scd0"
--- /dev/null
+<domain type='vmware'>
+ <uuid>00000000-0000-0000-0000-000000000000</uuid>
+ <memory unit='KiB'>32768</memory>
+ <currentMemory unit='KiB'>32768</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686'>hvm</type>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='block' device='lun'>
+ <source dev='/dev/scd0'/>
+ <target dev='sda' bus='scsi'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='scsi' index='0'/>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
+ </devices>
+</domain>
DO_TEST("cdrom-scsi-file", "cdrom-scsi-file");
DO_TEST("cdrom-scsi-device", "cdrom-scsi-device");
+ DO_TEST("cdrom-scsi-raw-device", "cdrom-scsi-raw-device");
DO_TEST("cdrom-ide-file", "cdrom-ide-file");
DO_TEST("cdrom-ide-device", "cdrom-ide-device");
+ DO_TEST("cdrom-ide-raw-device", "cdrom-ide-raw-device");
DO_TEST("floppy-file", "floppy-file");
DO_TEST("floppy-device", "floppy-device");
--- /dev/null
+.encoding = "UTF-8"
+config.version = "8"
+virtualHW.version = "4"
+guestOS = "other"
+uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
+displayName = "cdrom-ide-device"
+memsize = "4"
+numvcpus = "1"
+ide0:0.present = "true"
+ide0:0.deviceType = "cdrom-raw"
+ide0:0.fileName = "/dev/scd0"
+floppy0.present = "false"
+floppy1.present = "false"
--- /dev/null
+<domain type='vmware'>
+ <name>cdrom-ide-device</name>
+ <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid>
+ <memory unit='KiB'>4096</memory>
+ <os>
+ <type>hvm</type>
+ </os>
+ <devices>
+ <disk type='block' device='lun'>
+ <source dev='/dev/scd0'/>
+ <target dev='hda' bus='ide'/>
+ </disk>
+ </devices>
+</domain>
--- /dev/null
+.encoding = "UTF-8"
+config.version = "8"
+virtualHW.version = "4"
+guestOS = "other"
+uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
+displayName = "cdrom-scsi-device"
+memsize = "4"
+numvcpus = "1"
+scsi0.present = "true"
+scsi0:0.present = "true"
+scsi0:0.deviceType = "cdrom-raw"
+scsi0:0.fileName = "/dev/scd0"
+floppy0.present = "false"
+floppy1.present = "false"
--- /dev/null
+<domain type='vmware'>
+ <name>cdrom-scsi-device</name>
+ <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid>
+ <memory unit='KiB'>4096</memory>
+ <os>
+ <type>hvm</type>
+ </os>
+ <devices>
+ <disk type='block' device='lun'>
+ <source dev='/dev/scd0'/>
+ <target dev='sda' bus='scsi'/>
+ </disk>
+ </devices>
+</domain>
DO_TEST("cdrom-scsi-file", "cdrom-scsi-file", 4);
DO_TEST("cdrom-scsi-device", "cdrom-scsi-device", 4);
+ DO_TEST("cdrom-scsi-raw-device", "cdrom-scsi-raw-device", 4);
DO_TEST("cdrom-ide-file", "cdrom-ide-file", 4);
DO_TEST("cdrom-ide-device", "cdrom-ide-device", 4);
+ DO_TEST("cdrom-ide-raw-device", "cdrom-ide-raw-device", 4);
DO_TEST("floppy-file", "floppy-file", 4);
DO_TEST("floppy-device", "floppy-device", 4);