List<SecondaryDiskStandard> oldDisks = oldDefinition.getSecondaryDisks().getStandardDisks();
List<SecondaryDiskStandard> newDisks = newDefinition.getSecondaryDisks().getStandardDisks();
for (SecondaryDiskStandard newDisk : newDisks)
{
SecondaryDiskStandard oldDisk = isStandardDiskContained(newDisk, oldDisks);
if (oldDisk == null)
{
disks.add(new ReconfigureStandardDisk(newDisk, DiskOp.ATTACH));
}
else if (!detectMovesbySequence && isChangedBusOrUnitNumber(oldDisk, newDisk)
|| detectMovesbySequence && oldDisk.getSequence() != newDisk.getSequence())
{
disks.add(new ReconfigureStandardDisk(newDisk, DiskOp.MOVE_UNIT_NUMBER));
}
else if (oldDisk.getCapacityInBytes() != newDisk.getCapacityInBytes())
{
final long oldCapacity = oldDisk.getCapacityInBytes();
final long newCapacity = newDisk.getCapacityInBytes();
if (oldCapacity < newCapacity)
{
disks.add(new ReconfigureStandardDisk(newDisk, DiskOp.INCREASE_SIZE));
}
else
{
disks.add(new ReconfigureStandardDisk(newDisk, DiskOp.DECREASE_SIZE));
}
}
}
for (SecondaryDiskStandard oldDisk : oldDisks)
{
SecondaryDiskStandard newDisk = isStandardDiskContained(oldDisk, newDisks);
if (newDisk == null)
{
disks.add(new ReconfigureStandardDisk(oldDisk, DiskOp.DETACH));
}
}