Source:
<code>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) || <START> this.vmInfoBuildUtils.shouldUseNativeIO(vm, <END> 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(); }</code><technical_language>this is unnecessary here</technical_language>

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(); }