use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class SMISProviderService method scanSMISProviders.
/**
* Scan all SMI-S providers.
* <p>
* The method is deprecated. Use /vdc/storage-providers/scan instead.
*
* @brief Scan SMI-S providers
* @return TasList of all created asynchronous tasks
*/
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN })
@Path("/scan")
public TaskList scanSMISProviders() {
TaskList taskList = new TaskList();
List<StorageProvider> providerList = CustomQueryUtility.getActiveStorageProvidersByInterfaceType(_dbClient, StorageProvider.InterfaceType.smis.name());
if (providerList == null || providerList.isEmpty()) {
return taskList;
}
BlockController controller = getController(BlockController.class, "vnxblock");
DiscoveredObjectTaskScheduler scheduler = new DiscoveredObjectTaskScheduler(_dbClient, new ScanJobExec(controller));
ArrayList<AsyncTask> tasks = new ArrayList<AsyncTask>();
for (StorageProvider smisProvider : providerList) {
String taskId = UUID.randomUUID().toString();
tasks.add(new AsyncTask(StorageProvider.class, smisProvider.getId(), taskId));
}
taskList = scheduler.scheduleAsyncTasks(tasks);
return taskList;
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class SMISProviderService method getSmiSProviderList.
/**
* This function allows user to fetch list of all SMI-S Providers information.
* <p>
* The method is deprecated. Use /vdc/storage-providers instead.
*
* @brief List SMI-S providers
* @return List of SMIS-Providers.
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public SMISProviderList getSmiSProviderList() {
List<StorageProvider> providerList = CustomQueryUtility.getActiveStorageProvidersByInterfaceType(_dbClient, StorageProvider.InterfaceType.smis.name());
/*
* List<URI> ids = _dbClient.queryByType(SMISProvider.class);
* List<SMISProvider> smisProviders = _dbClient.queryObject(SMISProvider.class, ids);
* if (smisProviders == null) {
* throw APIException.badRequests.unableToFindSMISProvidersForIds(ids);
* }
*/
SMISProviderList smisProviderList = new SMISProviderList();
for (StorageProvider provider : providerList) {
smisProviderList.getSmisProviders().add(toNamedRelatedResource(ResourceTypeEnum.SMIS_PROVIDER, provider.getId(), provider.getLabel()));
}
return smisProviderList;
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class ExternalBlockStorageDevice method validateStorageProviderConnection.
public boolean validateStorageProviderConnection(StorageProvider storageProvider) {
boolean isConnectionValid = false;
try {
// call driver to validate provider connection
// get driver for the provider
BlockStorageDriver driver = getDriver(storageProvider.getInterfaceType());
String username = storageProvider.getUserName();
String password = storageProvider.getPassword();
String hostName = storageProvider.getIPAddress();
Integer providerPortNumber = storageProvider.getPortNumber();
String providerType = storageProvider.getInterfaceType();
Boolean useSsl = storageProvider.getUseSSL();
String msg = String.format("Storage provider info: type: %s, host: %s, port: %s, user: %s, useSsl: %s", providerType, hostName, providerPortNumber, username, useSsl);
_log.info(msg);
com.emc.storageos.storagedriver.model.StorageProvider driverProvider = new com.emc.storageos.storagedriver.model.StorageProvider();
// initialize driver provider
driverProvider.setProviderHost(hostName);
driverProvider.setPortNumber(providerPortNumber);
driverProvider.setUsername(username);
driverProvider.setPassword(password);
driverProvider.setUseSSL(useSsl);
driverProvider.setProviderType(providerType);
isConnectionValid = driver.validateStorageProviderConnection(driverProvider);
} catch (Exception ex) {
_log.error("Problem in checking connection of provider {} due to: ", storageProvider.getLabel(), ex);
}
return isConnectionValid;
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class HDSUtils method refreshHDSConnections.
/**
* makes simple rest call to device manager to validate the provider reachable state for passed hds providers
*
* @param hicommandProviderList List of HiCommandDevice Manager provider URIs
* @param dbClient
* @param hdsApiFactory
* @return List of Active Storage Providers
*/
public static List<URI> refreshHDSConnections(final List<StorageProvider> hicommandProviderList, DbClient dbClient, HDSApiFactory hdsApiFactory) {
List<URI> activeProviders = new ArrayList<URI>();
for (StorageProvider storageProvider : hicommandProviderList) {
try {
HDSApiClient hdsApiClient = hdsApiFactory.getClient(HDSUtils.getHDSServerManagementServerInfo(storageProvider), storageProvider.getUserName(), storageProvider.getPassword());
// Makes sure "Hi Command Device manager" is reachable
hdsApiClient.getStorageSystemsInfo();
storageProvider.setConnectionStatus(ConnectionStatus.CONNECTED.name());
activeProviders.add(storageProvider.getId());
log.info("Storage Provider {} is reachable", storageProvider.getIPAddress());
} catch (Exception e) {
log.error(e.getMessage(), e);
storageProvider.setConnectionStatus(ConnectionStatus.NOTCONNECTED.name());
log.error("Storage Provider {} is not reachable", storageProvider.getIPAddress());
} finally {
dbClient.persistObject(storageProvider);
}
}
return activeProviders;
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class CephUtils method refreshCephConnections.
public static List<URI> refreshCephConnections(final List<StorageProvider> cephProviderList, DbClient dbClient) {
List<URI> activeProviders = new ArrayList<URI>();
for (StorageProvider storageProvider : cephProviderList) {
try {
ensureConnectToCeph(storageProvider);
storageProvider.setConnectionStatus(ConnectionStatus.CONNECTED.name());
activeProviders.add(storageProvider.getId());
} catch (Exception e) {
_log.error(String.format("Failed to connect to Ceph %s: %s", storageProvider.getIPAddress(), storageProvider.getId()), e);
storageProvider.setConnectionStatus(ConnectionStatus.NOTCONNECTED.name());
} finally {
dbClient.updateObject(storageProvider);
}
}
return activeProviders;
}
Aggregations