if (virtualMachineDefinition.getPrimaryDisk().isStateful())
{
if (!supportedTypes.contains(virtualMachineDefinition.getPrimaryDisk()
.getDiskStateful().getType()))
{
throw new HypervisorPluginException(HypervisorPluginError.VIRTUALMACHINE_DEFINITION_VALIDATION_ERROR,
"All external disks must be of one of the following types: "
+ Joiner.on(',').join(supportedTypes));
}
}
boolean unsupportedSecondaries =
any(virtualMachineDefinition.getSecondaryDisks().getStatefulDisks(),
new Predicate<SecondaryDiskStateful>()
{
@Override
public boolean apply(final SecondaryDiskStateful input)
{
return !supportedTypes.contains(input.getType());
}
});
if (unsupportedSecondaries)
{
throw new HypervisorPluginException(HypervisorPluginError.VIRTUALMACHINE_DEFINITION_VALIDATION_ERROR,
"All external disks must be of one of the following types: "
+ Joiner.on(',').join(supportedTypes));
}
}