use of com.cloud.storage.template.DownloadManagerImpl in project cosmic by MissionCriticalCloud.
the class LocalSecondaryStorageResource method configure.
@Override
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
super.configure(name, params);
_guid = (String) params.get("guid");
if (_guid == null) {
throw new ConfigurationException("Unable to find the guid");
}
_dc = (String) params.get("zone");
if (_dc == null) {
throw new ConfigurationException("Unable to find the zone");
}
_pod = (String) params.get("pod");
_instance = (String) params.get("instance");
_parent = (String) params.get("mount.path");
if (_parent == null) {
throw new ConfigurationException("No directory specified.");
}
_storage = (StorageLayer) params.get(StorageLayer.InstanceConfigKey);
if (_storage == null) {
String value = (String) params.get(StorageLayer.ClassConfigKey);
if (value == null) {
value = "com.cloud.storage.JavaStorageLayer";
}
try {
final Class<StorageLayer> clazz = (Class<StorageLayer>) Class.forName(value);
_storage = ComponentContext.inject(clazz);
} catch (final ClassNotFoundException e) {
throw new ConfigurationException("Unable to find class " + value);
}
}
if (!_storage.mkdirs(_parent)) {
s_logger.warn("Unable to create the directory " + _parent);
throw new ConfigurationException("Unable to create the directory " + _parent);
}
s_logger.info("Mount point established at " + _parent);
params.put("template.parent", _parent);
params.put(StorageLayer.InstanceConfigKey, _storage);
_dlMgr = new DownloadManagerImpl();
_dlMgr.configure("DownloadManager", params);
return true;
}
use of com.cloud.storage.template.DownloadManagerImpl in project cosmic by MissionCriticalCloud.
the class NfsSecondaryStorageResource method configure.
@Override
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
s_logger.info("Configuring resource {}", name);
configurePrivateInterface(params);
configuringPublicInterface(params);
_hostname = (String) params.get("name");
final String inSystemVM = (String) params.get("secondary.storage.vm");
if (inSystemVM == null || "true".equalsIgnoreCase(inSystemVM)) {
s_logger.debug("conf secondary.storage.vm is true, act as if executing in SSVM");
_inSystemVM = true;
}
_storageIp = (String) params.get("storageip");
if (_storageIp == null && _inSystemVM) {
s_logger.warn("There is no storageip in /proc/cmdline, something wrong!");
}
_storageNetmask = (String) params.get("storagenetmask");
_storageGateway = (String) params.get("storagegateway");
super.configure(name, params);
_params = params;
final String value = (String) params.get("scripts.timeout");
_timeout = NumbersUtil.parseInt(value, 1440) * 1000;
_storage = (StorageLayer) params.get(StorageLayer.InstanceConfigKey);
configureStorageLayerClass(params);
if (_inSystemVM) {
_storage.mkdirs(_parent);
}
_configSslScr = Script.findScript(getDefaultScriptsDir(), "config_ssl.sh");
if (_configSslScr != null) {
s_logger.info("config_ssl.sh found in " + _configSslScr);
}
_configAuthScr = Script.findScript(getDefaultScriptsDir(), "config_auth.sh");
if (_configAuthScr != null) {
s_logger.info("config_auth.sh found in " + _configAuthScr);
}
_configIpFirewallScr = Script.findScript(getDefaultScriptsDir(), "ipfirewall.sh");
if (_configIpFirewallScr != null) {
s_logger.info("_configIpFirewallScr found in " + _configIpFirewallScr);
}
createTemplateFromSnapshotXenScript = Script.findScript(getDefaultScriptsDir(), "create_privatetemplate_from_snapshot_xen.sh");
if (createTemplateFromSnapshotXenScript == null) {
throw new ConfigurationException("create_privatetemplate_from_snapshot_xen.sh not found in " + getDefaultScriptsDir());
}
_role = (String) params.get("role");
if (_role == null) {
_role = SecondaryStorageVm.Role.templateProcessor.toString();
}
s_logger.info("Secondary storage runs in role " + _role);
_guid = (String) params.get("guid");
if (_guid == null) {
throw new ConfigurationException("Unable to find the guid");
}
_dc = (String) params.get("zone");
if (_dc == null) {
throw new ConfigurationException("Unable to find the zone");
}
_pod = (String) params.get("pod");
_instance = (String) params.get("instance");
if (!_inSystemVM) {
_parent = (String) params.get("mount.path");
}
if (_inSystemVM) {
_localgw = (String) params.get("localgw");
if (_localgw != null) {
// can only happen inside service vm
final String mgmtHost = (String) params.get("host");
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, mgmtHost);
final String internalDns1 = (String) params.get("internaldns1");
if (internalDns1 == null) {
s_logger.warn("No DNS entry found during configuration of NfsSecondaryStorage");
} else {
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns1);
}
final String internalDns2 = (String) params.get("internaldns2");
if (internalDns2 != null) {
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns2);
}
}
startAdditionalServices();
_params.put("install.numthreads", "50");
_params.put("secondary.storage.vm", "true");
}
try {
_params.put(StorageLayer.InstanceConfigKey, _storage);
_dlMgr = new DownloadManagerImpl();
_dlMgr.configure("DownloadManager", _params);
_upldMgr = new UploadManagerImpl();
_upldMgr.configure("UploadManager", params);
} catch (final ConfigurationException e) {
s_logger.warn("Caught problem while configuring DownloadManager", e);
return false;
}
return true;
}
Aggregations