-
Notifications
You must be signed in to change notification settings - Fork 261
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
Conversation
@@ -518,7 +518,7 @@ private VmDevice readOtherHardwareItem(XmlNode node) { | |||
.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); | |||
managed = VmDeviceCommonUtils.isSpecialDevice(device, type, true) || type == VmDeviceGeneralType.TPM; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be nicer to call readManagedVmDevice(node, readDeviceId(node))
when detecting TPM in readHardwareSection so TPM won't be considered as "other hardware" anywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, done.
Why this method is in |
TPM device has its own special handling and thus is not a special device with general properties. Let’s honor this also by handling TPM separately from other hardware items.
4e90f71
to
f260d33
Compare
Yes, I wondered about it too, moved there. |
import org.ovirt.engine.core.common.businessentities.VmDeviceGeneralType; | ||
import org.ovirt.engine.core.common.utils.VmDeviceType; | ||
|
||
public abstract class OvfReaderWriterUtils { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why making a class abstract, if it contains only static methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I had originally played with the idea to make it a base class and then changed my mind and forgot to update the declarations :-). Done.
/** | ||
* is special device - device which is managed, but contains the general properties | ||
*/ | ||
protected static boolean isSpecialDevice(String device, VmDeviceGeneralType type, boolean includeHostDev) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, package access level would be better that protected
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same, done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd extract the changes related to OvfReaderWriterUtils to a different PR - the changes related to avoid marking TPM device as a special device look good
f260d33
to
b7dcfbd
Compare
Done: #587 |
/ost |
TPM device has its own special handling and thus is not a special
device with general properties.