GutoVeronezi commented on a change in pull request #5848:
URL: https://github.com/apache/cloudstack/pull/5848#discussion_r792736342
##########
File path:
vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
##########
@@ -3613,6 +3613,23 @@ public int getNumberOfVirtualDisks() throws Exception {
return count;
}
+ public String getVirtualDiskUUID(String datastoreVolumePath) throws
Exception{
+ List<VirtualDevice> devices =
(List<VirtualDevice>)_context.getVimClient().getDynamicProperty(_mor,
"config.hardware.device");
+ if (devices != null && devices.size() > 0 && datastoreVolumePath !=
null) {
+ for (VirtualDevice device : devices) {
+ if (device instanceof VirtualDisk) {
+ if (device.getBacking() instanceof
VirtualDiskFlatVer2BackingInfo){
+ VirtualDiskFlatVer2BackingInfo backingInfo
=(VirtualDiskFlatVer2BackingInfo) device.getBacking();
+
if(backingInfo.getFileName().equals(datastoreVolumePath)){
+ return backingInfo.getUuid();
+ }
+ }
+ }
+ }
+ }
+ return null;
Review comment:
Just minors changes to improve readability.
```suggestion
if (CollectionUtils.isEmpty(devices) || datastoreVolumePath == null)
{
return null;
}
for (VirtualDevice device : devices) {
if (device instanceof VirtualDisk && device.getBacking()
instanceof VirtualDiskFlatVer2BackingInfo){
VirtualDiskFlatVer2BackingInfo backingInfo =
(VirtualDiskFlatVer2BackingInfo) device.getBacking();
if(backingInfo.getFileName().equals(datastoreVolumePath)){
return backingInfo.getUuid();
}
}
}
return null;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]