Search in sources :

Example 1 with DummySecondaryStorageResource

use of com.cloud.storage.resource.DummySecondaryStorageResource in project cloudstack by apache.

the class SecondaryStorageDiscoverer method createDummySecondaryStorageResource.

protected Map<ServerResource, Map<String, String>> createDummySecondaryStorageResource(long dcId, Long podId, URI uri) {
    Map<ServerResource, Map<String, String>> srs = new HashMap<ServerResource, Map<String, String>>();
    DummySecondaryStorageResource storage = new DummySecondaryStorageResource(_useServiceVM);
    storage = ComponentContext.inject(storage);
    Map<String, String> details = new HashMap<String, String>();
    details.put("mount.path", uri.toString());
    details.put("orig.url", uri.toString());
    Map<String, Object> params = new HashMap<String, Object>();
    params.putAll(details);
    params.put("zone", Long.toString(dcId));
    if (podId != null) {
        params.put("pod", podId.toString());
    }
    params.put("guid", uri.toString());
    try {
        storage.configure("Storage", params);
    } catch (ConfigurationException e) {
        s_logger.warn("Unable to configure the storage ", e);
        return null;
    }
    srs.put(storage, details);
    return srs;
}
Also used : DummySecondaryStorageResource(com.cloud.storage.resource.DummySecondaryStorageResource) HashMap(java.util.HashMap) ConfigurationException(javax.naming.ConfigurationException) ServerResource(com.cloud.resource.ServerResource) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

ServerResource (com.cloud.resource.ServerResource)1 DummySecondaryStorageResource (com.cloud.storage.resource.DummySecondaryStorageResource)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ConfigurationException (javax.naming.ConfigurationException)1