mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
bug 12957: sort disk by device id to make sure ROOT disk is configured at very first
This commit is contained in:
parent
d569f383f9
commit
b07fc6b5f8
@ -1381,7 +1381,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
||||
i++;
|
||||
}
|
||||
|
||||
for (VolumeTO vol : disks) {
|
||||
for (VolumeTO vol : sortVolumesByDeviceId(disks)) {
|
||||
deviceConfigSpecArray[i] = new VirtualDeviceConfigSpec();
|
||||
|
||||
if (vol.getType() == Volume.Type.ISO) {
|
||||
@ -1575,7 +1575,30 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
||||
});
|
||||
|
||||
return listForSort.toArray(new NicTO[0]);
|
||||
}
|
||||
}
|
||||
|
||||
private VolumeTO[] sortVolumesByDeviceId(VolumeTO[] volumes) {
|
||||
|
||||
List<VolumeTO> listForSort = new ArrayList<VolumeTO>();
|
||||
for (VolumeTO vol : volumes) {
|
||||
listForSort.add(vol);
|
||||
}
|
||||
Collections.sort(listForSort, new Comparator<VolumeTO>() {
|
||||
|
||||
@Override
|
||||
public int compare(VolumeTO arg0, VolumeTO arg1) {
|
||||
if (arg0.getDeviceId() < arg1.getDeviceId()) {
|
||||
return -1;
|
||||
} else if (arg0.getDeviceId() == arg1.getDeviceId()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
|
||||
return listForSort.toArray(new VolumeTO[0]);
|
||||
}
|
||||
|
||||
private HashMap<String, Pair<ManagedObjectReference, DatastoreMO>> inferDatastoreDetailsFromDiskInfo(VmwareHypervisorHost hyperHost, VmwareContext context, VolumeTO[] disks) throws Exception {
|
||||
HashMap<String ,Pair<ManagedObjectReference, DatastoreMO>> poolMors = new HashMap<String, Pair<ManagedObjectReference, DatastoreMO>>();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user