Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: Don’t mark TPM device as special #582

Merged
merged 1 commit into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ public static boolean isSpecialDevice(String device, VmDeviceGeneralType type, b
switch(type) {
case MDEV:
case SOUND:
case TPM:
return true;
case CONSOLE:
return VmDeviceType.CONSOLE.getName().equals(device);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,12 @@ protected void readHardwareSection(XmlNode section) {
break;

case OvfHardware.OTHER:
VmDevice vmDevice = readOtherHardwareItem(item);
readVirtioSerial = readVirtioSerial ||
VmDeviceType.VIRTIOSERIAL.getName().equals(vmDevice.getDevice());
final VmDeviceGeneralType type = VmDeviceGeneralType
.forValue(String.valueOf(selectSingleNode(item, VMD_TYPE, _xmlNS).innerText));
final VmDevice vmDevice = type == VmDeviceGeneralType.TPM
? readManagedVmDevice(item, readDeviceId(item))
: readOtherHardwareItem(item, type);
readVirtioSerial = readVirtioSerial || VmDeviceType.VIRTIOSERIAL.getName().equals(vmDevice.getDevice());
break;
}
}
Expand Down Expand Up @@ -510,12 +513,10 @@ private void readUsbItem(XmlNode node) {
vmBase.setUsbPolicy(usbPolicy != null ? UsbPolicy.forStringValue(usbPolicy.innerText) : UsbPolicy.ENABLED_NATIVE);
}

private VmDevice readOtherHardwareItem(XmlNode node) {
private VmDevice readOtherHardwareItem(XmlNode node, VmDeviceGeneralType type) {
boolean managed = false;
if (selectSingleNode(node, VMD_TYPE, _xmlNS) != null
&& StringUtils.isNotEmpty(selectSingleNode(node, VMD_TYPE, _xmlNS).innerText)) {
VmDeviceGeneralType type = VmDeviceGeneralType
.forValue(String.valueOf(selectSingleNode(node, VMD_TYPE, _xmlNS).innerText));
String device = selectSingleNode(node, VMD_DEVICE, _xmlNS).innerText;
// special devices are treated as managed devices but still have the OTHER OVF ResourceType
managed = VmDeviceCommonUtils.isSpecialDevice(device, type, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,10 +481,6 @@ private void writeOtherDevices() {
// mdev_type predefined property is written instead
continue;
}
if (device.getType() == VmDeviceGeneralType.TPM) {
// TPM device has its own write method
continue;
}
devices.add(device);
}
}
Expand Down