file.delete();
Map<NfsSecondaryStorageResource, Map<String, String>> srs = new HashMap<NfsSecondaryStorageResource, Map<String, String>>();
NfsSecondaryStorageResource storage;
if(_configDao.isPremium()) {
Class<?> impl;
String name = "com.cloud.storage.resource.PremiumSecondaryStorageResource";
try {
impl = Class.forName(name);
final Constructor<?> constructor = impl.getDeclaredConstructor();
constructor.setAccessible(true);
storage = (NfsSecondaryStorageResource)constructor.newInstance();
} catch (final ClassNotFoundException e) {
s_logger.error("Unable to load com.cloud.storage.resource.PremiumSecondaryStorageResource due to ClassNotFoundException");
return null;
} catch (final SecurityException e) {
s_logger.error("Unable to load com.cloud.storage.resource.PremiumSecondaryStorageResource due to SecurityException");
return null;
} catch (final NoSuchMethodException e) {
s_logger.error("Unable to load com.cloud.storage.resource.PremiumSecondaryStorageResource due to NoSuchMethodException");
return null;
} catch (final IllegalArgumentException e) {
s_logger.error("Unable to load com.cloud.storage.resource.PremiumSecondaryStorageResource due to IllegalArgumentException");
return null;
} catch (final InstantiationException e) {
s_logger.error("Unable to load com.cloud.storage.resource.PremiumSecondaryStorageResource due to InstantiationException");
return null;
} catch (final IllegalAccessException e) {
s_logger.error("Unable to load com.cloud.storage.resource.PremiumSecondaryStorageResource due to IllegalAccessException");
return null;
} catch (final InvocationTargetException e) {
s_logger.error("Unable to load com.cloud.storage.resource.PremiumSecondaryStorageResource due to InvocationTargetException");
return null;
}
} else {
storage = new NfsSecondaryStorageResource();
}
Map<String, String> details = new HashMap<String, String>();
details.put("mount.path", mountStr);
details.put("orig.url", uri.toString());
details.put("mount.parent", _mountParent);
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());
params.put("secondary.storage.vm", "false");
params.put("max.template.iso.size", _configDao.getValue("max.template.iso.size"));
try {
storage.configure("Storage", params);
} catch (ConfigurationException e) {
s_logger.warn("Unable to configure the storage ", e);
return null;
}
srs.put(storage, details);