Source:
private void writeDiskDriver(VmDevice device, Disk disk, DiskVmElement dve, int pinTo) { writer.writeStartElement("driver"); writer.writeAttributeString("name", "qemu"); if (FeatureSupported.passDiscardSupported(vm.getCompatibilityVersion()) && dve.isPassDiscard()) { writer.writeAttributeString("discard", "unmap"); } if (pinTo > 0) { writer.writeAttributeString("iothread", String.valueOf(pinTo)); } boolean nativeIO = false; switch (disk.getDiskStorageType()) { case IMAGE: DiskImage diskImage = (DiskImage) disk; String diskType = this.vmInfoBuildUtils.getDiskType(this.vm, diskImage, device); nativeIO = !"file".equals(diskType) || this.vmInfoBuildUtils.shouldUseNativeIO(vm, diskImage); writer.writeAttributeString("io", nativeIO ? "native" : "threads"); writer.writeAttributeString("type", diskImage.getVolumeFormat() == VolumeFormat.COW ? "qcow2" : "raw"); writer.writeAttributeString("error_policy", disk.getPropagateErrors() == PropagateErrors.On ? "enospace" : "stop"); break; case LUN: nativeIO = true; writer.writeAttributeString("io", "native"); writer.writeAttributeString("type", "raw"); writer.writeAttributeString("error_policy", disk.getPropagateErrors() == PropagateErrors.On ? "enospace" : "stop"); break; case CINDER: writer.writeAttributeString("io", "threads"); writer.writeAttributeString("type", "raw"); writer.writeAttributeString("error_policy", "stop"); break; } if (device.getSnapshotId() != null) { writer.writeAttributeString("cache", "writethrough"); } else { switch (dve.getDiskInterface()) { case VirtIO: case VirtIO_SCSI: String viodiskcache = vmCustomProperties.get("viodiskcache"); if (viodiskcache != null && !nativeIO) { writer.writeAttributeString("cache", viodiskcache); break; } default: writer.writeAttributeString("cache", "none"); } } writer.writeEndElement(); }

Target:
private void writeDiskDriver(VmDevice device, Disk disk, DiskVmElement dve, int pinTo) { writer.writeStartElement("driver"); writer.writeAttributeString("name", "qemu"); if (FeatureSupported.passDiscardSupported(vm.getCompatibilityVersion()) && dve.isPassDiscard()) { writer.writeAttributeString("discard", "unmap"); } if (pinTo > 0) { writer.writeAttributeString("iothread", String.valueOf(pinTo)); } boolean nativeIO = false; switch (disk.getDiskStorageType()) { case IMAGE: DiskImage diskImage = (DiskImage) disk; String diskType = vmInfoBuildUtils.getDiskType(this.vm, diskImage, device); nativeIO = !"file".equals(diskType) || vmInfoBuildUtils.shouldUseNativeIO(vm, diskImage); writer.writeAttributeString("io", nativeIO ? "native" : "threads"); writer.writeAttributeString("type", diskImage.getVolumeFormat() == VolumeFormat.COW ? "qcow2" : "raw"); writer.writeAttributeString("error_policy", disk.getPropagateErrors() == PropagateErrors.On ? "enospace" : "stop"); break; case LUN: nativeIO = true; writer.writeAttributeString("io", "native"); writer.writeAttributeString("type", "raw"); writer.writeAttributeString("error_policy", disk.getPropagateErrors() == PropagateErrors.On ? "enospace" : "stop"); break; case CINDER: writer.writeAttributeString("io", "threads"); writer.writeAttributeString("type", "raw"); writer.writeAttributeString("error_policy", "stop"); break; } if (device.getSnapshotId() != null) { writer.writeAttributeString("cache", "writethrough"); } else { switch (dve.getDiskInterface()) { case VirtIO: case VirtIO_SCSI: String viodiskcache = vmCustomProperties.get("viodiskcache"); if (viodiskcache != null && !nativeIO) { writer.writeAttributeString("cache", viodiskcache); break; } default: writer.writeAttributeString("cache", "none"); } } writer.writeEndElement(); }