final String type = Config.get("abiquo.storage.type");
String user = Config.get("abiquo.storage.user");
String pass = Config.get("abiquo.storage.pass");
Iterable<StorageDeviceMetadata> devices = datacenter.listSupportedStorageDevices();
StorageDeviceMetadata metadata = find(devices, new Predicate<StorageDeviceMetadata>() {
@Override
public boolean apply(StorageDeviceMetadata input) {
return input.getType().equals(type);
}
});
storageDevice = StorageDevice.builder(context.getApiContext(), datacenter) //
.name(PREFIX + "Storage Device")//
.type(type)//
.managementIp(ip).managementPort(metadata.getDefaultManagementPort())//
.iscsiIp(ip).iscsiPort(metadata.getDefaultIscsiPort()) //
.username(user)//
.password(pass) //
.build();
storageDevice.save();