Merge pull request #2211 from apache/debian9-systemvmtemplate
CLOUDSTACK-10013: Migrate systemvmtemplate to Debian9 Signed-off-by: Rohit Yadav <rohit@apache.org>
2
.gitignore
vendored
@ -97,3 +97,5 @@ systemvm/.pydevproject
|
||||
test/.pydevprojec
|
||||
plugins/hypervisors/kvm/.pydevproject
|
||||
scripts/.pydevproject
|
||||
*.qcow2
|
||||
*.raw
|
||||
|
||||
12
.travis.yml
@ -50,7 +50,6 @@ env:
|
||||
smoke/test_hostha_simulator
|
||||
smoke/test_host_annotations
|
||||
smoke/test_host_maintenance
|
||||
smoke/test_hosts
|
||||
smoke/test_internal_lb
|
||||
smoke/test_iso
|
||||
smoke/test_list_ids_parameter
|
||||
@ -116,8 +115,7 @@ env:
|
||||
component/test_acl_sharednetwork_deployVM-impersonation
|
||||
component/test_affinity_groups_projects
|
||||
component/test_cpu_domain_limits
|
||||
component/test_cpu_limits
|
||||
component/test_volumes"
|
||||
component/test_cpu_limits"
|
||||
|
||||
- TESTS="component/test_cpu_max_limits
|
||||
component/test_acl_isolatednetwork
|
||||
@ -145,10 +143,12 @@ env:
|
||||
component/test_snapshots
|
||||
component/test_stopped_vm"
|
||||
|
||||
- TESTS="component/test_resource_limits
|
||||
component/test_tags
|
||||
- TESTS="component/test_resource_limits"
|
||||
|
||||
- TESTS="component/test_tags
|
||||
component/test_templates
|
||||
component/test_update_vm"
|
||||
component/test_update_vm
|
||||
component/test_volumes"
|
||||
|
||||
- TESTS="component/test_vpc
|
||||
component/test_vpc_network
|
||||
|
||||
67
LICENSE
@ -208,7 +208,7 @@ Within the console-proxy/js directory
|
||||
jquery.js
|
||||
|
||||
|
||||
Within the patches/systemvm/debian/config/etc directory
|
||||
Within the systemvm/debian/etc directory
|
||||
placed in the public domain
|
||||
by Adiscon GmbH http://www.adiscon.com/
|
||||
rsyslog.conf
|
||||
@ -216,14 +216,14 @@ Within the patches/systemvm/debian/config/etc directory
|
||||
dnsmasq.conf
|
||||
vpcdnsmasq.conf
|
||||
|
||||
Within the patches/systemvm/debian/config/etc/apache2 directory
|
||||
Within the systemvm/debian/etc/apache2 directory
|
||||
licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above)
|
||||
Copyright (c) 2012 The Apache Software Foundation
|
||||
from The Apache Software Foundation http://www.apache.org/
|
||||
httpd.conf
|
||||
vhost.template
|
||||
|
||||
Within the patches/systemvm/debian/config/etc/ssh/ directory
|
||||
Within the systemvm/debian/etc/ssh/ directory
|
||||
licensed under the BSD (2-clause) http://www.opensource.org/licenses/BSD-2-Clause (as follows)
|
||||
|
||||
|
||||
@ -254,7 +254,7 @@ Within the patches/systemvm/debian/config/etc/ssh/ directory
|
||||
from OpenSSH Project http://www.openssh.org/
|
||||
sshd_config
|
||||
|
||||
Within the patches/systemvm/debian/config/root/redundant_router directory
|
||||
Within the systemvm/debian/root/redundant_router directory
|
||||
placed in the public domain
|
||||
by The netfilter.org project http://www.netfilter.org/
|
||||
conntrackd.conf.templ
|
||||
@ -271,65 +271,6 @@ Within the scripts/vm/hypervisor/xenserver directory
|
||||
from OpenStack, LLC http://www.openstack.org
|
||||
swift
|
||||
|
||||
Within the tools/appliance/definitions/{devcloud,systemvmtemplate,systemvmtemplate64} directory
|
||||
licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
|
||||
|
||||
Copyright (c) 2010-2012 Patrick Debois
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
from Patrick Debois http://www.jedi.be/blog/
|
||||
base.sh from https://github.com/jedi4ever/veewee
|
||||
cleanup.sh from https://github.com/jedi4ever/veewee
|
||||
definition.rb from https://github.com/jedi4ever/veewee
|
||||
preseed.cfg from https://github.com/jedi4ever/veewee
|
||||
zerodisk.sh from https://github.com/jedi4ever/veewee
|
||||
|
||||
Within the tools/devcloud/src/deps/boxes/basebox-build directory
|
||||
licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
|
||||
|
||||
Copyright (c) 2010-2012 Patrick Debois
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
from Patrick Debois http://www.jedi.be/blog/
|
||||
definition.rb from https://github.com/jedi4ever/veewee
|
||||
preseed.cfg from https://github.com/jedi4ever/veewee
|
||||
|
||||
Within the ui/lib directory
|
||||
placed in the public domain
|
||||
by Eric Meyer http://meyerweb.com/eric/
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
configureSimulator=com.cloud.api.commands.ConfigureSimulatorCmd;1
|
||||
querySimulatorMock=com.cloud.api.commands.QuerySimulatorMockCmd;1
|
||||
cleanupSimulatorMock=com.cloud.api.commands.CleanupSimulatorMockCmd;1
|
||||
@ -59,6 +59,7 @@ import com.cloud.host.Host.Type;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.resource.ServerResourceBase;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.ReflectUtil;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
import com.cloud.utils.script.Script;
|
||||
import com.google.gson.Gson;
|
||||
@ -315,20 +316,19 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
||||
|
||||
private void launchConsoleProxy(final byte[] ksBits, final String ksPassword, final String encryptorPassword) {
|
||||
final Object resource = this;
|
||||
s_logger.info("Building class loader for com.cloud.consoleproxy.ConsoleProxy");
|
||||
final ClassLoader loader = ReflectUtil.getClassLoaderForName("console-proxy");
|
||||
if (_consoleProxyMain == null) {
|
||||
s_logger.info("Running com.cloud.consoleproxy.ConsoleProxy with encryptor password=" + encryptorPassword);
|
||||
_consoleProxyMain = new Thread(new ManagedContextRunnable() {
|
||||
@Override
|
||||
protected void runInContext() {
|
||||
try {
|
||||
Class<?> consoleProxyClazz = Class.forName("com.cloud.consoleproxy.ConsoleProxy");
|
||||
Class<?> consoleProxyClazz = loader.loadClass("com.cloud.consoleproxy.ConsoleProxy");
|
||||
try {
|
||||
s_logger.info("Invoke setEncryptorPassword(), ecnryptorPassword: " + encryptorPassword);
|
||||
Method methodSetup = consoleProxyClazz.getMethod("setEncryptorPassword", String.class);
|
||||
methodSetup.invoke(null, encryptorPassword);
|
||||
|
||||
s_logger.info("Invoke startWithContext()");
|
||||
Method method = consoleProxyClazz.getMethod("startWithContext", Properties.class, Object.class, byte[].class, String.class);
|
||||
method.invoke(null, _properties, resource, ksBits, ksPassword);
|
||||
Method method = consoleProxyClazz.getMethod("startWithContext", Properties.class, Object.class, byte[].class, String.class, String.class);
|
||||
method.invoke(null, _properties, resource, ksBits, ksPassword, encryptorPassword);
|
||||
} catch (SecurityException e) {
|
||||
s_logger.error("Unable to launch console proxy due to SecurityException", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
@ -357,7 +357,7 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
||||
s_logger.info("com.cloud.consoleproxy.ConsoleProxy is already running");
|
||||
|
||||
try {
|
||||
Class<?> consoleProxyClazz = Class.forName("com.cloud.consoleproxy.ConsoleProxy");
|
||||
Class<?> consoleProxyClazz = loader.loadClass("com.cloud.consoleproxy.ConsoleProxy");
|
||||
Method methodSetup = consoleProxyClazz.getMethod("setEncryptorPassword", String.class);
|
||||
methodSetup.invoke(null, encryptorPassword);
|
||||
} catch (SecurityException e) {
|
||||
|
||||
@ -205,6 +205,7 @@ public class ApiConstants {
|
||||
public static final String OUTOFBANDMANAGEMENT_POWERSTATE = "outofbandmanagementpowerstate";
|
||||
public static final String OUTOFBANDMANAGEMENT_ENABLED = "outofbandmanagementenabled";
|
||||
public static final String PARAMS = "params";
|
||||
public static final String PARENT_ID = "parentid";
|
||||
public static final String PARENT_DOMAIN_ID = "parentdomainid";
|
||||
public static final String PASSWORD = "password";
|
||||
public static final String SHOULD_UPDATE_PASSWORD = "update_passwd_on_host";
|
||||
@ -274,6 +275,7 @@ public class ApiConstants {
|
||||
public static final String SNAPSHOT_QUIESCEVM = "quiescevm";
|
||||
public static final String SOURCE_ZONE_ID = "sourcezoneid";
|
||||
public static final String START_DATE = "startdate";
|
||||
public static final String START_ID = "startid";
|
||||
public static final String START_IP = "startip";
|
||||
public static final String START_IPV6 = "startipv6";
|
||||
public static final String START_PORT = "startport";
|
||||
|
||||
@ -65,6 +65,9 @@ public class ListEventsCmd extends BaseListProjectAndAccountResourcesCmd {
|
||||
@Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "the event type (see event types)")
|
||||
private String type;
|
||||
|
||||
@Parameter(name = ApiConstants.START_ID, type = CommandType.UUID, entityType = EventResponse.class, description = "the parent/start ID of the event, when provided this will list all the events with the start/parent ID including the parent event")
|
||||
private Long startId;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -97,6 +100,10 @@ public class ListEventsCmd extends BaseListProjectAndAccountResourcesCmd {
|
||||
return type;
|
||||
}
|
||||
|
||||
public Long getStartId() {
|
||||
return startId;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -78,7 +78,7 @@ public class EventResponse extends BaseResponse implements ControlledViewEntityR
|
||||
@Param(description = "the state of the event")
|
||||
private Event.State state;
|
||||
|
||||
@SerializedName("parentid")
|
||||
@SerializedName(ApiConstants.PARENT_ID)
|
||||
@Param(description = "whether the event is parented")
|
||||
private String parentId;
|
||||
|
||||
|
||||
@ -798,7 +798,6 @@
|
||||
<target>
|
||||
<copy todir="${basedir}/target/common/vms">
|
||||
<fileset dir="${basedir}/../systemvm/dist">
|
||||
<include name="systemvm.zip"/>
|
||||
<include name="systemvm.iso"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
@ -22,6 +22,8 @@ package com.cloud.agent.resource.virtualnetwork.facade;
|
||||
import java.util.Hashtable;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.api.BumpUpPriorityCommand;
|
||||
import com.cloud.agent.api.SetupGuestNetworkCommand;
|
||||
@ -58,6 +60,8 @@ import com.google.gson.GsonBuilder;
|
||||
|
||||
public abstract class AbstractConfigItemFacade {
|
||||
|
||||
private static final Logger s_logger = Logger.getLogger(AbstractConfigItemFacade.class);
|
||||
|
||||
private final static Gson gson;
|
||||
|
||||
private static Hashtable<Class<? extends NetworkElementCommand>, AbstractConfigItemFacade> flyweight = new Hashtable<Class<? extends NetworkElementCommand>, AbstractConfigItemFacade>();
|
||||
@ -104,13 +108,26 @@ public abstract class AbstractConfigItemFacade {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private static String appendUuidToJsonFiles(final String filename) {
|
||||
String remoteFileName = new String(filename);
|
||||
if (remoteFileName.endsWith("json")) {
|
||||
remoteFileName += "." + UUID.randomUUID().toString();
|
||||
}
|
||||
return remoteFileName;
|
||||
}
|
||||
|
||||
protected List<ConfigItem> generateConfigItems(final ConfigBase configuration) {
|
||||
final List<ConfigItem> cfg = new LinkedList<>();
|
||||
|
||||
final ConfigItem configFile = new FileConfigItem(VRScripts.CONFIG_PERSIST_LOCATION, destinationFile, gson.toJson(configuration));
|
||||
final String remoteFilename = appendUuidToJsonFiles(destinationFile);
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Transformed filename: " + destinationFile + " to: " + remoteFilename);
|
||||
}
|
||||
|
||||
final ConfigItem configFile = new FileConfigItem(VRScripts.CONFIG_PERSIST_LOCATION, remoteFilename, gson.toJson(configuration));
|
||||
cfg.add(configFile);
|
||||
|
||||
final ConfigItem updateCommand = new ScriptConfigItem(VRScripts.UPDATE_CONFIG, destinationFile);
|
||||
final ConfigItem updateCommand = new ScriptConfigItem(VRScripts.UPDATE_CONFIG, remoteFilename);
|
||||
cfg.add(updateCommand);
|
||||
|
||||
return cfg;
|
||||
|
||||
@ -48,7 +48,7 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
|
||||
private static String[] defaultsSection = {"defaults", "\tlog global", "\tmode tcp", "\toption dontlognull", "\tretries 3", "\toption redispatch",
|
||||
"\toption forwardfor", "\toption forceclose", "\ttimeout connect 5000", "\ttimeout client 50000", "\ttimeout server 50000"};
|
||||
|
||||
private static String[] defaultListen = {"listen vmops 0.0.0.0:9", "\toption transparent"};
|
||||
private static String[] defaultListen = {"listen vmops", "\tbind 0.0.0.0:9", "\toption transparent"};
|
||||
|
||||
@Override
|
||||
public String[] generateConfiguration(final List<PortForwardingRuleTO> fwRules) {
|
||||
@ -100,7 +100,10 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
|
||||
final List<String> result = new ArrayList<String>();
|
||||
// add line like this: "listen 65_37_141_30-80 65.37.141.30:80"
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("listen ").append(poolName).append(" ").append(publicIP).append(":").append(publicPort);
|
||||
sb.append("listen ").append(poolName);
|
||||
result.add(sb.toString());
|
||||
sb = new StringBuilder();
|
||||
sb.append("\tbind ").append(publicIP).append(":").append(publicPort);
|
||||
result.add(sb.toString());
|
||||
sb = new StringBuilder();
|
||||
// FIXME sb.append("\t").append("balance ").append(algorithm);
|
||||
@ -474,9 +477,12 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
|
||||
final String algorithm = lbTO.getAlgorithm();
|
||||
|
||||
final List<String> result = new ArrayList<String>();
|
||||
// add line like this: "listen 65_37_141_30-80 65.37.141.30:80"
|
||||
// add line like this: "listen 65_37_141_30-80\n\tbind 65.37.141.30:80"
|
||||
sb = new StringBuilder();
|
||||
sb.append("listen ").append(poolName).append(" ").append(publicIP).append(":").append(publicPort);
|
||||
sb.append("listen ").append(poolName);
|
||||
result.add(sb.toString());
|
||||
sb = new StringBuilder();
|
||||
sb.append("\tbind ").append(publicIP).append(":").append(publicPort);
|
||||
result.add(sb.toString());
|
||||
sb = new StringBuilder();
|
||||
sb.append("\t").append("balance ").append(algorithm);
|
||||
@ -552,7 +558,7 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
|
||||
}
|
||||
|
||||
private String generateStatsRule(final LoadBalancerConfigCommand lbCmd, final String ruleName, final String statsIp) {
|
||||
final StringBuilder rule = new StringBuilder("\nlisten ").append(ruleName).append(" ").append(statsIp).append(":").append(lbCmd.lbStatsPort);
|
||||
final StringBuilder rule = new StringBuilder("\nlisten ").append(ruleName).append("\n\tbind ").append(statsIp).append(":").append(lbCmd.lbStatsPort);
|
||||
// TODO DH: write test for this in both cases
|
||||
if (!lbCmd.keepAliveEnabled) {
|
||||
s_logger.info("Haproxy mode http enabled");
|
||||
|
||||
@ -834,7 +834,8 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
|
||||
"\ttimeout client 50000\n" +
|
||||
"\ttimeout server 50000\n" +
|
||||
"\n" +
|
||||
"listen stats_on_guest 10.1.10.2:8081\n" +
|
||||
"listen stats_on_guest\n" +
|
||||
"\tbind 10.1.10.2:8081\n" +
|
||||
"\tmode http\n" +
|
||||
"\toption httpclose\n" +
|
||||
"\tstats enable\n" +
|
||||
@ -843,7 +844,8 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
|
||||
"\tstats auth admin1:AdMiN123\n" +
|
||||
"\n" +
|
||||
"\t \n" +
|
||||
"listen 64_10_1_10-80 64.10.1.10:80\n" +
|
||||
"listen 64_10_1_10-80\n" +
|
||||
"\tbind 64.10.1.10:80\n" +
|
||||
"\tbalance algo\n" +
|
||||
"\tserver 64_10_1_10-80_0 10.1.10.2:80 check\n" +
|
||||
"\tmode http\n" +
|
||||
@ -917,4 +919,4 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
|
||||
assertTrue(args.startsWith("-c /var/cache/cloud/VR-"));
|
||||
assertTrue(args.endsWith(".cfg"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ INSERT INTO `cloud`.`configuration` (category, instance, component, name, value)
|
||||
|
||||
INSERT INTO `cloud`.`configuration` (category, instance, component, name, value)
|
||||
VALUES ('Advanced', 'DEFAULT', 'management-server',
|
||||
'ping.timeout', '1.5');
|
||||
'ping.timeout', '2.0');
|
||||
|
||||
-- Enable dynamic RBAC by default for fresh deployments
|
||||
INSERT INTO `cloud`.`configuration` (category, instance, component, name, value)
|
||||
|
||||
@ -213,7 +213,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
|
||||
_nodeId = ManagementServerNode.getManagementServerId();
|
||||
s_logger.info("Configuring AgentManagerImpl. management server node id(msid): " + _nodeId);
|
||||
|
||||
final long lastPing = (System.currentTimeMillis() >> 10) - (long) (PingTimeout.value() * PingInterval.value());
|
||||
final long lastPing = (System.currentTimeMillis() >> 10) - getTimeout();
|
||||
_hostDao.markHostsAsDisconnected(_nodeId, lastPing);
|
||||
|
||||
registerForHostEvents(new BehindOnPingListener(), true, true, false);
|
||||
@ -241,8 +241,12 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
|
||||
return true;
|
||||
}
|
||||
|
||||
protected int getPingInterval() {
|
||||
return PingInterval.value();
|
||||
}
|
||||
|
||||
protected long getTimeout() {
|
||||
return (long) (PingTimeout.value() * PingInterval.value());
|
||||
return (long) (Math.ceil(PingTimeout.value() * PingInterval.value()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -358,10 +362,6 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
|
||||
return null;
|
||||
}
|
||||
|
||||
protected int getPingInterval() {
|
||||
return PingInterval.value();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Answer send(final Long hostId, final Command cmd) throws AgentUnavailableException, OperationTimedoutException {
|
||||
final Commands cmds = new Commands(Command.OnError.Stop);
|
||||
@ -623,7 +623,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
|
||||
}
|
||||
}
|
||||
|
||||
_monitorExecutor.scheduleWithFixedDelay(new MonitorTask(), PingInterval.value(), PingInterval.value(), TimeUnit.SECONDS);
|
||||
_monitorExecutor.scheduleWithFixedDelay(new MonitorTask(), getPingInterval(), getPingInterval(), TimeUnit.SECONDS);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1515,7 +1515,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
|
||||
attache = createAttacheForDirectConnect(host, resource);
|
||||
final StartupAnswer[] answers = new StartupAnswer[cmds.length];
|
||||
for (int i = 0; i < answers.length; i++) {
|
||||
answers[i] = new StartupAnswer(cmds[i], attache.getId(), PingInterval.value());
|
||||
answers[i] = new StartupAnswer(cmds[i], attache.getId(), getPingInterval());
|
||||
}
|
||||
attache.process(answers);
|
||||
|
||||
|
||||
@ -519,7 +519,7 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
|
||||
sslEngine.setUseClientMode(true);
|
||||
sslEngine.setEnabledProtocols(SSLUtils.getSupportedProtocols(sslEngine.getEnabledProtocols()));
|
||||
sslEngine.beginHandshake();
|
||||
if (!Link.doHandshake(ch1, sslEngine, true)) {
|
||||
if (!Link.doHandshake(ch1, sslEngine)) {
|
||||
ch1.close();
|
||||
throw new IOException(String.format("SSL: Handshake failed with peer management server '%s' on %s:%d ", peerName, ip, port));
|
||||
}
|
||||
|
||||
@ -839,6 +839,21 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
||||
}
|
||||
}
|
||||
|
||||
private void setupAgentSecurity(final Host vmHost, final Map<String, String> sshAccessDetails, final VirtualMachine vm) throws AgentUnavailableException, OperationTimedoutException {
|
||||
final String csr = caManager.generateKeyStoreAndCsr(vmHost, sshAccessDetails);
|
||||
if (!Strings.isNullOrEmpty(csr)) {
|
||||
final Map<String, String> ipAddressDetails = new HashMap<>(sshAccessDetails);
|
||||
ipAddressDetails.remove(NetworkElementCommand.ROUTER_NAME);
|
||||
final Certificate certificate = caManager.issueCertificate(csr, Arrays.asList(vm.getHostName(), vm.getInstanceName()),
|
||||
new ArrayList<>(ipAddressDetails.values()), CAManager.CertValidityPeriod.value(), null);
|
||||
final boolean result = caManager.deployCertificate(vmHost, certificate, false, sshAccessDetails);
|
||||
if (!result) {
|
||||
s_logger.error("Failed to setup certificate for system vm: " + vm.getInstanceName());
|
||||
}
|
||||
} else {
|
||||
s_logger.error("Failed to setup keystore and generate CSR for system vm: " + vm.getInstanceName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void orchestrateStart(final String vmUuid, final Map<VirtualMachineProfile.Param, Object> params, final DeploymentPlan planToDeploy, final DeploymentPlanner planner)
|
||||
@ -1088,18 +1103,15 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
||||
if (vmHost != null && (VirtualMachine.Type.ConsoleProxy.equals(vm.getType()) ||
|
||||
VirtualMachine.Type.SecondaryStorageVm.equals(vm.getType())) && caManager.canProvisionCertificates()) {
|
||||
final Map<String, String> sshAccessDetails = _networkMgr.getSystemVMAccessDetails(vm);
|
||||
final String csr = caManager.generateKeyStoreAndCsr(vmHost, sshAccessDetails);
|
||||
if (!Strings.isNullOrEmpty(csr)) {
|
||||
final Map<String, String> ipAddressDetails = new HashMap<>(sshAccessDetails);
|
||||
ipAddressDetails.remove(NetworkElementCommand.ROUTER_NAME);
|
||||
final Certificate certificate = caManager.issueCertificate(csr, Arrays.asList(vm.getHostName(), vm.getInstanceName()), new ArrayList<>(ipAddressDetails.values()), CAManager.CertValidityPeriod.value(), null);
|
||||
final boolean result = caManager.deployCertificate(vmHost, certificate, false, sshAccessDetails);
|
||||
if (!result) {
|
||||
s_logger.error("Failed to setup certificate for system vm: " + vm.getInstanceName());
|
||||
for (int retries = 3; retries > 0; retries--) {
|
||||
try {
|
||||
setupAgentSecurity(vmHost, sshAccessDetails, vm);
|
||||
return;
|
||||
} catch (final Exception e) {
|
||||
s_logger.error("Retrying after catching exception while trying to secure agent for systemvm id=" + vm.getId(), e);
|
||||
}
|
||||
} else {
|
||||
s_logger.error("Failed to setup keystore and generate CSR for system vm: " + vm.getInstanceName());
|
||||
}
|
||||
throw new CloudRuntimeException("Failed to setup and secure agent for systemvm id=" + vm.getId());
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
@ -4776,8 +4788,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
||||
final VMInstanceVO vm = _entityMgr.findById(VMInstanceVO.class, work.getVmId());
|
||||
if (vm == null) {
|
||||
s_logger.info("Unable to find vm " + work.getVmId());
|
||||
throw new CloudRuntimeException("Unable to find VM id=" + work.getVmId());
|
||||
}
|
||||
assert vm != null;
|
||||
|
||||
orchestrateStop(vm.getUuid(), work.isCleanup());
|
||||
return new Pair<JobInfo.Status, String>(JobInfo.Status.SUCCEEDED, null);
|
||||
|
||||
@ -489,3 +489,10 @@ INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervi
|
||||
-- Add XenServer 7.2 hypervisor guest OS mappings (copy 7.1.0 & remove Windows Vista, Windows XP, Windows 2003, CentOS 4.x, RHEL 4.xS, LES 10 (all versions) as per XenServer 7.2 Release Notes)
|
||||
|
||||
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) SELECT UUID(),'Xenserver', '7.2.0', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='Xenserver' AND hypervisor_version='7.1.0' AND guest_os_id not in (1,2,3,4,56,101,56,58,93,94,50,51,87,88,89,90,91,92,26,27,28,29,40,41,42,43,44,45,96,97,107,108,109,110,151,152,153);
|
||||
|
||||
-- Change monitor patch for apache2 in systemvm
|
||||
UPDATE `cloud`.`monitoring_services` SET pidfile="/var/run/apache2/apache2.pid" WHERE process_name="apache2" AND service_name="apache2";
|
||||
|
||||
-- Use 'Other Linux 64-bit' as guest os for the default systemvmtemplate for VMware
|
||||
-- This fixes a memory allocation issue to systemvms on VMware/ESXi
|
||||
UPDATE `cloud`.`vm_template` SET guest_os_id=99 WHERE id=8;
|
||||
|
||||
@ -17,13 +17,25 @@
|
||||
|
||||
package com.cloud.upgrade.dao;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
public class Upgrade41000to41100 implements DbUpgrade {
|
||||
|
||||
final static Logger LOG = Logger.getLogger(Upgrade41000to41100.class);
|
||||
|
||||
@Override
|
||||
public String[] getUpgradableVersionRange() {
|
||||
return new String[] {"4.10.0.0", "4.11.0.0"};
|
||||
@ -52,8 +64,181 @@ public class Upgrade41000to41100 implements DbUpgrade {
|
||||
|
||||
@Override
|
||||
public void performDataMigration(Connection conn) {
|
||||
updateSystemVmTemplates(conn);
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private void updateSystemVmTemplates(final Connection conn) {
|
||||
LOG.debug("Updating System Vm template IDs");
|
||||
// Get all hypervisors in use
|
||||
final Set<Hypervisor.HypervisorType> hypervisorsListInUse = new HashSet<Hypervisor.HypervisorType>();
|
||||
try (PreparedStatement pstmt = conn.prepareStatement("select distinct(hypervisor_type) from `cloud`.`cluster` where removed is null"); ResultSet rs = pstmt.executeQuery()) {
|
||||
while (rs.next()) {
|
||||
switch (Hypervisor.HypervisorType.getType(rs.getString(1))) {
|
||||
case XenServer:
|
||||
hypervisorsListInUse.add(Hypervisor.HypervisorType.XenServer);
|
||||
break;
|
||||
case KVM:
|
||||
hypervisorsListInUse.add(Hypervisor.HypervisorType.KVM);
|
||||
break;
|
||||
case VMware:
|
||||
hypervisorsListInUse.add(Hypervisor.HypervisorType.VMware);
|
||||
break;
|
||||
case Hyperv:
|
||||
hypervisorsListInUse.add(Hypervisor.HypervisorType.Hyperv);
|
||||
break;
|
||||
case LXC:
|
||||
hypervisorsListInUse.add(Hypervisor.HypervisorType.LXC);
|
||||
break;
|
||||
case Ovm3:
|
||||
hypervisorsListInUse.add(Hypervisor.HypervisorType.Ovm3);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (final SQLException e) {
|
||||
LOG.error("updateSystemVmTemplates: Exception caught while getting hypervisor types from clusters: " + e.getMessage());
|
||||
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while getting hypervisor types from clusters", e);
|
||||
}
|
||||
|
||||
final Map<Hypervisor.HypervisorType, String> NewTemplateNameList = new HashMap<Hypervisor.HypervisorType, String>() {
|
||||
{
|
||||
put(Hypervisor.HypervisorType.KVM, "systemvm-kvm-4.11");
|
||||
put(Hypervisor.HypervisorType.VMware, "systemvm-vmware-4.11");
|
||||
put(Hypervisor.HypervisorType.XenServer, "systemvm-xenserver-4.11");
|
||||
put(Hypervisor.HypervisorType.Hyperv, "systemvm-hyperv-4.11");
|
||||
put(Hypervisor.HypervisorType.LXC, "systemvm-lxc-4.11");
|
||||
put(Hypervisor.HypervisorType.Ovm3, "systemvm-ovm3-4.11");
|
||||
}
|
||||
};
|
||||
|
||||
final Map<Hypervisor.HypervisorType, String> routerTemplateConfigurationNames = new HashMap<Hypervisor.HypervisorType, String>() {
|
||||
{
|
||||
put(Hypervisor.HypervisorType.KVM, "router.template.kvm");
|
||||
put(Hypervisor.HypervisorType.VMware, "router.template.vmware");
|
||||
put(Hypervisor.HypervisorType.XenServer, "router.template.xenserver");
|
||||
put(Hypervisor.HypervisorType.Hyperv, "router.template.hyperv");
|
||||
put(Hypervisor.HypervisorType.LXC, "router.template.lxc");
|
||||
put(Hypervisor.HypervisorType.Ovm3, "router.template.ovm3");
|
||||
}
|
||||
};
|
||||
|
||||
final Map<Hypervisor.HypervisorType, String> newTemplateUrl = new HashMap<Hypervisor.HypervisorType, String>() {
|
||||
{
|
||||
// FIXME: upload templates
|
||||
put(Hypervisor.HypervisorType.KVM, "https://download.cloudstack.org/systemvm/4.11/systemvmtemplate-4.11.0-kvm.qcow2.bz2");
|
||||
put(Hypervisor.HypervisorType.VMware, "https://download.cloudstack.org/systemvm/4.11/systemvmtemplate-4.11.0-vmware.ova");
|
||||
put(Hypervisor.HypervisorType.XenServer, "https://download.cloudstack.org/systemvm/4.11/systemvmtemplate-4.11.0-xen.vhd.bz2");
|
||||
put(Hypervisor.HypervisorType.Hyperv, "https://download.cloudstack.org/systemvm/4.11/systemvmtemplate-4.11.0-hyperv.vhd.zip");
|
||||
put(Hypervisor.HypervisorType.LXC, "https://download.cloudstack.org/systemvm/4.11/systemvmtemplate-4.11.0-kvm.qcow2.bz2");
|
||||
put(Hypervisor.HypervisorType.Ovm3, "https://download.cloudstack.org/systemvm/4.11/systemvmtemplate-4.11.0-ovm.raw.bz2");
|
||||
}
|
||||
};
|
||||
|
||||
final Map<Hypervisor.HypervisorType, String> newTemplateChecksum = new HashMap<Hypervisor.HypervisorType, String>() {
|
||||
{
|
||||
// FIXME: update checksums?
|
||||
put(Hypervisor.HypervisorType.KVM, "bc2eac46f16a2ece6c19d4b89db41de3");
|
||||
put(Hypervisor.HypervisorType.XenServer, "908c28a8d4c232f960e0f84af7f86c80");
|
||||
put(Hypervisor.HypervisorType.VMware, "970bfb070a80bd74820881d8149643c1");
|
||||
put(Hypervisor.HypervisorType.Hyperv, "0adb35bd9f92e80d3fc63fcdd9bb55e5");
|
||||
put(Hypervisor.HypervisorType.LXC, "bc2eac46f16a2ece6c19d4b89db41de3");
|
||||
put(Hypervisor.HypervisorType.Ovm3, "94a41f0a5361933813bb34a51df56f56");
|
||||
}
|
||||
};
|
||||
|
||||
for (final Map.Entry<Hypervisor.HypervisorType, String> hypervisorAndTemplateName : NewTemplateNameList.entrySet()) {
|
||||
LOG.debug("Updating " + hypervisorAndTemplateName.getKey() + " System Vms");
|
||||
try (PreparedStatement pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name = ? and removed is null order by id desc limit 1")) {
|
||||
// Get 4.11.0 systemvm template id for corresponding hypervisor
|
||||
long templateId = -1;
|
||||
pstmt.setString(1, hypervisorAndTemplateName.getValue());
|
||||
try (ResultSet rs = pstmt.executeQuery()) {
|
||||
if (rs.next()) {
|
||||
templateId = rs.getLong(1);
|
||||
}
|
||||
} catch (final SQLException e) {
|
||||
LOG.error("updateSystemVmTemplates: Exception caught while getting ids of templates: " + e.getMessage());
|
||||
throw new CloudRuntimeException("updateSystemVmTemplates: Exception caught while getting ids of templates", e);
|
||||
}
|
||||
|
||||
// change template type to SYSTEM
|
||||
if (templateId != -1) {
|
||||
try (PreparedStatement templ_type_pstmt = conn.prepareStatement("update `cloud`.`vm_template` set type='SYSTEM' where id = ?");) {
|
||||
templ_type_pstmt.setLong(1, templateId);
|
||||
templ_type_pstmt.executeUpdate();
|
||||
} catch (final SQLException e) {
|
||||
LOG.error("updateSystemVmTemplates:Exception while updating template with id " + templateId + " to be marked as 'system': " + e.getMessage());
|
||||
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while updating template with id " + templateId + " to be marked as 'system'", e);
|
||||
}
|
||||
// update template ID of system Vms
|
||||
try (PreparedStatement update_templ_id_pstmt = conn
|
||||
.prepareStatement("update `cloud`.`vm_instance` set vm_template_id = ? where type <> 'User' and hypervisor_type = ?");) {
|
||||
update_templ_id_pstmt.setLong(1, templateId);
|
||||
update_templ_id_pstmt.setString(2, hypervisorAndTemplateName.getKey().toString());
|
||||
update_templ_id_pstmt.executeUpdate();
|
||||
} catch (final Exception e) {
|
||||
LOG.error("updateSystemVmTemplates:Exception while setting template for " + hypervisorAndTemplateName.getKey().toString() + " to " + templateId
|
||||
+ ": " + e.getMessage());
|
||||
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while setting template for " + hypervisorAndTemplateName.getKey().toString() + " to "
|
||||
+ templateId, e);
|
||||
}
|
||||
|
||||
// Change value of global configuration parameter
|
||||
// router.template.* for the corresponding hypervisor
|
||||
try (PreparedStatement update_pstmt = conn.prepareStatement("UPDATE `cloud`.`configuration` SET value = ? WHERE name = ?");) {
|
||||
update_pstmt.setString(1, hypervisorAndTemplateName.getValue());
|
||||
update_pstmt.setString(2, routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()));
|
||||
update_pstmt.executeUpdate();
|
||||
} catch (final SQLException e) {
|
||||
LOG.error("updateSystemVmTemplates:Exception while setting " + routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()) + " to "
|
||||
+ hypervisorAndTemplateName.getValue() + ": " + e.getMessage());
|
||||
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while setting "
|
||||
+ routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()) + " to " + hypervisorAndTemplateName.getValue(), e);
|
||||
}
|
||||
|
||||
// Change value of global configuration parameter
|
||||
// minreq.sysvmtemplate.version for the ACS version
|
||||
try (PreparedStatement update_pstmt = conn.prepareStatement("UPDATE `cloud`.`configuration` SET value = ? WHERE name = ?");) {
|
||||
update_pstmt.setString(1, "4.11.0");
|
||||
update_pstmt.setString(2, "minreq.sysvmtemplate.version");
|
||||
update_pstmt.executeUpdate();
|
||||
} catch (final SQLException e) {
|
||||
LOG.error("updateSystemVmTemplates:Exception while setting 'minreq.sysvmtemplate.version' to 4.11.0: " + e.getMessage());
|
||||
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while setting 'minreq.sysvmtemplate.version' to 4.11.0", e);
|
||||
}
|
||||
} else {
|
||||
if (hypervisorsListInUse.contains(hypervisorAndTemplateName.getKey())) {
|
||||
throw new CloudRuntimeException(getUpgradedVersion() + hypervisorAndTemplateName.getKey() + " SystemVm template not found. Cannot upgrade system Vms");
|
||||
} else {
|
||||
LOG.warn(getUpgradedVersion() + hypervisorAndTemplateName.getKey() + " SystemVm template not found. " + hypervisorAndTemplateName.getKey()
|
||||
+ " hypervisor is not used, so not failing upgrade");
|
||||
// Update the latest template URLs for corresponding
|
||||
// hypervisor
|
||||
try (PreparedStatement update_templ_url_pstmt = conn
|
||||
.prepareStatement("UPDATE `cloud`.`vm_template` SET url = ? , checksum = ? WHERE hypervisor_type = ? AND type = 'SYSTEM' AND removed is null order by id desc limit 1");) {
|
||||
update_templ_url_pstmt.setString(1, newTemplateUrl.get(hypervisorAndTemplateName.getKey()));
|
||||
update_templ_url_pstmt.setString(2, newTemplateChecksum.get(hypervisorAndTemplateName.getKey()));
|
||||
update_templ_url_pstmt.setString(3, hypervisorAndTemplateName.getKey().toString());
|
||||
update_templ_url_pstmt.executeUpdate();
|
||||
} catch (final SQLException e) {
|
||||
LOG.error("updateSystemVmTemplates:Exception while updating 'url' and 'checksum' for hypervisor type "
|
||||
+ hypervisorAndTemplateName.getKey().toString() + ": " + e.getMessage());
|
||||
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while updating 'url' and 'checksum' for hypervisor type "
|
||||
+ hypervisorAndTemplateName.getKey().toString(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final SQLException e) {
|
||||
LOG.error("updateSystemVmTemplates:Exception while getting ids of templates: " + e.getMessage());
|
||||
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while getting ids of templates", e);
|
||||
}
|
||||
}
|
||||
LOG.debug("Updating System Vm Template IDs Complete");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public InputStream[] getCleanupScripts() {
|
||||
final String scriptFile = "META-INF/db/schema-41000to41100-cleanup.sql";
|
||||
|
||||
@ -17,19 +17,15 @@
|
||||
|
||||
package com.cloud.upgrade.dao;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
public class Upgrade4930to41000 implements DbUpgrade {
|
||||
final static Logger s_logger = Logger.getLogger(Upgrade4930to41000.class);
|
||||
@ -80,182 +76,10 @@ public class Upgrade4930to41000 implements DbUpgrade {
|
||||
|
||||
@Override
|
||||
public void performDataMigration(Connection conn) {
|
||||
updateSystemVmTemplates(conn);
|
||||
populateGuestOsDetails(conn);
|
||||
updateSourceCidrs(conn);
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private void updateSystemVmTemplates(final Connection conn) {
|
||||
s_logger.debug("Updating System Vm template IDs");
|
||||
// Get all hypervisors in use
|
||||
final Set<Hypervisor.HypervisorType> hypervisorsListInUse = new HashSet<Hypervisor.HypervisorType>();
|
||||
try (PreparedStatement pstmt = conn.prepareStatement("select distinct(hypervisor_type) from `cloud`.`cluster` where removed is null"); ResultSet rs = pstmt.executeQuery()) {
|
||||
while (rs.next()) {
|
||||
switch (Hypervisor.HypervisorType.getType(rs.getString(1))) {
|
||||
case XenServer:
|
||||
hypervisorsListInUse.add(Hypervisor.HypervisorType.XenServer);
|
||||
break;
|
||||
case KVM:
|
||||
hypervisorsListInUse.add(Hypervisor.HypervisorType.KVM);
|
||||
break;
|
||||
case VMware:
|
||||
hypervisorsListInUse.add(Hypervisor.HypervisorType.VMware);
|
||||
break;
|
||||
case Hyperv:
|
||||
hypervisorsListInUse.add(Hypervisor.HypervisorType.Hyperv);
|
||||
break;
|
||||
case LXC:
|
||||
hypervisorsListInUse.add(Hypervisor.HypervisorType.LXC);
|
||||
break;
|
||||
case Ovm3:
|
||||
hypervisorsListInUse.add(Hypervisor.HypervisorType.Ovm3);
|
||||
break;
|
||||
default: // no action on cases Any, BareMetal, None, Ovm,
|
||||
// Parralels, Simulator and VirtualBox:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (final SQLException e) {
|
||||
s_logger.error("updateSystemVmTemplates:Exception while getting hypervisor types from clusters: " + e.getMessage());
|
||||
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while getting hypervisor types from clusters", e);
|
||||
}
|
||||
|
||||
final Map<Hypervisor.HypervisorType, String> NewTemplateNameList = new HashMap<Hypervisor.HypervisorType, String>() {
|
||||
{
|
||||
put(Hypervisor.HypervisorType.XenServer, "systemvm-xenserver-4.10");
|
||||
put(Hypervisor.HypervisorType.VMware, "systemvm-vmware-4.10");
|
||||
put(Hypervisor.HypervisorType.KVM, "systemvm-kvm-4.10");
|
||||
put(Hypervisor.HypervisorType.Hyperv, "systemvm-hyperv-4.10");
|
||||
put(Hypervisor.HypervisorType.LXC, "systemvm-lxc-4.10");
|
||||
put(Hypervisor.HypervisorType.Ovm3, "systemvm-ovm3-4.10");
|
||||
}
|
||||
};
|
||||
|
||||
final Map<Hypervisor.HypervisorType, String> routerTemplateConfigurationNames = new HashMap<Hypervisor.HypervisorType, String>() {
|
||||
{
|
||||
put(Hypervisor.HypervisorType.XenServer, "router.template.xenserver");
|
||||
put(Hypervisor.HypervisorType.VMware, "router.template.vmware");
|
||||
put(Hypervisor.HypervisorType.KVM, "router.template.kvm");
|
||||
put(Hypervisor.HypervisorType.Hyperv, "router.template.hyperv");
|
||||
put(Hypervisor.HypervisorType.LXC, "router.template.lxc");
|
||||
put(Hypervisor.HypervisorType.Ovm3, "router.template.ovm3");
|
||||
}
|
||||
};
|
||||
|
||||
final Map<Hypervisor.HypervisorType, String> newTemplateUrl = new HashMap<Hypervisor.HypervisorType, String>() {
|
||||
{
|
||||
put(Hypervisor.HypervisorType.XenServer, "https://download.cloudstack.org/systemvm/4.10/systemvm64template-master-4.10.0-xen.vhd.bz2");
|
||||
put(Hypervisor.HypervisorType.VMware, "https://download.cloudstack.org/systemvm/4.10/systemvm64template-master-4.10.0-vmware.ova");
|
||||
put(Hypervisor.HypervisorType.KVM, "https://download.cloudstack.org/systemvm/4.10/systemvm64template-master-4.10.0-kvm.qcow2.bz2");
|
||||
put(Hypervisor.HypervisorType.Hyperv, "https://download.cloudstack.org/systemvm/4.10/systemvm64template-master-4.10.0-hyperv.vhd.zip");
|
||||
put(Hypervisor.HypervisorType.LXC, "https://download.cloudstack.org/systemvm/4.10/systemvm64template-master-4.10.0-kvm.qcow2.bz2");
|
||||
put(Hypervisor.HypervisorType.Ovm3, "https://download.cloudstack.org/systemvm/4.10/systemvm64template-master-4.10.0-ovm.raw.bz2");
|
||||
}
|
||||
};
|
||||
|
||||
final Map<Hypervisor.HypervisorType, String> newTemplateChecksum = new HashMap<Hypervisor.HypervisorType, String>() {
|
||||
{
|
||||
put(Hypervisor.HypervisorType.XenServer, "908c28a8d4c232f960e0f84af7f86c80");
|
||||
put(Hypervisor.HypervisorType.VMware, "970bfb070a80bd74820881d8149643c1");
|
||||
put(Hypervisor.HypervisorType.KVM, "bc2eac46f16a2ece6c19d4b89db41de3");
|
||||
put(Hypervisor.HypervisorType.Hyperv, "0adb35bd9f92e80d3fc63fcdd9bb55e5");
|
||||
put(Hypervisor.HypervisorType.LXC, "bc2eac46f16a2ece6c19d4b89db41de3");
|
||||
put(Hypervisor.HypervisorType.Ovm3, "94a41f0a5361933813bb34a51df56f56");
|
||||
}
|
||||
};
|
||||
|
||||
for (final Map.Entry<Hypervisor.HypervisorType, String> hypervisorAndTemplateName : NewTemplateNameList.entrySet()) {
|
||||
s_logger.debug("Updating " + hypervisorAndTemplateName.getKey() + " System Vms");
|
||||
try (PreparedStatement pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name = ? and removed is null order by id desc limit 1")) {
|
||||
// Get 4.10.0 system Vm template Id for corresponding hypervisor
|
||||
long templateId = -1;
|
||||
pstmt.setString(1, hypervisorAndTemplateName.getValue());
|
||||
try (ResultSet rs = pstmt.executeQuery()) {
|
||||
if (rs.next()) {
|
||||
templateId = rs.getLong(1);
|
||||
}
|
||||
} catch (final SQLException e) {
|
||||
s_logger.error("updateSystemVmTemplates:Exception while getting ids of templates: " + e.getMessage());
|
||||
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while getting ids of templates", e);
|
||||
}
|
||||
|
||||
// change template type to SYSTEM
|
||||
if (templateId != -1) {
|
||||
try (PreparedStatement templ_type_pstmt = conn.prepareStatement("update `cloud`.`vm_template` set type='SYSTEM' where id = ?");) {
|
||||
templ_type_pstmt.setLong(1, templateId);
|
||||
templ_type_pstmt.executeUpdate();
|
||||
} catch (final SQLException e) {
|
||||
s_logger.error("updateSystemVmTemplates:Exception while updating template with id " + templateId + " to be marked as 'system': " + e.getMessage());
|
||||
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while updating template with id " + templateId + " to be marked as 'system'", e);
|
||||
}
|
||||
// update template ID of system Vms
|
||||
try (PreparedStatement update_templ_id_pstmt = conn
|
||||
.prepareStatement("update `cloud`.`vm_instance` set vm_template_id = ? where type <> 'User' and hypervisor_type = ?");) {
|
||||
update_templ_id_pstmt.setLong(1, templateId);
|
||||
update_templ_id_pstmt.setString(2, hypervisorAndTemplateName.getKey().toString());
|
||||
update_templ_id_pstmt.executeUpdate();
|
||||
} catch (final Exception e) {
|
||||
s_logger.error("updateSystemVmTemplates:Exception while setting template for " + hypervisorAndTemplateName.getKey().toString() + " to " + templateId
|
||||
+ ": " + e.getMessage());
|
||||
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while setting template for " + hypervisorAndTemplateName.getKey().toString() + " to "
|
||||
+ templateId, e);
|
||||
}
|
||||
|
||||
// Change value of global configuration parameter
|
||||
// router.template.* for the corresponding hypervisor
|
||||
try (PreparedStatement update_pstmt = conn.prepareStatement("UPDATE `cloud`.`configuration` SET value = ? WHERE name = ?");) {
|
||||
update_pstmt.setString(1, hypervisorAndTemplateName.getValue());
|
||||
update_pstmt.setString(2, routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()));
|
||||
update_pstmt.executeUpdate();
|
||||
} catch (final SQLException e) {
|
||||
s_logger.error("updateSystemVmTemplates:Exception while setting " + routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()) + " to "
|
||||
+ hypervisorAndTemplateName.getValue() + ": " + e.getMessage());
|
||||
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while setting "
|
||||
+ routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()) + " to " + hypervisorAndTemplateName.getValue(), e);
|
||||
}
|
||||
|
||||
// Change value of global configuration parameter
|
||||
// minreq.sysvmtemplate.version for the ACS version
|
||||
try (PreparedStatement update_pstmt = conn.prepareStatement("UPDATE `cloud`.`configuration` SET value = ? WHERE name = ?");) {
|
||||
update_pstmt.setString(1, "4.10.0");
|
||||
update_pstmt.setString(2, "minreq.sysvmtemplate.version");
|
||||
update_pstmt.executeUpdate();
|
||||
} catch (final SQLException e) {
|
||||
s_logger.error("updateSystemVmTemplates:Exception while setting 'minreq.sysvmtemplate.version' to 4.10.0: " + e.getMessage());
|
||||
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while setting 'minreq.sysvmtemplate.version' to 4.10.0", e);
|
||||
}
|
||||
} else {
|
||||
if (hypervisorsListInUse.contains(hypervisorAndTemplateName.getKey())) {
|
||||
throw new CloudRuntimeException(getUpgradedVersion() + hypervisorAndTemplateName.getKey() + " SystemVm template not found. Cannot upgrade system Vms");
|
||||
} else {
|
||||
s_logger.warn(getUpgradedVersion() + hypervisorAndTemplateName.getKey() + " SystemVm template not found. " + hypervisorAndTemplateName.getKey()
|
||||
+ " hypervisor is not used, so not failing upgrade");
|
||||
// Update the latest template URLs for corresponding
|
||||
// hypervisor
|
||||
try (PreparedStatement update_templ_url_pstmt = conn
|
||||
.prepareStatement("UPDATE `cloud`.`vm_template` SET url = ? , checksum = ? WHERE hypervisor_type = ? AND type = 'SYSTEM' AND removed is null order by id desc limit 1");) {
|
||||
update_templ_url_pstmt.setString(1, newTemplateUrl.get(hypervisorAndTemplateName.getKey()));
|
||||
update_templ_url_pstmt.setString(2, newTemplateChecksum.get(hypervisorAndTemplateName.getKey()));
|
||||
update_templ_url_pstmt.setString(3, hypervisorAndTemplateName.getKey().toString());
|
||||
update_templ_url_pstmt.executeUpdate();
|
||||
} catch (final SQLException e) {
|
||||
s_logger.error("updateSystemVmTemplates:Exception while updating 'url' and 'checksum' for hypervisor type "
|
||||
+ hypervisorAndTemplateName.getKey().toString() + ": " + e.getMessage());
|
||||
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while updating 'url' and 'checksum' for hypervisor type "
|
||||
+ hypervisorAndTemplateName.getKey().toString(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final SQLException e) {
|
||||
s_logger.error("updateSystemVmTemplates:Exception while getting ids of templates: " + e.getMessage());
|
||||
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while getting ids of templates", e);
|
||||
}
|
||||
}
|
||||
s_logger.debug("Updating System Vm Template IDs Complete");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public InputStream[] getCleanupScripts() {
|
||||
final String scriptFile = "META-INF/db/schema-4930to41000-cleanup.sql";
|
||||
|
||||
@ -33,6 +33,7 @@ import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.utils.db.Encrypt;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
@Entity
|
||||
@Table(name = "user")
|
||||
@ -257,6 +258,9 @@ public class UserAccountVO implements UserAccount, InternalIdentity {
|
||||
|
||||
@Override
|
||||
public String getTimezone() {
|
||||
if (Strings.isNullOrEmpty(timezone)) {
|
||||
return "UTC";
|
||||
}
|
||||
return timezone;
|
||||
}
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@ import org.apache.cloudstack.api.InternalIdentity;
|
||||
import com.cloud.user.Account.State;
|
||||
import com.cloud.utils.db.Encrypt;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
/**
|
||||
* A bean representing a user
|
||||
@ -233,6 +234,9 @@ public class UserVO implements User, Identity, InternalIdentity {
|
||||
|
||||
@Override
|
||||
public String getTimezone() {
|
||||
if (Strings.isNullOrEmpty(timezone)) {
|
||||
return "UTC";
|
||||
}
|
||||
return timezone;
|
||||
}
|
||||
|
||||
|
||||
@ -216,6 +216,10 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
|
||||
@SuppressWarnings("rawtypes")
|
||||
final GenericDao dao = GenericDaoBase.getDao(job.getClass());
|
||||
|
||||
if (dao == null) {
|
||||
throw new CloudRuntimeException(String.format("Failed to get dao from job's class=%s, for job id=%d, cmd=%s", job.getClass(), job.getId(), job.getCmd()));
|
||||
}
|
||||
|
||||
publishOnEventBus(job, "submit");
|
||||
|
||||
if (!_vmInstanceDao.lockInLockTable(String.valueOf(syncObjId), VmJobLockTimeout.value())){
|
||||
|
||||
@ -104,6 +104,7 @@ Requires: bridge-utils
|
||||
Requires: ebtables
|
||||
Requires: iptables
|
||||
Requires: ethtool
|
||||
Requires: net-tools
|
||||
Requires: iproute
|
||||
Requires: ipset
|
||||
Requires: perl
|
||||
|
||||
@ -332,21 +332,27 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
||||
if (details == null) {
|
||||
details = parser.getLines();
|
||||
}
|
||||
|
||||
s_logger.debug("Executing script in VR: " + script);
|
||||
|
||||
return new ExecutionResult(command.getExitValue() == 0, details);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExecutionResult createFileInVR(final String routerIp, final String path, final String filename, final String content) {
|
||||
final File permKey = new File("/root/.ssh/id_rsa.cloud");
|
||||
String error = null;
|
||||
boolean success = true;
|
||||
String details = "Creating file in VR, with ip: " + routerIp + ", file: " + filename;
|
||||
s_logger.debug(details);
|
||||
|
||||
try {
|
||||
SshHelper.scpTo(routerIp, 3922, "root", permKey, null, path, content.getBytes(), filename, null);
|
||||
} catch (final Exception e) {
|
||||
s_logger.warn("Fail to create file " + path + filename + " in VR " + routerIp, e);
|
||||
error = e.getMessage();
|
||||
details = e.getMessage();
|
||||
success = false;
|
||||
}
|
||||
return new ExecutionResult(error == null, error);
|
||||
return new ExecutionResult(success, details);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -102,6 +102,7 @@ import com.vmware.vim25.VirtualMachineRuntimeInfo;
|
||||
import com.vmware.vim25.VirtualMachineVideoCard;
|
||||
import com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.storage.command.CopyCommand;
|
||||
import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
|
||||
import org.apache.cloudstack.storage.resource.NfsSecondaryStorageResource;
|
||||
@ -2178,9 +2179,10 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
||||
hyperHost.setRestartPriorityForVM(vmMo, DasVmPriority.HIGH.value());
|
||||
}
|
||||
|
||||
//For resizing root disk.
|
||||
if (rootDiskTO != null && !hasSnapshot) {
|
||||
resizeRootDisk(vmMo, rootDiskTO, hyperHost, context);
|
||||
// Resizing root disk only when explicit requested by user
|
||||
final Map<String, String> vmDetails = cmd.getVirtualMachine().getDetails();
|
||||
if (rootDiskTO != null && !hasSnapshot && (vmDetails != null && vmDetails.containsKey(ApiConstants.ROOT_DISK_SIZE))) {
|
||||
resizeRootDiskOnVMStart(vmMo, rootDiskTO, hyperHost, context);
|
||||
}
|
||||
|
||||
//
|
||||
@ -2250,28 +2252,28 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
||||
return path + fileType;
|
||||
}
|
||||
|
||||
private void resizeRootDisk(VirtualMachineMO vmMo, DiskTO rootDiskTO, VmwareHypervisorHost hyperHost, VmwareContext context) throws Exception
|
||||
{
|
||||
Pair<VirtualDisk, String> vdisk = getVirtualDiskInfo(vmMo, appendFileType(rootDiskTO.getPath(), ".vmdk"));
|
||||
private void resizeRootDiskOnVMStart(VirtualMachineMO vmMo, DiskTO rootDiskTO, VmwareHypervisorHost hyperHost, VmwareContext context) throws Exception {
|
||||
final Pair<VirtualDisk, String> vdisk = getVirtualDiskInfo(vmMo, appendFileType(rootDiskTO.getPath(), ".vmdk"));
|
||||
assert(vdisk != null);
|
||||
|
||||
Long reqSize=((VolumeObjectTO)rootDiskTO.getData()).getSize()/1024;
|
||||
VirtualDisk disk = vdisk.first();
|
||||
if (reqSize > disk.getCapacityInKB())
|
||||
{
|
||||
VirtualMachineDiskInfo diskInfo = getMatchingExistingDisk(vmMo.getDiskInfoBuilder(), rootDiskTO, hyperHost, context);
|
||||
Long reqSize = 0L;
|
||||
final VolumeObjectTO volumeTO = ((VolumeObjectTO)rootDiskTO.getData());
|
||||
if (volumeTO != null) {
|
||||
reqSize = volumeTO.getSize() / 1024;
|
||||
}
|
||||
final VirtualDisk disk = vdisk.first();
|
||||
if (reqSize > disk.getCapacityInKB()) {
|
||||
final VirtualMachineDiskInfo diskInfo = getMatchingExistingDisk(vmMo.getDiskInfoBuilder(), rootDiskTO, hyperHost, context);
|
||||
assert (diskInfo != null);
|
||||
String[] diskChain = diskInfo.getDiskChain();
|
||||
final String[] diskChain = diskInfo.getDiskChain();
|
||||
|
||||
if (diskChain != null && diskChain.length>1)
|
||||
{
|
||||
s_logger.error("Unsupported Disk chain length "+ diskChain.length);
|
||||
throw new Exception("Unsupported Disk chain length "+ diskChain.length);
|
||||
if (diskChain != null && diskChain.length > 1) {
|
||||
s_logger.warn("Disk chain length for the VM is greater than one, this is not supported");
|
||||
throw new CloudRuntimeException("Unsupported VM disk chain length: "+ diskChain.length);
|
||||
}
|
||||
if (diskInfo.getDiskDeviceBusName() == null || !diskInfo.getDiskDeviceBusName().toLowerCase().startsWith("scsi"))
|
||||
{
|
||||
s_logger.error("Unsupported root disk device bus "+ diskInfo.getDiskDeviceBusName() );
|
||||
throw new Exception("Unsupported root disk device bus "+ diskInfo.getDiskDeviceBusName());
|
||||
if (diskInfo.getDiskDeviceBusName() == null || !diskInfo.getDiskDeviceBusName().toLowerCase().startsWith("scsi")) {
|
||||
s_logger.warn("Resizing of root disk is only support for scsi device/bus, the provide VM's disk device bus name is " + diskInfo.getDiskDeviceBusName());
|
||||
throw new CloudRuntimeException("Unsupported VM root disk device bus: "+ diskInfo.getDiskDeviceBusName());
|
||||
}
|
||||
|
||||
disk.setCapacityInKB(reqSize);
|
||||
|
||||
44
pom.xml
@ -880,17 +880,9 @@
|
||||
<exclude>services/secondary-storage/conf/agent.properties</exclude>
|
||||
<exclude>services/secondary-storage/conf/environment.properties</exclude>
|
||||
<exclude>test/systemvm/README.md</exclude>
|
||||
<exclude>tools/appliance/.ruby-version</exclude>
|
||||
<exclude>tools/vagrant/systemvm/vagrant.pub</exclude>
|
||||
<exclude>tools/vagrant/systemvm/.ruby-version</exclude>
|
||||
<exclude>tools/devcloud/basebuild/puppet-devcloudinitial/files/network.conf</exclude>
|
||||
<exclude>tools/appliance/definitions/devcloud/*</exclude>
|
||||
<exclude>tools/appliance/definitions/systemvmtemplate/*</exclude>
|
||||
<exclude>tools/appliance/definitions/systemvm64template/*</exclude>
|
||||
<exclude>tools/appliance/definitions/builtin/*</exclude>
|
||||
<exclude>tools/appliance/*/template.json</exclude>
|
||||
<exclude>tools/cli/cloudmonkey.egg-info/*</exclude>
|
||||
<exclude>tools/devcloud/src/deps/boxes/basebox-build/definition.rb</exclude>
|
||||
<exclude>tools/devcloud/src/deps/boxes/basebox-build/preseed.cfg</exclude>
|
||||
<exclude>tools/marvin/Marvin.egg-info/*</exclude>
|
||||
<exclude>ui/css/token-input-facebook.css</exclude>
|
||||
<exclude>ui/l10n/*</exclude>
|
||||
@ -920,35 +912,11 @@
|
||||
<exclude>ui/lib/reset.css</exclude>
|
||||
<exclude>ui/lib/require.js</exclude>
|
||||
<exclude>utils/testsmallfileinactive</exclude>
|
||||
<exclude>systemvm/conf/agent.properties</exclude>
|
||||
<exclude>systemvm/conf/environment.properties</exclude>
|
||||
<exclude>systemvm/js/jquery.js</exclude>
|
||||
<exclude>systemvm/js/jquery.flot.navigate.js</exclude>
|
||||
<exclude>systemvm/patches/debian/systemvm.vmx</exclude>
|
||||
<exclude>systemvm/patches/debian/config/root/.ssh/authorized_keys</exclude>
|
||||
<exclude>systemvm/patches/debian/config/etc/apache2/httpd.conf</exclude>
|
||||
<exclude>systemvm/patches/debian/config/etc/apache2/vhost.template</exclude>
|
||||
<exclude>systemvm/patches/debian/config/etc/dnsmasq.conf.tmpl</exclude>
|
||||
<exclude>systemvm/patches/debian/config/etc/vpcdnsmasq.conf</exclude>
|
||||
<exclude>systemvm/patches/debian/config/etc/ssh/sshd_config</exclude>
|
||||
<exclude>systemvm/patches/debian/config/etc/rsyslog.conf</exclude>
|
||||
<exclude>systemvm/patches/debian/config/etc/logrotate.conf</exclude>
|
||||
<exclude>systemvm/patches/debian/config/etc/logrotate.d/*</exclude>
|
||||
<exclude>systemvm/patches/debian/config/etc/sysctl.conf</exclude>
|
||||
<exclude>systemvm/patches/debian/config/root/redundant_router/keepalived.conf.templ</exclude>
|
||||
<exclude>systemvm/patches/debian/config/root/redundant_router/arping_gateways.sh.templ</exclude>
|
||||
<exclude>systemvm/patches/debian/config/root/redundant_router/conntrackd.conf.templ</exclude>
|
||||
<exclude>systemvm/patches/debian/vpn/etc/ipsec.conf</exclude>
|
||||
<exclude>systemvm/patches/debian/vpn/etc/ppp/options.xl2tpd</exclude>
|
||||
<exclude>systemvm/patches/debian/vpn/etc/xl2tpd/xl2tpd.conf</exclude>
|
||||
<exclude>systemvm/patches/debian/vpn/etc/ipsec.secrets</exclude>
|
||||
<exclude>systemvm/patches/debian/config/etc/haproxy/haproxy.cfg</exclude>
|
||||
<exclude>systemvm/patches/debian/config/etc/cloud-nic.rules</exclude>
|
||||
<exclude>systemvm/patches/debian/config/etc/modprobe.d/aesni_intel</exclude>
|
||||
<exclude>systemvm/patches/debian/config/etc/rc.local</exclude>
|
||||
<exclude>systemvm/patches/debian/config/var/www/html/userdata/.htaccess</exclude>
|
||||
<exclude>systemvm/patches/debian/config/var/www/html/latest/.htaccess</exclude>
|
||||
<exclude>systemvm/patches/debian/vpn/etc/ipsec.d/l2tp.conf</exclude>
|
||||
<exclude>systemvm/agent/conf/agent.properties</exclude>
|
||||
<exclude>systemvm/agent/conf/environment.properties</exclude>
|
||||
<exclude>systemvm/agent/js/jquery.js</exclude>
|
||||
<exclude>systemvm/agent/js/jquery.flot.navigate.js</exclude>
|
||||
<exclude>systemvm/debian/**</exclude>
|
||||
<exclude>tools/transifex/.tx/config</exclude>
|
||||
<exclude>tools/logo/apache_cloudstack.png</exclude>
|
||||
<exclude>tools/marvin/marvin/sandbox/advanced/sandbox.cfg</exclude>
|
||||
|
||||
@ -216,11 +216,8 @@ class serviceOpsUbuntu(serviceOps):
|
||||
class serviceOpsRedhat7(serviceOps):
|
||||
def isServiceRunning(self, servicename):
|
||||
try:
|
||||
o = bash("systemctl status " + servicename)
|
||||
if "running" in o.getStdout() or "start" in o.getStdout() or "Running" in o.getStdout():
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
o = bash("systemctl is-active " + servicename)
|
||||
return "inactive" not in o.getStdout()
|
||||
except:
|
||||
return False
|
||||
|
||||
|
||||
@ -89,9 +89,7 @@ fi
|
||||
|
||||
# Restart cloud service if we're in systemvm
|
||||
if [ "$MODE" == "ssh" ] && [ -f $SYSTEM_FILE ]; then
|
||||
/etc/init.d/cloud stop > /dev/null 2>&1
|
||||
sleep 2
|
||||
/etc/init.d/cloud start > /dev/null 2>&1
|
||||
systemctl restart cloud > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
# Fix file permission
|
||||
|
||||
@ -38,11 +38,11 @@ fi
|
||||
# Generate keystore
|
||||
rm -f "$KS_FILE"
|
||||
CN=$(hostname --fqdn)
|
||||
keytool -genkey -storepass "$KS_PASS" -keypass "$KS_PASS" -alias "$ALIAS" -keyalg RSA -validity "$KS_VALIDITY" -dname cn="$CN",ou="cloudstack",o="cloudstack",c="cloudstack" -keystore "$KS_FILE"
|
||||
keytool -genkey -storepass "$KS_PASS" -keypass "$KS_PASS" -alias "$ALIAS" -keyalg RSA -validity "$KS_VALIDITY" -dname cn="$CN",ou="cloudstack",o="cloudstack",c="cloudstack" -keystore "$KS_FILE" > /dev/null 2>&1
|
||||
|
||||
# Generate CSR
|
||||
rm -f "$CSR_FILE"
|
||||
keytool -certreq -storepass "$KS_PASS" -alias "$ALIAS" -file $CSR_FILE -keystore "$KS_FILE"
|
||||
keytool -certreq -storepass "$KS_PASS" -alias "$ALIAS" -file $CSR_FILE -keystore "$KS_FILE" > /dev/null 2>&1
|
||||
cat "$CSR_FILE"
|
||||
|
||||
# Fix file permissions
|
||||
|
||||
@ -520,6 +520,7 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q
|
||||
String keyword = cmd.getKeyword();
|
||||
Integer entryTime = cmd.getEntryTime();
|
||||
Integer duration = cmd.getDuration();
|
||||
Long startId = cmd.getStartId();
|
||||
|
||||
Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject = new Ternary<Long, Boolean, ListProjectResourcesCriteria>(
|
||||
cmd.getDomainId(), cmd.isRecursive(), null);
|
||||
@ -542,7 +543,7 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q
|
||||
sb.and("createDateG", sb.entity().getCreateDate(), SearchCriteria.Op.GTEQ);
|
||||
sb.and("createDateL", sb.entity().getCreateDate(), SearchCriteria.Op.LTEQ);
|
||||
sb.and("state", sb.entity().getState(), SearchCriteria.Op.NEQ);
|
||||
sb.and("startId", sb.entity().getStartId(), SearchCriteria.Op.EQ);
|
||||
sb.or("startId", sb.entity().getStartId(), SearchCriteria.Op.EQ);
|
||||
sb.and("createDate", sb.entity().getCreateDate(), SearchCriteria.Op.BETWEEN);
|
||||
sb.and("displayEvent", sb.entity().getDisplay(), SearchCriteria.Op.EQ);
|
||||
sb.and("archived", sb.entity().getArchived(), SearchCriteria.Op.EQ);
|
||||
@ -561,6 +562,13 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q
|
||||
sc.setParameters("id", id);
|
||||
}
|
||||
|
||||
if (startId != null) {
|
||||
sc.setParameters("startId", startId);
|
||||
if (id == null) {
|
||||
sc.setParameters("id", startId);
|
||||
}
|
||||
}
|
||||
|
||||
if (keyword != null) {
|
||||
SearchCriteria<EventJoinVO> ssc = _eventJoinDao.createSearchCriteria();
|
||||
ssc.addOr("type", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
|
||||
@ -159,8 +159,8 @@ public class HostJoinDaoImpl extends GenericDaoBase<HostJoinVO, Long> implements
|
||||
Long mem = host.getMemReservedCapacity() + host.getMemUsedCapacity();
|
||||
Long cpu = host.getCpuReservedCapacity() + host.getCpuUsedCapacity();
|
||||
|
||||
hostResponse.setMemoryTotal(mem);
|
||||
Float totalMemorywithOverprovisioning=new Float((host.getTotalMemory()*ApiDBUtils.getMemOverprovisioningFactor(host.getClusterId())));
|
||||
hostResponse.setMemoryTotal(host.getTotalMemory());
|
||||
Float totalMemorywithOverprovisioning = host.getTotalMemory() * ApiDBUtils.getMemOverprovisioningFactor(host.getClusterId());
|
||||
hostResponse.setMemWithOverprovisioning(totalMemorywithOverprovisioning.toString());
|
||||
hostResponse.setMemoryAllocated(mem);
|
||||
|
||||
@ -180,7 +180,7 @@ public class HostJoinDaoImpl extends GenericDaoBase<HostJoinVO, Long> implements
|
||||
|
||||
hostResponse.setHypervisorVersion(host.getHypervisorVersion());
|
||||
|
||||
Float cpuWithOverprovisioning = new Float(host.getCpus() * host.getSpeed() * ApiDBUtils.getCpuOverprovisioningFactor(host.getClusterId()));
|
||||
Float cpuWithOverprovisioning = host.getCpus() * host.getSpeed() * ApiDBUtils.getCpuOverprovisioningFactor(host.getClusterId());
|
||||
String cpuAlloc = decimalFormat.format(((float)cpu / cpuWithOverprovisioning * 100f)) + "%";
|
||||
hostResponse.setCpuAllocated(cpuAlloc);
|
||||
hostResponse.setCpuWithOverprovisioning(cpuWithOverprovisioning.toString());
|
||||
@ -308,10 +308,10 @@ public class HostJoinDaoImpl extends GenericDaoBase<HostJoinVO, Long> implements
|
||||
Long mem = host.getMemReservedCapacity() + host.getMemUsedCapacity();
|
||||
Long cpu = host.getCpuReservedCapacity() + host.getCpuReservedCapacity();
|
||||
|
||||
hostResponse.setMemoryTotal(mem);
|
||||
Float memWithOverprovisioning =new Float((host.getTotalMemory()*ApiDBUtils.getMemOverprovisioningFactor(host.getClusterId())));
|
||||
hostResponse.setMemoryTotal(host.getTotalMemory());
|
||||
Float memWithOverprovisioning = host.getTotalMemory() * ApiDBUtils.getMemOverprovisioningFactor(host.getClusterId());
|
||||
hostResponse.setMemWithOverprovisioning(memWithOverprovisioning.toString());
|
||||
hostResponse.setMemoryAllocated(decimalFormat.format((float)mem/ memWithOverprovisioning*100f).toString()+"%");
|
||||
hostResponse.setMemoryAllocated(decimalFormat.format((float) mem / memWithOverprovisioning * 100.0f) +"%");
|
||||
|
||||
String hostTags = host.getTag();
|
||||
hostResponse.setHostTags(host.getTag());
|
||||
|
||||
@ -29,6 +29,7 @@ import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.ca.CAManager;
|
||||
import org.apache.cloudstack.ca.SetupCertificateCommand;
|
||||
import org.apache.cloudstack.config.ApiServiceConfiguration;
|
||||
import org.apache.cloudstack.framework.ca.Certificate;
|
||||
import org.apache.cloudstack.utils.security.KeyStoreUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
@ -66,7 +67,6 @@ import com.trilead.ssh2.Connection;
|
||||
|
||||
public abstract class LibvirtServerDiscoverer extends DiscovererBase implements Discoverer, Listener, ResourceStateAdapter {
|
||||
private static final Logger s_logger = Logger.getLogger(LibvirtServerDiscoverer.class);
|
||||
private String _hostIp;
|
||||
private final int _waitTime = 5; /* wait for 5 minutes */
|
||||
private String _kvmPrivateNic;
|
||||
private String _kvmPublicNic;
|
||||
@ -291,7 +291,7 @@ public abstract class LibvirtServerDiscoverer extends DiscovererBase implements
|
||||
|
||||
setupAgentSecurity(sshConnection, agentIp, hostname);
|
||||
|
||||
String parameters = " -m " + StringUtils.shuffleCSVList(_hostIp) + " -z " + dcId + " -p " + podId + " -c " + clusterId + " -g " + guid + " -a";
|
||||
String parameters = " -m " + StringUtils.shuffleCSVList(ApiServiceConfiguration.ManagementHostIPAdr.value()) + " -z " + dcId + " -p " + podId + " -c " + clusterId + " -g " + guid + " -a";
|
||||
|
||||
parameters += " --pubNic=" + kvmPublicNic;
|
||||
parameters += " --prvNic=" + kvmPrivateNic;
|
||||
@ -395,10 +395,6 @@ public abstract class LibvirtServerDiscoverer extends DiscovererBase implements
|
||||
_kvmGuestNic = _kvmPrivateNic;
|
||||
}
|
||||
|
||||
_hostIp = _configDao.getValue("host");
|
||||
if (_hostIp == null) {
|
||||
throw new ConfigurationException("Can't get host IP");
|
||||
}
|
||||
_resourceMgr.registerResourceStateAdapter(this.getClass().getSimpleName(), this);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -292,7 +292,6 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
||||
SearchBuilder<IPAddressVO> AssignIpAddressSearch;
|
||||
SearchBuilder<IPAddressVO> AssignIpAddressFromPodVlanSearch;
|
||||
private static final Object allocatedLock = new Object();
|
||||
private static final Object allocatingLock = new Object();
|
||||
|
||||
static Boolean rulesContinueOnErrFlag = true;
|
||||
|
||||
@ -799,28 +798,55 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
||||
throw new AccountLimitException("Maximum number of public IP addresses for account: " + owner.getAccountName() + " has been exceeded.");
|
||||
}
|
||||
}
|
||||
IPAddressVO addr = addrs.get(0);
|
||||
addr.setSourceNat(sourceNat);
|
||||
addr.setAllocatedTime(new Date());
|
||||
addr.setAllocatedInDomainId(owner.getDomainId());
|
||||
addr.setAllocatedToAccountId(owner.getId());
|
||||
addr.setSystem(isSystem);
|
||||
|
||||
if (displayIp != null) {
|
||||
addr.setDisplay(displayIp);
|
||||
IPAddressVO finalAddr = null;
|
||||
for (final IPAddressVO possibleAddr: addrs) {
|
||||
if (possibleAddr.getState() != IpAddress.State.Free) {
|
||||
continue;
|
||||
}
|
||||
final IPAddressVO addr = possibleAddr;
|
||||
addr.setSourceNat(sourceNat);
|
||||
addr.setAllocatedTime(new Date());
|
||||
addr.setAllocatedInDomainId(owner.getDomainId());
|
||||
addr.setAllocatedToAccountId(owner.getId());
|
||||
addr.setSystem(isSystem);
|
||||
|
||||
if (displayIp != null) {
|
||||
addr.setDisplay(displayIp);
|
||||
}
|
||||
|
||||
if (vlanUse != VlanType.DirectAttached) {
|
||||
addr.setAssociatedWithNetworkId(guestNetworkId);
|
||||
addr.setVpcId(vpcId);
|
||||
}
|
||||
if (_ipAddressDao.lockRow(possibleAddr.getId(), true) != null) {
|
||||
final IPAddressVO userIp = _ipAddressDao.findById(addr.getId());
|
||||
if (userIp.getState() == IpAddress.State.Free) {
|
||||
addr.setState(IpAddress.State.Allocating);
|
||||
if (_ipAddressDao.update(addr.getId(), addr)) {
|
||||
finalAddr = addr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vlanUse != VlanType.DirectAttached) {
|
||||
addr.setAssociatedWithNetworkId(guestNetworkId);
|
||||
addr.setVpcId(vpcId);
|
||||
if (finalAddr == null) {
|
||||
s_logger.error("Failed to fetch any free public IP address");
|
||||
throw new CloudRuntimeException("Failed to fetch any free public IP address");
|
||||
}
|
||||
|
||||
if (assign) {
|
||||
markPublicIpAsAllocated(addr);
|
||||
} else {
|
||||
markPublicIpAsAllocating(addr);
|
||||
markPublicIpAsAllocated(finalAddr);
|
||||
}
|
||||
return addr;
|
||||
|
||||
final State expectedAddressState = assign ? State.Allocated : State.Allocating;
|
||||
if (finalAddr.getState() != expectedAddressState) {
|
||||
s_logger.error("Failed to fetch new public IP and get in expected state=" + expectedAddressState);
|
||||
throw new CloudRuntimeException("Failed to fetch new public IP with expected state " + expectedAddressState);
|
||||
}
|
||||
|
||||
return finalAddr;
|
||||
}
|
||||
});
|
||||
|
||||
@ -840,7 +866,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
||||
public void doInTransactionWithoutResult(TransactionStatus status) {
|
||||
Account owner = _accountMgr.getAccount(addr.getAllocatedToAccountId());
|
||||
if (_ipAddressDao.lockRow(addr.getId(), true) != null) {
|
||||
IPAddressVO userIp = _ipAddressDao.findById(addr.getId());
|
||||
final IPAddressVO userIp = _ipAddressDao.findById(addr.getId());
|
||||
if (userIp.getState() == IpAddress.State.Allocating || addr.getState() == IpAddress.State.Free) {
|
||||
addr.setState(IpAddress.State.Allocated);
|
||||
if (_ipAddressDao.update(addr.getId(), addr)) {
|
||||
@ -861,26 +887,8 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
||||
s_logger.error("Failed to mark public IP as allocated with id=" + addr.getId() + " address=" + addr.getAddress());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@DB
|
||||
private void markPublicIpAsAllocating(final IPAddressVO addr) {
|
||||
synchronized (allocatingLock) {
|
||||
Transaction.execute(new TransactionCallbackNoReturn() {
|
||||
@Override
|
||||
public void doInTransactionWithoutResult(TransactionStatus status) {
|
||||
|
||||
if (_ipAddressDao.lockRow(addr.getId(), true) != null) {
|
||||
addr.setState(IpAddress.State.Allocating);
|
||||
if (!_ipAddressDao.update(addr.getId(), addr)) {
|
||||
s_logger.error("Failed to update public IP as allocating with id=" + addr.getId() + " and address=" + addr.getAddress());
|
||||
}
|
||||
} else {
|
||||
s_logger.error("Failed to lock row to mark public IP as allocating with id=" + addr.getId() + " and address=" + addr.getAddress());
|
||||
s_logger.error("Failed to acquire row lock to mark public IP as allocated with id=" + addr.getId() + " address=" + addr.getAddress());
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -921,27 +929,34 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
||||
|
||||
PublicIp ip = null;
|
||||
try {
|
||||
Account ownerAccount = _accountDao.acquireInLockTable(ownerId);
|
||||
ip = Transaction.execute(new TransactionCallbackWithException<PublicIp, InsufficientAddressCapacityException>() {
|
||||
@Override
|
||||
public PublicIp doInTransaction(TransactionStatus status) throws InsufficientAddressCapacityException {
|
||||
Account owner = _accountDao.acquireInLockTable(ownerId);
|
||||
|
||||
if (ownerAccount == null) {
|
||||
// this ownerId comes from owner or type Account. See the class "AccountVO" and the annotations in that class
|
||||
// to get the table name and field name that is queried to fill this ownerid.
|
||||
ConcurrentOperationException ex = new ConcurrentOperationException("Unable to lock account");
|
||||
throw ex;
|
||||
if (owner == null) {
|
||||
// this ownerId comes from owner or type Account. See the class "AccountVO" and the annotations in that class
|
||||
// to get the table name and field name that is queried to fill this ownerid.
|
||||
ConcurrentOperationException ex = new ConcurrentOperationException("Unable to lock account");
|
||||
throw ex;
|
||||
}
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("lock account " + ownerId + " is acquired");
|
||||
}
|
||||
boolean displayIp = true;
|
||||
if (guestNtwkId != null) {
|
||||
Network ntwk = _networksDao.findById(guestNtwkId);
|
||||
displayIp = ntwk.getDisplayNetwork();
|
||||
} else if (vpcId != null) {
|
||||
VpcVO vpc = _vpcDao.findById(vpcId);
|
||||
displayIp = vpc.isDisplay();
|
||||
}
|
||||
return fetchNewPublicIp(dcId, null, null, owner, VlanType.VirtualNetwork, guestNtwkId, isSourceNat, true, null, false, vpcId, displayIp);
|
||||
}
|
||||
});
|
||||
if (ip.getState() != State.Allocated) {
|
||||
s_logger.error("Failed to fetch new IP and allocate it for ip with id=" + ip.getId() + ", address=" + ip.getAddress());
|
||||
}
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("lock account " + ownerId + " is acquired");
|
||||
}
|
||||
boolean displayIp = true;
|
||||
if (guestNtwkId != null) {
|
||||
Network ntwk = _networksDao.findById(guestNtwkId);
|
||||
displayIp = ntwk.getDisplayNetwork();
|
||||
} else if (vpcId != null) {
|
||||
VpcVO vpc = _vpcDao.findById(vpcId);
|
||||
displayIp = vpc.isDisplay();
|
||||
}
|
||||
|
||||
ip = fetchNewPublicIp(dcId, null, null, owner, VlanType.VirtualNetwork, guestNtwkId, isSourceNat, true, null, false, vpcId, displayIp);
|
||||
return ip;
|
||||
} finally {
|
||||
if (owner != null) {
|
||||
|
||||
@ -475,7 +475,7 @@ public class CommandSetupHelper {
|
||||
|
||||
public void createAssociateIPCommands(final VirtualRouter router, final List<? extends PublicIpAddress> ips, final Commands cmds, final long vmId) {
|
||||
final String ipAssocCommand = "IPAssocCommand";
|
||||
createRedundantAssociateIPCommands(router, ips, cmds, ipAssocCommand, vmId);
|
||||
createRedundantAssociateIPCommands(router, ips, cmds, ipAssocCommand, false);
|
||||
}
|
||||
|
||||
public void createNetworkACLsCommands(final List<? extends NetworkACLItem> rules, final VirtualRouter router, final Commands cmds, final long guestNetworkId,
|
||||
@ -645,7 +645,7 @@ public class CommandSetupHelper {
|
||||
|
||||
final String ipAssocCommand = "IPAssocVpcCommand";
|
||||
if (router.getIsRedundantRouter()) {
|
||||
createRedundantAssociateIPCommands(router, ips, cmds, ipAssocCommand, 0);
|
||||
createRedundantAssociateIPCommands(router, ips, cmds, ipAssocCommand, true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -742,7 +742,7 @@ public class CommandSetupHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public void createRedundantAssociateIPCommands(final VirtualRouter router, final List<? extends PublicIpAddress> ips, final Commands cmds, final String ipAssocCommand, final long vmId) {
|
||||
public void createRedundantAssociateIPCommands(final VirtualRouter router, final List<? extends PublicIpAddress> ips, final Commands cmds, final String ipAssocCommand, final boolean isVPC) {
|
||||
|
||||
// Ensure that in multiple vlans case we first send all ip addresses of
|
||||
// vlan1, then all ip addresses of vlan2, etc..
|
||||
@ -840,7 +840,16 @@ public class CommandSetupHelper {
|
||||
}
|
||||
|
||||
// for network if the ips does not have any rules, then only last ip
|
||||
List<IPAddressVO> userIps = _ipAddressDao.listByAssociatedNetwork(associatedWithNetworkId, null);
|
||||
final List<IPAddressVO> userIps = _ipAddressDao.listByAssociatedNetwork(associatedWithNetworkId, null);
|
||||
boolean hasSourceNat = false;
|
||||
if (isVPC && userIps.size() > 0 && userIps.get(0) != null) {
|
||||
// All ips should belong to a VPC
|
||||
final Long vpcId = userIps.get(0).getVpcId();
|
||||
final List<IPAddressVO> sourceNatIps = _ipAddressDao.listByAssociatedVpc(vpcId, true);
|
||||
if (sourceNatIps != null && sourceNatIps.size() > 0) {
|
||||
hasSourceNat = true;
|
||||
}
|
||||
}
|
||||
|
||||
int ipsWithrules = 0;
|
||||
int ipsStaticNat = 0;
|
||||
@ -864,7 +873,7 @@ public class CommandSetupHelper {
|
||||
cmd.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, dcVo.getNetworkType().toString());
|
||||
|
||||
// if there is 1 static nat then it will be checked for remove at the resource
|
||||
if (ipsWithrules == 0 && ipsStaticNat == 0) {
|
||||
if (ipsWithrules == 0 && ipsStaticNat == 0 && !hasSourceNat) {
|
||||
// there is only one ip address for the network.
|
||||
cmd.setAccessDetail(NetworkElementCommand.NETWORK_PUB_LAST_IP, "true");
|
||||
} else {
|
||||
|
||||
@ -1749,6 +1749,11 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
|
||||
@ActionEvent(eventType = EventTypes.EVENT_PRIVATE_GATEWAY_DELETE, eventDescription = "deleting private gateway")
|
||||
@DB
|
||||
public boolean deleteVpcPrivateGateway(final long gatewayId) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
final VpcGatewayVO gatewayToBeDeleted = _vpcGatewayDao.findById(gatewayId);
|
||||
if (gatewayToBeDeleted == null) {
|
||||
s_logger.debug("VPC gateway is already deleted for id=" + gatewayId);
|
||||
return true;
|
||||
}
|
||||
|
||||
final VpcGatewayVO gatewayVO = _vpcGatewayDao.acquireInLockTable(gatewayId);
|
||||
if (gatewayVO == null || gatewayVO.getType() != VpcGateway.Type.Private) {
|
||||
|
||||
@ -2274,7 +2274,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
|
||||
}
|
||||
|
||||
try {
|
||||
SSHCmdHelper.SSHCmdResult result = SSHCmdHelper.sshExecuteCmdOneShot(connection, "service cloudstack-agent restart || systemctl restart cloudstack-agent");
|
||||
SSHCmdHelper.SSHCmdResult result = SSHCmdHelper.sshExecuteCmdOneShot(connection, "service cloudstack-agent restart");
|
||||
s_logger.debug("cloudstack-agent restart result: " + result.toString());
|
||||
} catch (final SshException e) {
|
||||
return false;
|
||||
|
||||
@ -64,6 +64,7 @@ import com.cloud.cluster.ManagementServerHostVO;
|
||||
import com.cloud.cluster.dao.ManagementServerHostDao;
|
||||
import com.cloud.dc.Vlan.VlanType;
|
||||
import com.cloud.dc.VlanVO;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
import com.cloud.dc.dao.VlanDao;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
import com.cloud.gpu.dao.HostGpuGroupsDao;
|
||||
@ -92,18 +93,20 @@ import com.cloud.network.as.dao.AutoScaleVmGroupVmMapDao;
|
||||
import com.cloud.network.as.dao.AutoScaleVmProfileDao;
|
||||
import com.cloud.network.as.dao.ConditionDao;
|
||||
import com.cloud.network.as.dao.CounterDao;
|
||||
import com.cloud.org.Cluster;
|
||||
import com.cloud.resource.ResourceManager;
|
||||
import com.cloud.resource.ResourceState;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.service.dao.ServiceOfferingDao;
|
||||
import com.cloud.storage.ImageStoreDetailsUtil;
|
||||
import com.cloud.storage.ScopeType;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.storage.StorageManager;
|
||||
import com.cloud.storage.StorageStats;
|
||||
import com.cloud.storage.VolumeStats;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.storage.dao.VolumeDao;
|
||||
import com.cloud.user.UserStatisticsVO;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.user.VmDiskStatisticsVO;
|
||||
import com.cloud.user.dao.UserStatisticsDao;
|
||||
import com.cloud.user.dao.VmDiskStatisticsDao;
|
||||
@ -173,6 +176,8 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
||||
@Inject
|
||||
private HostDao _hostDao;
|
||||
@Inject
|
||||
private ClusterDao _clusterDao;
|
||||
@Inject
|
||||
private UserVmDao _userVmDao;
|
||||
@Inject
|
||||
private VolumeDao _volsDao;
|
||||
@ -916,9 +921,25 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
||||
}
|
||||
}
|
||||
try {
|
||||
HashMap<String, VolumeStatsEntry> volumeStatsByUuid = _userVmMgr.getVolumeStatistics(pool.getClusterId(), pool.getUuid(), pool.getPoolType(), volumeLocators, StatsTimeout.value());
|
||||
Map<String, VolumeStatsEntry> volumeStatsByUuid;
|
||||
if (pool.getScope() == ScopeType.ZONE) {
|
||||
volumeStatsByUuid = new HashMap<>();
|
||||
for (final Cluster cluster: _clusterDao.listByZoneId(pool.getDataCenterId())) {
|
||||
final Map<String, VolumeStatsEntry> volumeStatsForCluster = _userVmMgr.getVolumeStatistics(cluster.getId(), pool.getUuid(), pool.getPoolType(), volumeLocators, StatsTimeout.value());
|
||||
if (volumeStatsForCluster != null) {
|
||||
volumeStatsByUuid.putAll(volumeStatsForCluster);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
volumeStatsByUuid = _userVmMgr.getVolumeStatistics(pool.getClusterId(), pool.getUuid(), pool.getPoolType(), volumeLocators, StatsTimeout.value());
|
||||
}
|
||||
if (volumeStatsByUuid != null){
|
||||
_volumeStats.putAll(volumeStatsByUuid);
|
||||
for (final Map.Entry<String, VolumeStatsEntry> entry : volumeStatsByUuid.entrySet()) {
|
||||
if (entry == null || entry.getKey() == null || entry.getValue() == null) {
|
||||
continue;
|
||||
}
|
||||
_volumeStats.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
s_logger.warn("Failed to get volume stats for cluster with ID: " + pool.getClusterId(), e);
|
||||
@ -932,7 +953,10 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
||||
}
|
||||
|
||||
public VolumeStats getVolumeStats(String volumeLocator) {
|
||||
return _volumeStats.get(volumeLocator);
|
||||
if (volumeLocator != null && _volumeStats.containsKey(volumeLocator)) {
|
||||
return _volumeStats.get(volumeLocator);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class StorageCollector extends ManagedContextRunnable {
|
||||
|
||||
@ -28,10 +28,10 @@ import com.cloud.vm.SecondaryStorageVmVO;
|
||||
public interface SecondaryStorageVmManager extends Manager {
|
||||
|
||||
public static final int DEFAULT_SS_VM_RAMSIZE = 512; // 512M
|
||||
public static final int DEFAULT_SS_VM_CPUMHZ = 500; // 500 MHz
|
||||
public static final int DEFAULT_SS_VM_CPUMHZ = 500; // 500 MHz
|
||||
public static final int DEFAULT_SS_VM_MTUSIZE = 1500;
|
||||
public static final int DEFAULT_SS_VM_CAPACITY = 50; // max command execution session per SSVM
|
||||
public static final int DEFAULT_STANDBY_CAPACITY = 10; // standy capacity to reserve per zone
|
||||
public static final int DEFAULT_STANDBY_CAPACITY = 10; // standy capacity to reserve per zone
|
||||
|
||||
public static final String ALERT_SUBJECT = "secondarystoragevm-alert";
|
||||
|
||||
|
||||
@ -26,21 +26,18 @@ import java.lang.reflect.Method;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.log4j.xml.DOMConfigurator;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.sun.net.httpserver.HttpServer;
|
||||
|
||||
import com.cloud.consoleproxy.util.Logger;
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import com.cloud.utils.ReflectUtil;
|
||||
import com.google.gson.Gson;
|
||||
import com.sun.net.httpserver.HttpServer;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -74,25 +71,11 @@ public class ConsoleProxy {
|
||||
static String factoryClzName;
|
||||
static boolean standaloneStart = false;
|
||||
|
||||
static String encryptorPassword = genDefaultEncryptorPassword();
|
||||
|
||||
private static String genDefaultEncryptorPassword() {
|
||||
try {
|
||||
SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
|
||||
|
||||
byte[] randomBytes = new byte[16];
|
||||
random.nextBytes(randomBytes);
|
||||
return Base64.encodeBase64String(randomBytes);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
s_logger.error("Unexpected exception ", e);
|
||||
assert (false);
|
||||
}
|
||||
|
||||
return "Dummy";
|
||||
}
|
||||
static String encryptorPassword = "Dummy";
|
||||
|
||||
private static void configLog4j() {
|
||||
URL configUrl = System.class.getResource("/conf/log4j-cloud.xml");
|
||||
final ClassLoader loader = ReflectUtil.getClassLoaderForName("conf");
|
||||
URL configUrl = loader.getResource("/conf/log4j-cloud.xml");
|
||||
if (configUrl == null)
|
||||
configUrl = ClassLoader.getSystemResource("log4j-cloud.xml");
|
||||
|
||||
@ -249,23 +232,25 @@ public class ConsoleProxy {
|
||||
}
|
||||
}
|
||||
|
||||
public static void startWithContext(Properties conf, Object context, byte[] ksBits, String ksPassword) {
|
||||
public static void startWithContext(Properties conf, Object context, byte[] ksBits, String ksPassword, String password) {
|
||||
setEncryptorPassword(password);
|
||||
configLog4j();
|
||||
Logger.setFactory(new ConsoleProxyLoggerFactory());
|
||||
s_logger.info("Start console proxy with context");
|
||||
|
||||
if (conf != null) {
|
||||
for (Object key : conf.keySet()) {
|
||||
s_logger.info("Context property " + (String)key + ": " + conf.getProperty((String)key));
|
||||
}
|
||||
}
|
||||
|
||||
configLog4j();
|
||||
Logger.setFactory(new ConsoleProxyLoggerFactory());
|
||||
|
||||
// Using reflection to setup private/secure communication channel towards management server
|
||||
ConsoleProxy.context = context;
|
||||
ConsoleProxy.ksBits = ksBits;
|
||||
ConsoleProxy.ksPassword = ksPassword;
|
||||
try {
|
||||
Class<?> contextClazz = Class.forName("com.cloud.agent.resource.consoleproxy.ConsoleProxyResource");
|
||||
final ClassLoader loader = ReflectUtil.getClassLoaderForName("agent");
|
||||
Class<?> contextClazz = loader.loadClass("com.cloud.agent.resource.consoleproxy.ConsoleProxyResource");
|
||||
authMethod = contextClazz.getDeclaredMethod("authenticateConsoleAccess", String.class, String.class, String.class, String.class, String.class, Boolean.class);
|
||||
reportMethod = contextClazz.getDeclaredMethod("reportLoadInfo", String.class);
|
||||
ensureRouteMethod = contextClazz.getDeclaredMethod("ensureRoute", String.class);
|
||||
|
||||
@ -235,8 +235,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
||||
String nfsVersionParam = (String)params.get("nfsVersion");
|
||||
try {
|
||||
nfsVersion = Integer.valueOf(nfsVersionParam);
|
||||
}
|
||||
catch (NumberFormatException e){
|
||||
} catch (NumberFormatException e){
|
||||
s_logger.error("Couldn't cast " + nfsVersionParam + " to integer");
|
||||
return null;
|
||||
}
|
||||
@ -2269,9 +2268,9 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
||||
if (!_inSystemVM) {
|
||||
return;
|
||||
}
|
||||
Script command = new Script("/bin/bash", s_logger);
|
||||
command.add("-c");
|
||||
command.add("if [ -f /etc/init.d/ssh ]; then service ssh restart; else service sshd restart; fi ");
|
||||
Script command = new Script("/bin/systemctl", s_logger);
|
||||
command.add("restart");
|
||||
command.add("ssh");
|
||||
String result = command.execute();
|
||||
if (result != null) {
|
||||
s_logger.warn("Error in starting sshd service err=" + result);
|
||||
|
||||
@ -1070,10 +1070,9 @@ public class DownloadManagerImpl extends ManagerBase implements DownloadManager
|
||||
}
|
||||
|
||||
private void startAdditionalServices() {
|
||||
|
||||
Script command = new Script("/bin/bash", s_logger);
|
||||
command.add("-c");
|
||||
command.add("if [ -d /etc/apache2 ] ; then service apache2 stop; else service httpd stop; fi ");
|
||||
Script command = new Script("/bin/systemctl", s_logger);
|
||||
command.add("stop");
|
||||
command.add("apache2");
|
||||
String result = command.execute();
|
||||
if (result != null) {
|
||||
s_logger.warn("Error in stopping httpd service err=" + result);
|
||||
@ -1088,21 +1087,25 @@ public class DownloadManagerImpl extends ManagerBase implements DownloadManager
|
||||
|
||||
result = command.execute();
|
||||
if (result != null) {
|
||||
s_logger.warn("Error in opening up httpd port err=" + result);
|
||||
s_logger.warn("Error in opening up apache2 port err=" + result);
|
||||
return;
|
||||
}
|
||||
|
||||
command = new Script("/bin/bash", s_logger);
|
||||
command.add("-c");
|
||||
command.add("if [ -d /etc/apache2 ] ; then service apache2 start; else service httpd start; fi ");
|
||||
command = new Script("/bin/systemctl", s_logger);
|
||||
command.add("start");
|
||||
command.add("apache2");
|
||||
result = command.execute();
|
||||
if (result != null) {
|
||||
s_logger.warn("Error in starting httpd service err=" + result);
|
||||
s_logger.warn("Error in starting apache2 service err=" + result);
|
||||
return;
|
||||
}
|
||||
command = new Script("mkdir", s_logger);
|
||||
command.add("-p");
|
||||
command.add("/var/www/html/copy/template");
|
||||
|
||||
command = new Script("/bin/su", s_logger);
|
||||
command.add("-s");
|
||||
command.add("/bin/bash");
|
||||
command.add("-c");
|
||||
command.add("mkdir -p /var/www/html/copy/template");
|
||||
command.add("www-data");
|
||||
result = command.execute();
|
||||
if (result != null) {
|
||||
s_logger.warn("Error in creating directory =" + result);
|
||||
|
||||
@ -266,9 +266,12 @@ public class UploadManagerImpl extends ManagerBase implements UploadManager {
|
||||
}
|
||||
// Create the directory structure so that its visible under apache server root
|
||||
String extractDir = "/var/www/html/userdata/";
|
||||
Script command = new Script("mkdir", s_logger);
|
||||
command.add("-p");
|
||||
command.add(extractDir);
|
||||
Script command = new Script("/bin/su", s_logger);
|
||||
command.add("-s");
|
||||
command.add("/bin/bash");
|
||||
command.add("-c");
|
||||
command.add("mkdir -p " + extractDir);
|
||||
command.add("www-data");
|
||||
String result = command.execute();
|
||||
if (result != null) {
|
||||
String errorString = "Error in creating directory =" + result;
|
||||
@ -278,15 +281,6 @@ public class UploadManagerImpl extends ManagerBase implements UploadManager {
|
||||
|
||||
// Create a random file under the directory for security reasons.
|
||||
String uuid = cmd.getExtractLinkUUID();
|
||||
command = new Script("touch", s_logger);
|
||||
command.add(extractDir + uuid);
|
||||
result = command.execute();
|
||||
if (result != null) {
|
||||
String errorString = "Error in creating file " + uuid + " ,error: " + result;
|
||||
s_logger.warn(errorString);
|
||||
return new CreateEntityDownloadURLAnswer(errorString, CreateEntityDownloadURLAnswer.RESULT_FAILURE);
|
||||
}
|
||||
|
||||
// Create a symbolic link from the actual directory to the template location. The entity would be directly visible under /var/www/html/userdata/cmd.getInstallPath();
|
||||
command = new Script("/bin/bash", s_logger);
|
||||
command.add("-c");
|
||||
@ -501,46 +495,20 @@ public class UploadManagerImpl extends ManagerBase implements UploadManager {
|
||||
}
|
||||
|
||||
private boolean checkAndStartApache() {
|
||||
|
||||
//Check whether the Apache server is running
|
||||
Script command = new Script("/bin/bash", s_logger);
|
||||
command.add("-c");
|
||||
command.add("if [ -d /etc/apache2 ] ; then service apache2 status | grep pid; else service httpd status | grep pid; fi ");
|
||||
Script command = new Script("/bin/systemctl", s_logger);
|
||||
command.add("is-active");
|
||||
command.add("apache2");
|
||||
String result = command.execute();
|
||||
|
||||
//Apache Server is not running. Try to start it.
|
||||
if (result != null) {
|
||||
|
||||
/*s_logger.warn("Apache server not running, trying to start it");
|
||||
String port = Integer.toString(TemplateConstants.DEFAULT_TMPLT_COPY_PORT);
|
||||
String intf = TemplateConstants.DEFAULT_TMPLT_COPY_INTF;
|
||||
|
||||
command = new Script("/bin/bash", s_logger);
|
||||
command.add("-c");
|
||||
command.add("iptables -D INPUT -i " + intf + " -p tcp -m state --state NEW -m tcp --dport " + port + " -j DROP;" +
|
||||
"iptables -D INPUT -i " + intf + " -p tcp -m state --state NEW -m tcp --dport " + port + " -j HTTP;" +
|
||||
"iptables -D INPUT -i " + intf + " -p tcp -m state --state NEW -m tcp --dport " + "443" + " -j DROP;" +
|
||||
"iptables -D INPUT -i " + intf + " -p tcp -m state --state NEW -m tcp --dport " + "443" + " -j HTTP;" +
|
||||
"iptables -F HTTP;" +
|
||||
"iptables -X HTTP;" +
|
||||
"iptables -N HTTP;" +
|
||||
"iptables -I INPUT -i " + intf + " -p tcp -m state --state NEW -m tcp --dport " + port + " -j DROP;" +
|
||||
"iptables -I INPUT -i " + intf + " -p tcp -m state --state NEW -m tcp --dport " + "443" + " -j DROP;" +
|
||||
"iptables -I INPUT -i " + intf + " -p tcp -m state --state NEW -m tcp --dport " + port + " -j HTTP;" +
|
||||
"iptables -I INPUT -i " + intf + " -p tcp -m state --state NEW -m tcp --dport " + "443" + " -j HTTP;");
|
||||
|
||||
if (result != null && !result.equals("active")) {
|
||||
command = new Script("/bin/systemctl", s_logger);
|
||||
command.add("start");
|
||||
command.add("apache2");
|
||||
result = command.execute();
|
||||
if (result != null) {
|
||||
s_logger.warn("Error in opening up httpd port err=" + result );
|
||||
return false;
|
||||
}*/
|
||||
|
||||
command = new Script("/bin/bash", s_logger);
|
||||
command.add("-c");
|
||||
command.add("if [ -d /etc/apache2 ] ; then service apache2 start; else service httpd start; fi ");
|
||||
result = command.execute();
|
||||
if (result != null) {
|
||||
s_logger.warn("Error in starting httpd service err=" + result);
|
||||
s_logger.warn("Error in starting apache2 service err=" + result);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@
|
||||
},
|
||||
{
|
||||
"name": "ping.timeout",
|
||||
"value": "1.5"
|
||||
"value": "2.0"
|
||||
}
|
||||
],
|
||||
"mgtSvr": [
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@ -5,9 +5,9 @@
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
131
systemvm/agent/conf/log4j-cloud.xml
Normal file
@ -0,0 +1,131 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
|
||||
|
||||
<!-- ================================= -->
|
||||
<!-- Preserve messages in a local file -->
|
||||
<!-- ================================= -->
|
||||
|
||||
<appender name="cloudLog" class="org.apache.log4j.RollingFileAppender">
|
||||
<param name="File" value="/var/log/cloud.log"/>
|
||||
<param name="MaxFileSize" value="10000KB"/>
|
||||
<param name="MaxBackupIndex" value="4"/>
|
||||
|
||||
<layout class="org.apache.log4j.EnhancedPatternLayout">
|
||||
<param name="ConversionPattern" value="%d{ISO8601}{GMT} %-5p [%c{3}] (%t:%x) %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<appender name="cloudOut" class="org.apache.log4j.RollingFileAppender">
|
||||
<param name="File" value="/var/log/cloud/cloud.out"/>
|
||||
<param name="Append" value="true"/>
|
||||
<param name="MaxFileSize" value="10000KB"/>
|
||||
<param name="MaxBackupIndex" value="4"/>
|
||||
|
||||
<layout class="org.apache.log4j.EnhancedPatternLayout">
|
||||
<param name="ConversionPattern" value="%d{ISO8601}{GMT} %-5p [%c{3}] (%t:%x) %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<appender name="cloudSystemvmLog" class="org.apache.log4j.rolling.RollingFileAppender">
|
||||
<param name="File" value="/usr/local/cloud/systemvm/cloud.log"/>
|
||||
<param name="Append" value="true"/>
|
||||
<param name="MaxFileSize" value="10000KB"/>
|
||||
<param name="MaxBackupIndex" value="4"/>
|
||||
|
||||
<layout class="org.apache.log4j.EnhancedPatternLayout">
|
||||
<param name="ConversionPattern" value="%d{ISO8601}{GMT} %-5p [%c{3}] (%t:%x) %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<appender name="APISERVER" class="org.apache.log4j.rolling.RollingFileAppender">
|
||||
<param name="Append" value="true"/>
|
||||
<param name="Threshold" value="DEBUG"/>
|
||||
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
|
||||
<param name="FileNamePattern" value="/var/log/cloud/api-server.log.%d{yyyy-MM-dd}{GMT}.gz"/>
|
||||
<param name="ActiveFileName" value="/var/log/cloud/api-server.log"/>
|
||||
</rollingPolicy>
|
||||
|
||||
<layout class="org.apache.log4j.EnhancedPatternLayout">
|
||||
<param name="ConversionPattern" value="%d{ISO8601}{GMT} %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- ============================== -->
|
||||
<!-- Append messages to the console -->
|
||||
<!-- ============================== -->
|
||||
|
||||
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
|
||||
<param name="Target" value="System.out"/>
|
||||
<param name="Threshold" value="INFO"/>
|
||||
|
||||
<layout class="org.apache.log4j.EnhancedPatternLayout">
|
||||
<param name="ConversionPattern" value="%d{ABSOLUTE}{GMT} %5p %c{1}:%L - %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- ================ -->
|
||||
<!-- Limit categories -->
|
||||
<!-- ================ -->
|
||||
|
||||
<category name="com.cloud">
|
||||
<priority value="DEBUG"/>
|
||||
</category>
|
||||
|
||||
<category name="org.apache.cloudstack">
|
||||
<priority value="DEBUG"/>
|
||||
</category>
|
||||
|
||||
<!-- Limit the org.apache category to INFO as its DEBUG is verbose -->
|
||||
<category name="org.apache">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
|
||||
<category name="org">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
|
||||
<category name="net">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
|
||||
<category name="apiserver.com.cloud">
|
||||
<priority value="DEBUG"/>
|
||||
</category>
|
||||
|
||||
<logger name="apiserver.com.cloud" additivity="false">
|
||||
<level value="DEBUG"/>
|
||||
<appender-ref ref="APISERVER"/>
|
||||
</logger>
|
||||
|
||||
<!-- ======================= -->
|
||||
<!-- Setup the Root category -->
|
||||
<!-- ======================= -->
|
||||
|
||||
<root>
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="cloudLog"/>
|
||||
<appender-ref ref="cloudOut"/>
|
||||
<appender-ref ref="cloudSystemvmLog"/>
|
||||
</root>
|
||||
|
||||
</log4j:configuration>
|
||||
@ -6,9 +6,9 @@ regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@ -21,7 +21,7 @@ body {
|
||||
margin:0 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
#main_panel {
|
||||
clear:both;
|
||||
margin: 0 auto;
|
||||
@ -33,57 +33,57 @@ body {
|
||||
}
|
||||
|
||||
#toolbar {
|
||||
font:normal 12px 'Trebuchet MS','Arial';
|
||||
margin:0 auto;
|
||||
font:normal 12px 'Trebuchet MS','Arial';
|
||||
margin:0 auto;
|
||||
text-align: left;
|
||||
padding:0 0;
|
||||
padding:0 0;
|
||||
height:32px;
|
||||
background-image:url(/resource/images/back.gif);
|
||||
background-repeat:repeat-x;
|
||||
background-image:url(/resource/images/back.gif);
|
||||
background-repeat:repeat-x;
|
||||
}
|
||||
|
||||
#toolbar ul {
|
||||
margin:0 0;
|
||||
padding:0 10px 0 10px;
|
||||
#toolbar ul {
|
||||
margin:0 0;
|
||||
padding:0 10px 0 10px;
|
||||
float:left;
|
||||
display:block;
|
||||
line-height:32px;
|
||||
list-style:none;
|
||||
list-style:none;
|
||||
}
|
||||
|
||||
#toolbar li {
|
||||
float:left;
|
||||
display:inline;
|
||||
float:left;
|
||||
display:inline;
|
||||
padding:0;
|
||||
height:32px;
|
||||
}
|
||||
|
||||
#toolbar a {
|
||||
color:white;
|
||||
#toolbar a {
|
||||
color:white;
|
||||
float:left;
|
||||
display:block;
|
||||
padding:0 3px 0 3px;
|
||||
padding:0 3px 0 3px;
|
||||
text-decoration:none;
|
||||
line-height:32px;
|
||||
}
|
||||
|
||||
#toolbar a span {
|
||||
display:block;
|
||||
float:none;
|
||||
padding:0 10px 0 7px;
|
||||
}
|
||||
#toolbar a span {
|
||||
display:block;
|
||||
float:none;
|
||||
padding:0 10px 0 7px;
|
||||
}
|
||||
|
||||
#toolbar a span img {
|
||||
border:none;
|
||||
margin:8px 4px 0 0;
|
||||
}
|
||||
#toolbar a span img {
|
||||
border:none;
|
||||
margin:8px 4px 0 0;
|
||||
}
|
||||
|
||||
#toolbar a:hover {
|
||||
background: url(/resource/images/left.png) no-repeat left center;
|
||||
}
|
||||
#toolbar a:hover {
|
||||
background: url(/resource/images/left.png) no-repeat left center;
|
||||
}
|
||||
|
||||
#toolbar a:hover span {
|
||||
background:url(/resource/images/right.png) no-repeat right center;
|
||||
#toolbar a:hover span {
|
||||
background:url(/resource/images/right.png) no-repeat right center;
|
||||
}
|
||||
|
||||
|
||||
@ -106,23 +106,23 @@ body {
|
||||
}
|
||||
|
||||
#toolbar ul li ul li.current {
|
||||
background: url(/resource/images/cad.gif) no-repeat left center;
|
||||
background: url(/resource/images/cad.gif) no-repeat left center;
|
||||
}
|
||||
|
||||
#toolbar ul li ul li a {
|
||||
display:block;
|
||||
padding:0 3px 0 3px;
|
||||
padding:0 3px 0 3px;
|
||||
text-decoration:none;
|
||||
line-height:32px;
|
||||
vertical-align: bottom; /* this is to fix the list gap in IE */
|
||||
}
|
||||
|
||||
#toolbar ul li ul li a:hover {
|
||||
background: url(/resource/images/left.png) no-repeat left center;
|
||||
background: url(/resource/images/left.png) no-repeat left center;
|
||||
}
|
||||
|
||||
#toolbar ul li ul li a:hover span {
|
||||
background: url(/resource/images/right2.png) no-repeat right center;
|
||||
background: url(/resource/images/right2.png) no-repeat right center;
|
||||
}
|
||||
|
||||
span.dark {
|
||||
@ -131,7 +131,7 @@ span.dark {
|
||||
display:block;
|
||||
width:32px;
|
||||
height:30px;
|
||||
background:url(/resource/images/gray-green.png) no-repeat center center;
|
||||
background:url(/resource/images/gray-green.png) no-repeat center center;
|
||||
}
|
||||
|
||||
span.bright {
|
||||
@ -140,5 +140,5 @@ span.bright {
|
||||
display:block;
|
||||
width:32px;
|
||||
height:30px;
|
||||
background:url(/resource/images/bright-green.png) no-repeat center center;
|
||||
background:url(/resource/images/bright-green.png) no-repeat center center;
|
||||
}
|
||||
@ -6,9 +6,9 @@ regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@ -45,14 +45,14 @@ under the License.
|
||||
|
||||
|
||||
.logwin_title_actionbox .select {
|
||||
background: #424242;
|
||||
font: normal 10px Arial, Helvetica, sans-serif;
|
||||
float:left;
|
||||
border: 1px solid #6e6e6e;
|
||||
height: 16px;
|
||||
width: 100px;
|
||||
margin-left:3px;
|
||||
padding:0 0 0 3px;
|
||||
background: #424242;
|
||||
font: normal 10px Arial, Helvetica, sans-serif;
|
||||
float:left;
|
||||
border: 1px solid #6e6e6e;
|
||||
height: 16px;
|
||||
width: 100px;
|
||||
margin-left:3px;
|
||||
padding:0 0 0 3px;
|
||||
color:#CCC;
|
||||
}
|
||||
|
||||
@ -136,4 +136,3 @@ a:hover.logwin_minimizebutton {
|
||||
height: 477px;
|
||||
background: white;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 149 B After Width: | Height: | Size: 149 B |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 918 B After Width: | Height: | Size: 918 B |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 437 B After Width: | Height: | Size: 437 B |
|
Before Width: | Height: | Size: 326 B After Width: | Height: | Size: 326 B |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 196 B |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 634 B After Width: | Height: | Size: 634 B |
|
Before Width: | Height: | Size: 227 B After Width: | Height: | Size: 227 B |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 657 B After Width: | Height: | Size: 657 B |
|
Before Width: | Height: | Size: 243 B After Width: | Height: | Size: 243 B |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 655 B After Width: | Height: | Size: 655 B |
|
Before Width: | Height: | Size: 243 B After Width: | Height: | Size: 243 B |
|
Before Width: | Height: | Size: 649 B After Width: | Height: | Size: 649 B |
|
Before Width: | Height: | Size: 231 B After Width: | Height: | Size: 231 B |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
@ -6,9 +6,9 @@ regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@ -28,14 +28,14 @@ under the License.
|
||||
|
||||
function Logger() {
|
||||
this.bDockEnabled = true;
|
||||
|
||||
|
||||
this.logWin = null;
|
||||
this.logger = null;
|
||||
this.header = null;
|
||||
|
||||
|
||||
this.bEnabled = true;
|
||||
this.level = 0;
|
||||
|
||||
|
||||
this.bMoving = false;
|
||||
this.offsetStart = {left: 0, top: 0};
|
||||
this.ptStart = {x: 0, y: 0};
|
||||
@ -51,24 +51,24 @@ Logger.LEVEL_FATAL = 5;
|
||||
Logger.LEVEL_SYS = 100;
|
||||
|
||||
Logger.prototype = {
|
||||
|
||||
|
||||
open: function() {
|
||||
if(this.logWin) {
|
||||
this.logWin.show();
|
||||
|
||||
|
||||
this.log(Logger.LEVEL_SYS, "Logger is open in browser: " + this.objectToString($.browser));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var logger = this;
|
||||
var logWinMarkup = [
|
||||
var logWinMarkup = [
|
||||
'<div class="logwin">',
|
||||
'<div class="logwin_title">',
|
||||
'<div class="logwin_title_actionbox">',
|
||||
'<a class="logwin_playbutton" href="#" cmd="1"></a>',
|
||||
'<a class="logwin_stopbutton" href="#" cmd="2"></a>',
|
||||
'<a class="logwin_clrbutton" href="#" cmd="3"></a>',
|
||||
'<form action="#">',
|
||||
'<a class="logwin_playbutton" href="#" cmd="1"></a>',
|
||||
'<a class="logwin_stopbutton" href="#" cmd="2"></a>',
|
||||
'<a class="logwin_clrbutton" href="#" cmd="3"></a>',
|
||||
'<form action="#">',
|
||||
'<select class="select" id="template_type">',
|
||||
'<option value="0">TRACE</option>',
|
||||
'<option value="1">DEBUG</option>',
|
||||
@ -76,18 +76,18 @@ Logger.prototype = {
|
||||
'<option value="3">WARN</option>',
|
||||
'<option value="4">ERROR</option>',
|
||||
'<option value="5">FATAL</option>',
|
||||
'</select>',
|
||||
'</form>',
|
||||
'</select>',
|
||||
'</form>',
|
||||
'</div>',
|
||||
'<div class="logwin_title_rgtactionbox">',
|
||||
'<a class="logwin_minimizebutton" href="#" cmd="4"></a>',
|
||||
'<a class="logwin_minimizebutton" href="#" cmd="4"></a>',
|
||||
'<a class="logwin_shrinkbutton" href="#" cmd="5"></a>',
|
||||
'</div>',
|
||||
'</div>',
|
||||
'<div class="logwin_content"></div>',
|
||||
'</div>'
|
||||
].join('');
|
||||
|
||||
|
||||
this.logWin = $(logWinMarkup).appendTo(document.body);
|
||||
this.header = $('.logwin_title:first', this.logWin);
|
||||
this.logger = $('.logwin_content:first', this.logWin);
|
||||
@ -95,22 +95,22 @@ Logger.prototype = {
|
||||
$(".logwin_title", this.logWin).mousedown(function(e) {
|
||||
if($(e.target).attr('cmd'))
|
||||
return true;
|
||||
|
||||
|
||||
if(!logger.bMoving) {
|
||||
logger.bMoving = true;
|
||||
logger.offsetStart = logger.logWin.offset();
|
||||
logger.ptStart = {x: e.pageX, y: e.pageY};
|
||||
|
||||
|
||||
$(document).bind("mousemove", function(e) {
|
||||
if(logger.bMoving) {
|
||||
logger.enableDocking(false);
|
||||
|
||||
|
||||
var logWinNewLeft = logger.offsetStart.left + e.pageX - logger.ptStart.x;
|
||||
var logWinNewTop = logger.offsetStart.top + e.pageY - logger.ptStart.y;
|
||||
|
||||
|
||||
logger.logWin.css("left", logWinNewLeft + "px").css("top", logWinNewTop + "px");
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
});
|
||||
|
||||
$(document).bind("mouseup", function(e) {
|
||||
@ -118,98 +118,98 @@ Logger.prototype = {
|
||||
logger.bMoving = false;
|
||||
$(document).unbind("mousemove", arguments.callee.name);
|
||||
$(document).unbind("mouseup", arguments.callee.name);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// prevent default handling
|
||||
return false;
|
||||
}).dblclick(function(e) {
|
||||
logger.expand(!logger.isExpanded());
|
||||
});
|
||||
|
||||
|
||||
this.logWin.click(function(e) {
|
||||
if($(e.target).attr('cmd')) {
|
||||
switch($(e.target).attr('cmd')) {
|
||||
case '1' :
|
||||
logger.enable(true);
|
||||
break;
|
||||
|
||||
|
||||
case '2' :
|
||||
logger.enable(false);
|
||||
break;
|
||||
|
||||
|
||||
case '3' :
|
||||
logger.clear();
|
||||
break;
|
||||
|
||||
|
||||
case '4' :
|
||||
logger.enableDocking(true);
|
||||
logger.dockIn();
|
||||
break;
|
||||
|
||||
|
||||
case '5' :
|
||||
logger.expand(!logger.isExpanded());
|
||||
break;
|
||||
|
||||
|
||||
default :
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#template_type", this.logWin).change(function(e) {
|
||||
logger.setLevel(parseInt($(this).val()));
|
||||
});
|
||||
|
||||
|
||||
this.logWin.css("left", (($(document.body).width() - this.logWin.width()) / 2) + "px");
|
||||
this.dockIn();
|
||||
|
||||
|
||||
this.log(Logger.LEVEL_SYS, "Logger is open in browser: " + this.objectToString($.browser));
|
||||
},
|
||||
|
||||
|
||||
close: function() {
|
||||
if(this.logWin)
|
||||
this.logWin.hide();
|
||||
},
|
||||
|
||||
|
||||
isOpen: function() {
|
||||
if(this.logWin)
|
||||
return this.logWin.is(":visible");
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
dockIn: function() {
|
||||
var logger = this;
|
||||
var offset = this.logWin.offset();
|
||||
var bottom = offset.top + this.logWin.height();
|
||||
var delta = bottom - 2;
|
||||
|
||||
this.logWin.animate({top: (offset.top - delta) + "px"}, 200,
|
||||
|
||||
this.logWin.animate({top: (offset.top - delta) + "px"}, 200,
|
||||
function() {
|
||||
logger.logWin.unbind("mouseleave");
|
||||
logger.logWin.bind("mouseenter", function(e) {
|
||||
if(logger.bDockEnabled)
|
||||
logger.dockOut();
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
dockOut: function() {
|
||||
var logger = this;
|
||||
this.logWin.animate({top: "0px"}, 200,
|
||||
this.logWin.animate({top: "0px"}, 200,
|
||||
function() {
|
||||
logger.logWin.unbind("mouseenter");
|
||||
logger.logWin.bind("mouseleave", function(e) {
|
||||
if(logger.bDockEnabled) {
|
||||
var xPosInLogWin = e.pageX - logger.logWin.offset().left;
|
||||
var yPosInLogWin = e.pageY - logger.logWin.offset().top;
|
||||
|
||||
if(xPosInLogWin < 0 || yPosInLogWin < 0 ||
|
||||
|
||||
if(xPosInLogWin < 0 || yPosInLogWin < 0 ||
|
||||
xPosInLogWin > logger.logWin.width() || yPosInLogWin > logger.logWin.height()) {
|
||||
logger.dockIn();
|
||||
}
|
||||
@ -218,11 +218,11 @@ Logger.prototype = {
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
enableDocking: function(bEnable) {
|
||||
this.bDockEnabled = bEnable;
|
||||
},
|
||||
|
||||
|
||||
log: function(level, message) {
|
||||
// Note : LEVEL_SYS message will always be logged
|
||||
if(this.logger && (level == Logger.LEVEL_SYS || this.bEnabled && level >= this.level)) {
|
||||
@ -236,33 +236,33 @@ Logger.prototype = {
|
||||
':', curTime.getMinutes(),
|
||||
":", curTime.getSeconds(),
|
||||
".", curTime.getMilliseconds()].join('');
|
||||
|
||||
|
||||
this.logger.append(this.getLevelDisplayString(level) + " - " + curTimeString + " - " + message + '<br>');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
clear: function() {
|
||||
if(this.logger) {
|
||||
this.logger.empty();
|
||||
this.log(Logger.LEVEL_SYS, "Logger is cleared");
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
setLevel: function(level) {
|
||||
this.level = level;
|
||||
|
||||
|
||||
this.log(Logger.LEVEL_SYS, "Set logger trace level to " + this.getLevelDisplayString(level));
|
||||
},
|
||||
|
||||
|
||||
enable: function(bEnabled) {
|
||||
this.bEnabled = bEnabled;
|
||||
|
||||
|
||||
if(bEnabled)
|
||||
this.log(Logger.LEVEL_SYS, "Logger is enabled");
|
||||
else
|
||||
this.log(Logger.LEVEL_SYS, "Logger is disabled");
|
||||
},
|
||||
|
||||
|
||||
expand: function(bExpand) {
|
||||
if(bExpand) {
|
||||
this.logWin.height(Logger.DEFAULT_WIN_HEIGHT);
|
||||
@ -272,59 +272,59 @@ Logger.prototype = {
|
||||
this.logger.height(0);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
isExpanded: function() {
|
||||
return this.logWin.height() > this.header.height();
|
||||
},
|
||||
|
||||
|
||||
getLevelDisplayString: function(level) {
|
||||
switch(level) {
|
||||
case Logger.LEVEL_TRACE :
|
||||
return "TRACE";
|
||||
|
||||
|
||||
case Logger.LEVEL_DEBUG :
|
||||
return "DEBUG";
|
||||
|
||||
|
||||
case Logger.LEVEL_INFO :
|
||||
return "INFO";
|
||||
|
||||
|
||||
case Logger.LEVEL_WARN :
|
||||
return "WARN";
|
||||
|
||||
|
||||
case Logger.LEVEL_ERROR :
|
||||
return "ERROR";
|
||||
|
||||
|
||||
case Logger.LEVEL_FATAL :
|
||||
return "FATAL";
|
||||
|
||||
|
||||
case Logger.LEVEL_SYS :
|
||||
return "SYSINFO";
|
||||
}
|
||||
|
||||
|
||||
return "LEVEL " + level;
|
||||
},
|
||||
|
||||
|
||||
// this is a util function which actually can be put elsewhere instead of in this class
|
||||
objectToString : function(object) {
|
||||
if(object) {
|
||||
if(object instanceof Object) {
|
||||
var sb = ['{' ];
|
||||
|
||||
|
||||
$.each(object, function(name, val) {
|
||||
sb.push('' + name + ': ');
|
||||
|
||||
|
||||
if(val instanceof Object) {
|
||||
sb.push(this.objectToString(val));
|
||||
} else {
|
||||
sb.push('' + val);
|
||||
}
|
||||
|
||||
|
||||
sb.push(',');
|
||||
});
|
||||
|
||||
|
||||
if(sb[sb.length - 1] == ',' )
|
||||
sb.length = sb.length - 1;
|
||||
|
||||
|
||||
sb.push('}');
|
||||
return sb.join("");
|
||||
} else {
|
||||
@ -335,4 +335,3 @@ Logger.prototype = {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -6,9 +6,9 @@ regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@ -17,7 +17,7 @@ Options:
|
||||
trigger: "dblclick" // or "click" for single click
|
||||
amount: 1.5 // 2 = 200% (zoom in), 0.5 = 50% (zoom out)
|
||||
}
|
||||
|
||||
|
||||
pan: {
|
||||
interactive: false
|
||||
cursor: "move" // CSS mouse cursor value used when dragging, e.g. "pointer"
|
||||
@ -28,7 +28,7 @@ Options:
|
||||
zoomRange: null // or [number, number] (min range, max range) or false
|
||||
panRange: null // or [number, number] (min, max) or false
|
||||
}
|
||||
|
||||
|
||||
"interactive" enables the built-in drag/click behaviour. If you enable
|
||||
interactive for pan, then you'll have a basic plot that supports
|
||||
moving around; the same for zoom.
|
||||
@ -58,16 +58,16 @@ panRange to false, panning on that axis will be disabled.
|
||||
Example API usage:
|
||||
|
||||
plot = $.plot(...);
|
||||
|
||||
// zoom default amount in on the pixel (10, 20)
|
||||
|
||||
// zoom default amount in on the pixel (10, 20)
|
||||
plot.zoom({ center: { left: 10, top: 20 } });
|
||||
|
||||
// zoom out again
|
||||
plot.zoomOut({ center: { left: 10, top: 20 } });
|
||||
|
||||
// zoom 200% in on the pixel (10, 20)
|
||||
// zoom 200% in on the pixel (10, 20)
|
||||
plot.zoom({ amount: 2, center: { left: 10, top: 20 } });
|
||||
|
||||
|
||||
// pan 100 pixels to the left and 20 down
|
||||
plot.pan({ left: -100, top: 20 })
|
||||
|
||||
@ -79,7 +79,7 @@ you convert between these).
|
||||
"amount" is the amount to zoom the viewport relative to the current
|
||||
range, so 1 is 100% (i.e. no change), 1.5 is 150% (zoom in), 0.7 is
|
||||
70% (zoom out). You can set the default in the options.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@ range, so 1 is 100% (i.e. no change), 1.5 is 150% (zoom in), 0.7 is
|
||||
// effort of downloading them.
|
||||
|
||||
/*
|
||||
jquery.event.drag.js ~ v1.5 ~ Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)
|
||||
jquery.event.drag.js ~ v1.5 ~ Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)
|
||||
Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-LICENSE.txt
|
||||
*/
|
||||
(function(E){E.fn.drag=function(L,K,J){if(K){this.bind("dragstart",L)}if(J){this.bind("dragend",J)}return !L?this.trigger("drag"):this.bind("drag",K?K:L)};var A=E.event,B=A.special,F=B.drag={not:":input",distance:0,which:1,dragging:false,setup:function(J){J=E.extend({distance:F.distance,which:F.which,not:F.not},J||{});J.distance=I(J.distance);A.add(this,"mousedown",H,J);if(this.attachEvent){this.attachEvent("ondragstart",D)}},teardown:function(){A.remove(this,"mousedown",H);if(this===F.dragging){F.dragging=F.proxy=false}G(this,true);if(this.detachEvent){this.detachEvent("ondragstart",D)}}};B.dragstart=B.dragend={setup:function(){},teardown:function(){}};function H(L){var K=this,J,M=L.data||{};if(M.elem){K=L.dragTarget=M.elem;L.dragProxy=F.proxy||K;L.cursorOffsetX=M.pageX-M.left;L.cursorOffsetY=M.pageY-M.top;L.offsetX=L.pageX-L.cursorOffsetX;L.offsetY=L.pageY-L.cursorOffsetY}else{if(F.dragging||(M.which>0&&L.which!=M.which)||E(L.target).is(M.not)){return }}switch(L.type){case"mousedown":E.extend(M,E(K).offset(),{elem:K,target:L.target,pageX:L.pageX,pageY:L.pageY});A.add(document,"mousemove mouseup",H,M);G(K,false);F.dragging=null;return false;case !F.dragging&&"mousemove":if(I(L.pageX-M.pageX)+I(L.pageY-M.pageY)<M.distance){break}L.target=M.target;J=C(L,"dragstart",K);if(J!==false){F.dragging=K;F.proxy=L.dragProxy=E(J||K)[0]}case"mousemove":if(F.dragging){J=C(L,"drag",K);if(B.drop){B.drop.allowed=(J!==false);B.drop.handler(L)}if(J!==false){break}L.type="mouseup"}case"mouseup":A.remove(document,"mousemove mouseup",H);if(F.dragging){if(B.drop){B.drop.handler(L)}C(L,"dragend",K)}G(K,true);F.dragging=F.proxy=M.elem=false;break}return true}function C(M,K,L){M.type=K;var J=E.event.handle.call(L,M);return J===false?false:J||M.result}function I(J){return Math.pow(J,2)}function D(){return(F.dragging===false)}function G(K,J){if(!K){return }K.unselectable=J?"off":"on";K.onselectstart=function(){return J};if(K.style){K.style.MozUserSelect=J?"":"none"}}})(jQuery);
|
||||
@ -102,7 +102,7 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
|
||||
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
|
||||
*
|
||||
* Version: 3.0.2
|
||||
*
|
||||
*
|
||||
* Requires: 1.2.2+
|
||||
*/
|
||||
(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery);
|
||||
@ -143,7 +143,7 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
|
||||
onZoomClick(e, delta < 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
var prevCursor = 'default', prevPageX = 0, prevPageY = 0,
|
||||
panTimeout = null;
|
||||
|
||||
@ -157,7 +157,7 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
|
||||
prevPageX = e.pageX;
|
||||
prevPageY = e.pageY;
|
||||
}
|
||||
|
||||
|
||||
function onDrag(e) {
|
||||
var frameRate = plot.getOptions().pan.frameRate;
|
||||
if (panTimeout || !frameRate)
|
||||
@ -168,7 +168,7 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
|
||||
top: prevPageY - e.pageY });
|
||||
prevPageX = e.pageX;
|
||||
prevPageY = e.pageY;
|
||||
|
||||
|
||||
panTimeout = null;
|
||||
}, 1 / frameRate * 1000);
|
||||
}
|
||||
@ -178,12 +178,12 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
|
||||
clearTimeout(panTimeout);
|
||||
panTimeout = null;
|
||||
}
|
||||
|
||||
|
||||
plot.getPlaceholder().css('cursor', prevCursor);
|
||||
plot.pan({ left: prevPageX - e.pageX,
|
||||
top: prevPageY - e.pageY });
|
||||
}
|
||||
|
||||
|
||||
function bindEvents(plot, eventHolder) {
|
||||
var o = plot.getOptions();
|
||||
if (o.zoom.interactive) {
|
||||
@ -201,25 +201,25 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
|
||||
plot.zoomOut = function (args) {
|
||||
if (!args)
|
||||
args = {};
|
||||
|
||||
|
||||
if (!args.amount)
|
||||
args.amount = plot.getOptions().zoom.amount
|
||||
|
||||
args.amount = 1 / args.amount;
|
||||
plot.zoom(args);
|
||||
}
|
||||
|
||||
|
||||
plot.zoom = function (args) {
|
||||
if (!args)
|
||||
args = {};
|
||||
|
||||
|
||||
var c = args.center,
|
||||
amount = args.amount || plot.getOptions().zoom.amount,
|
||||
w = plot.width(), h = plot.height();
|
||||
|
||||
if (!c)
|
||||
c = { left: w / 2, top: h / 2 };
|
||||
|
||||
|
||||
var xf = c.left / w,
|
||||
yf = c.top / h,
|
||||
minmax = {
|
||||
@ -241,7 +241,7 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
|
||||
|
||||
if (zr === false) // no zooming on this axis
|
||||
return;
|
||||
|
||||
|
||||
min = axis.c2p(min);
|
||||
max = axis.c2p(max);
|
||||
if (min > max) {
|
||||
@ -256,14 +256,14 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
|
||||
((zr[0] != null && range < zr[0]) ||
|
||||
(zr[1] != null && range > zr[1])))
|
||||
return;
|
||||
|
||||
|
||||
opts.min = min;
|
||||
opts.max = max;
|
||||
});
|
||||
|
||||
|
||||
plot.setupGrid();
|
||||
plot.draw();
|
||||
|
||||
|
||||
if (!args.preventEvent)
|
||||
plot.getPlaceholder().trigger("plotzoom", [ plot ]);
|
||||
}
|
||||
@ -289,7 +289,7 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
|
||||
var pr = opts.panRange;
|
||||
if (pr === false) // no panning on this axis
|
||||
return;
|
||||
|
||||
|
||||
if (pr) {
|
||||
// check whether we hit the wall
|
||||
if (pr[0] != null && pr[0] > min) {
|
||||
@ -297,21 +297,21 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
|
||||
min += d;
|
||||
max += d;
|
||||
}
|
||||
|
||||
|
||||
if (pr[1] != null && pr[1] < max) {
|
||||
d = pr[1] - max;
|
||||
min += d;
|
||||
max += d;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
opts.min = min;
|
||||
opts.max = max;
|
||||
});
|
||||
|
||||
|
||||
plot.setupGrid();
|
||||
plot.draw();
|
||||
|
||||
|
||||
if (!args.preventEvent)
|
||||
plot.getPlaceholder().trigger("plotpan", [ plot ]);
|
||||
}
|
||||
@ -325,11 +325,11 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
|
||||
if (panTimeout)
|
||||
clearTimeout(panTimeout);
|
||||
}
|
||||
|
||||
|
||||
plot.hooks.bindEvents.push(bindEvents);
|
||||
plot.hooks.shutdown.push(shutdown);
|
||||
}
|
||||
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
options: options,
|
||||
@ -6,9 +6,9 @@
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@ -16,24 +16,16 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# run.sh runs the cloud service
|
||||
#set -x
|
||||
|
||||
# make sure we delete the old files from the original template
|
||||
rm -f console-proxy.jar
|
||||
rm -f console-common.jar
|
||||
rm -f conf/cloud.properties
|
||||
|
||||
|
||||
CP="./:./conf:$(ls *.jar | tr '\n' ':' | sed s'/.$//')"
|
||||
|
||||
#run.sh runs the console proxy.
|
||||
|
||||
# make sure we delete the old files from the original template
|
||||
rm console-proxy.jar
|
||||
rm console-common.jar
|
||||
rm conf/cloud.properties
|
||||
|
||||
set -x
|
||||
|
||||
CP=./:./conf
|
||||
for file in *.jar
|
||||
do
|
||||
CP=${CP}:$file
|
||||
done
|
||||
keyvalues=
|
||||
LOGHOME=/var/log/cloud/
|
||||
|
||||
@ -50,7 +42,7 @@ for i in $CMDLINE
|
||||
keyvalues="${keyvalues} $KEY=$VALUE"
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
tot_mem_k=$(cat /proc/meminfo | grep MemTotal | awk '{print $2}')
|
||||
let "tot_mem_m=tot_mem_k>>10"
|
||||
let "eightypcnt=$tot_mem_m*8/10"
|
||||
@ -6,9 +6,9 @@
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BASE_DIR="/var/www/html/copy/template/"
|
||||
@ -43,7 +43,7 @@ config_htaccess() {
|
||||
let "result=$result+$?"
|
||||
echo "Require valid-user" >> $HTACCESS
|
||||
let "result=$result+$?"
|
||||
return $result
|
||||
return $result
|
||||
}
|
||||
|
||||
write_passwd() {
|
||||
@ -65,5 +65,5 @@ then
|
||||
exit 2
|
||||
fi
|
||||
|
||||
config_htaccess
|
||||
config_htaccess
|
||||
exit $?
|
||||
143
systemvm/agent/scripts/config_ssl.sh
Executable file
@ -0,0 +1,143 @@
|
||||
#!/usr/bin/env bash
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
help() {
|
||||
printf " -c use customized key/cert\n"
|
||||
printf " -k path of private key\n"
|
||||
printf " -p path of certificate of public key\n"
|
||||
printf " -t path of certificate chain\n"
|
||||
printf " -u path of root ca certificate \n"
|
||||
}
|
||||
|
||||
|
||||
config_apache2_conf() {
|
||||
local ip=$1
|
||||
local srvr=$2
|
||||
sed -i 's/ssl-cert-snakeoil.key/cert_apache.key/' /etc/apache2/sites-enabled/vhost*
|
||||
sed -i 's/ssl-cert-snakeoil.pem/cert_apache.crt/' /etc/apache2/sites-enabled/vhost*
|
||||
if [ -f /etc/ssl/certs/cert_apache_chain.crt ]
|
||||
then
|
||||
sed -i -e "s/#SSLCertificateChainFile.*/SSLCertificateChainFile \/etc\/ssl\/certs\/cert_apache_chain.crt/" /etc/apache2/sites-enabled/vhost*
|
||||
fi
|
||||
}
|
||||
|
||||
copy_certs_apache2() {
|
||||
local certdir=$(dirname $0)/certs
|
||||
local mydir=$(dirname $0)
|
||||
if [ -f $customPrivKey ] && [ -f $customPrivCert ] ; then
|
||||
cp $customPrivKey /etc/ssl/private/cert_apache.key && cp $customPrivCert /etc/ssl/certs/cert_apache.crt
|
||||
fi
|
||||
if [ ! -z "$customCertChain" ] && [ -f "$customCertChain" ] ; then
|
||||
cp $customCertChain /etc/ssl/certs/cert_apache_chain.crt
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
cflag=
|
||||
cpkflag=
|
||||
cpcflag=
|
||||
cccflag=
|
||||
customPrivKey=$(dirname $0)/certs/realhostip.key
|
||||
customPrivCert=$(dirname $0)/certs/realhostip.crt
|
||||
customCertChain=
|
||||
customCACert=
|
||||
publicIp=
|
||||
hostName=
|
||||
keyStore=$(dirname $0)/certs/realhostip.keystore
|
||||
defaultJavaKeyStoreFile=/etc/ssl/certs/java/cacerts
|
||||
defaultJavaKeyStorePass="changeit"
|
||||
aliasName="CPVMCertificate"
|
||||
storepass="vmops.com"
|
||||
while getopts 'i:h:k:p:t:u:c' OPTION
|
||||
do
|
||||
case $OPTION in
|
||||
c) cflag=1
|
||||
;;
|
||||
k) cpkflag=1
|
||||
customPrivKey="$OPTARG"
|
||||
;;
|
||||
p) cpcflag=1
|
||||
customPrivCert="$OPTARG"
|
||||
;;
|
||||
t) cccflag=1
|
||||
customCertChain="$OPTARG"
|
||||
;;
|
||||
u) ccacflag=1
|
||||
customCACert="$OPTARG"
|
||||
;;
|
||||
i) publicIp="$OPTARG"
|
||||
;;
|
||||
h) hostName="$OPTARG"
|
||||
;;
|
||||
?) help
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
if [ -z "$publicIp" ] || [ -z "$hostName" ]
|
||||
then
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$cflag" == "1" ]
|
||||
then
|
||||
if [ "$cpkflag$cpcflag" != "11" ]
|
||||
then
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f "$customPrivKey" ]
|
||||
then
|
||||
printf "private key file does not exist\n"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ ! -f "$customPrivCert" ]
|
||||
then
|
||||
printf "public certificate does not exist\n"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
if [ "$cccflag" == "1" ]
|
||||
then
|
||||
if [ ! -f "$customCertChain" ]
|
||||
then
|
||||
printf "certificate chain does not exist\n"
|
||||
exit 4
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
copy_certs_apache2
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "Failed to copy certificates"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ -f "$customCACert" ]
|
||||
then
|
||||
keytool -delete -alias $aliasName -keystore $keyStore -storepass $storepass -noprompt || true
|
||||
keytool -import -alias $aliasName -keystore $keyStore -storepass $storepass -noprompt -file $customCACert
|
||||
keytool -importkeystore -srckeystore $defaultJavaKeyStoreFile -destkeystore $keyStore -srcstorepass $defaultJavaKeyStorePass -deststorepass $storepass -noprompt
|
||||
fi
|
||||
|
||||
config_apache2_conf $publicIp $hostName
|
||||
systemctl restart apache2
|
||||
@ -6,9 +6,9 @@
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@ -6,9 +6,9 @@
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@ -47,4 +47,3 @@ do
|
||||
ips "$i"
|
||||
done
|
||||
exit $?
|
||||
|
||||
@ -6,9 +6,9 @@
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@ -18,11 +18,11 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#run.sh runs the console proxy.
|
||||
|
||||
# make sure we delete the old files from the original template
|
||||
# make sure we delete the old files from the original template
|
||||
rm console-proxy.jar
|
||||
rm console-common.jar
|
||||
rm conf/cloud.properties
|
||||
@ -44,5 +44,5 @@ done
|
||||
# ;;
|
||||
# esac
|
||||
# done
|
||||
|
||||
|
||||
java -mx700m -cp $CP:./conf com.cloud.consoleproxy.ConsoleProxy $@
|
||||
@ -6,9 +6,9 @@
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@ -16,10 +16,6 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#_run.sh runs the agent client.
|
||||
|
||||
# set -x
|
||||
@ -6,9 +6,9 @@
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@ -6,16 +6,16 @@
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
|
||||
# Health check script for the Secondary Storage VM
|
||||
|
||||
@ -29,7 +29,7 @@ do
|
||||
value=`echo $i | cut -d= -f2`
|
||||
case $key in
|
||||
host)
|
||||
MGMTSERVER=$value
|
||||
MGMTSERVER=$value
|
||||
;;
|
||||
esac
|
||||
done
|
||||
@ -141,6 +141,6 @@ else
|
||||
fi
|
||||
|
||||
echo ================================================
|
||||
echo Tests Complete. Look for ERROR or WARNING above.
|
||||
echo Tests Complete. Look for ERROR or WARNING above.
|
||||
|
||||
exit 0
|
||||
@ -6,9 +6,9 @@ regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@ -6,9 +6,9 @@ regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@ -18,7 +18,6 @@ under the License.
|
||||
-->
|
||||
tileMap = [ ${tileSequence} ];
|
||||
<#if resized == true>
|
||||
ajaxViewer.resize('main_panel', ${width}, ${height}, ${tileWidth}, ${tileHeight});
|
||||
ajaxViewer.resize('main_panel', ${width}, ${height}, ${tileWidth}, ${tileHeight});
|
||||
</#if>
|
||||
ajaxViewer.refresh('${imgUrl}', tileMap, false);
|
||||
|
||||
@ -6,9 +6,9 @@ regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@ -28,26 +28,26 @@ under the License.
|
||||
<body>
|
||||
<div id="toolbar">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="#" onclick="javascript:sendCtrlAltDel();">
|
||||
<span><img align="left" src="/resource/images/cad.gif" alt="Ctrl-Alt-Del" />Ctrl-Alt-Del</span>
|
||||
</a>
|
||||
<li>
|
||||
<a href="#" onclick="javascript:sendCtrlAltDel();">
|
||||
<span><img align="left" src="/resource/images/cad.gif" alt="Ctrl-Alt-Del" />Ctrl-Alt-Del</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" onclick="javascript:sendCtrlEsc();">
|
||||
<span><img align="left" src="/resource/images/winlog.png" alt="Ctrl-Esc" style="width:16px;height:16px"/>Ctrl-Esc</span>
|
||||
</a>
|
||||
<li>
|
||||
<a href="#" onclick="javascript:sendCtrlEsc();">
|
||||
<span><img align="left" src="/resource/images/winlog.png" alt="Ctrl-Esc" style="width:16px;height:16px"/>Ctrl-Esc</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<span id="light" class="dark"></span>
|
||||
<span id="light" class="dark"></span>
|
||||
</div>
|
||||
|
||||
<div id="main_panel" tabindex="1"></div>
|
||||
|
||||
|
||||
<script language="javascript">
|
||||
|
||||
var tileMap = [ ${tileSequence} ];
|
||||
var ajaxViewer = new AjaxViewer('main_panel', '${imgUrl}', '${updateUrl}', tileMap,
|
||||
var ajaxViewer = new AjaxViewer('main_panel', '${imgUrl}', '${updateUrl}', tileMap,
|
||||
${width}, ${height}, ${tileWidth}, ${tileHeight}, ${rawKeyboard});
|
||||
|
||||
$(function() {
|
||||
@ -57,4 +57,4 @@ $(function() {
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
@ -1,220 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
import sys, os, subprocess, errno, re, getopt
|
||||
|
||||
# ---- This snippet of code adds the sources path and the waf configured PYTHONDIR to the Python path ----
|
||||
# ---- We do this so cloud_utils can be looked up in the following order:
|
||||
# ---- 1) Sources directory
|
||||
# ---- 2) waf configured PYTHONDIR
|
||||
# ---- 3) System Python path
|
||||
for pythonpath in (
|
||||
"@PYTHONDIR@",
|
||||
os.path.join(os.path.dirname(__file__),os.path.pardir,os.path.pardir,"python","lib"),
|
||||
):
|
||||
if os.path.isdir(pythonpath): sys.path.insert(0,pythonpath)
|
||||
# ---- End snippet of code ----
|
||||
import cloud_utils
|
||||
from cloud_utils import stderr
|
||||
|
||||
E_GENERIC= 1
|
||||
E_NOKVM = 2
|
||||
E_NODEFROUTE = 3
|
||||
E_DHCP = 4
|
||||
E_NOPERSISTENTNET = 5
|
||||
E_NETRECONFIGFAILED = 6
|
||||
E_VIRTRECONFIGFAILED = 7
|
||||
E_FWRECONFIGFAILED = 8
|
||||
E_CPRECONFIGFAILED = 9
|
||||
E_CPFAILEDTOSTART = 10
|
||||
E_NOFQDN = 11
|
||||
|
||||
def bail(errno=E_GENERIC,message=None,*args):
|
||||
if message: stderr(message,*args)
|
||||
stderr("Cloud Console Proxy setup aborted")
|
||||
sys.exit(errno)
|
||||
|
||||
|
||||
#---------------- boilerplate for python 2.4 support
|
||||
|
||||
|
||||
# CENTOS does not have this -- we have to put this here
|
||||
try:
|
||||
from subprocess import check_call
|
||||
from subprocess import CalledProcessError
|
||||
except ImportError:
|
||||
def check_call(*popenargs, **kwargs):
|
||||
import subprocess
|
||||
retcode = subprocess.call(*popenargs, **kwargs)
|
||||
cmd = kwargs.get("args")
|
||||
if cmd is None: cmd = popenargs[0]
|
||||
if retcode: raise CalledProcessError(retcode, cmd)
|
||||
return retcode
|
||||
|
||||
class CalledProcessError(Exception):
|
||||
def __init__(self, returncode, cmd):
|
||||
self.returncode = returncode ; self.cmd = cmd
|
||||
def __str__(self): return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode)
|
||||
|
||||
# ------------ end boilerplate -------------------------
|
||||
|
||||
def check_hostname(): return check_call(["hostname",'--fqdn'])
|
||||
|
||||
class Command:
|
||||
def __init__(self,name,parent=None):
|
||||
self.__name = name
|
||||
self.__parent = parent
|
||||
def __getattr__(self,name):
|
||||
if name == "_print": name = "print"
|
||||
return Command(name,self)
|
||||
def __call__(self,*args):
|
||||
cmd = self.__get_recursive_name() + list(args)
|
||||
#print " ",cmd
|
||||
popen = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
|
||||
m = popen.communicate()
|
||||
ret = popen.wait()
|
||||
if ret:
|
||||
e = CalledProcessError(ret,cmd)
|
||||
e.stdout,e.stderr = m
|
||||
raise e
|
||||
class CommandOutput:
|
||||
def __init__(self,stdout,stderr):
|
||||
self.stdout = stdout
|
||||
self.stderr = stderr
|
||||
return CommandOutput(*m)
|
||||
def __lt__(self,other):
|
||||
cmd = self.__get_recursive_name()
|
||||
#print " ",cmd,"<",other
|
||||
popen = subprocess.Popen(cmd,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
|
||||
m = popen.communicate(other)
|
||||
ret = popen.wait()
|
||||
if ret:
|
||||
e = CalledProcessError(ret,cmd)
|
||||
e.stdout,e.stderr = m
|
||||
raise e
|
||||
class CommandOutput:
|
||||
def __init__(self,stdout,stderr):
|
||||
self.stdout = stdout
|
||||
self.stderr = stderr
|
||||
return CommandOutput(*m)
|
||||
|
||||
def __get_recursive_name(self,sep=None):
|
||||
m = self
|
||||
l = []
|
||||
while m is not None:
|
||||
l.append(m.__name)
|
||||
m = m.__parent
|
||||
l.reverse()
|
||||
if sep: return sep.join(l)
|
||||
else: return l
|
||||
def __str__(self):
|
||||
return '<Command %r>'%self.__get_recursive_name(sep=" ")
|
||||
|
||||
def __repr__(self): return self.__str__()
|
||||
|
||||
ip = Command("ip")
|
||||
service = Command("service")
|
||||
chkconfig = Command("chkconfig")
|
||||
ufw = Command("ufw")
|
||||
iptables = Command("iptables")
|
||||
augtool = Command("augtool")
|
||||
ifconfig = Command("ifconfig")
|
||||
uuidgen = Command("uuidgen")
|
||||
|
||||
Fedora = os.path.exists("/etc/fedora-release")
|
||||
CentOS = os.path.exists("/etc/centos-release") or ( os.path.exists("/etc/redhat-release") and not os.path.exists("/etc/fedora-release") )
|
||||
|
||||
#--------------- procedure starts here ------------
|
||||
|
||||
def main():
|
||||
# parse cmd line
|
||||
opts, args = getopt.getopt(sys.argv[1:], "a", ["host=", "zone=", "pod="])
|
||||
host=None
|
||||
zone=None
|
||||
pod=None
|
||||
autoMode=False
|
||||
do_check_kvm = True
|
||||
for opt, arg in opts:
|
||||
if opt == "--host":
|
||||
if arg != "":
|
||||
host = arg
|
||||
elif opt == "--zone":
|
||||
if arg != "":
|
||||
zone = arg
|
||||
elif opt == "--pod":
|
||||
if arg != "":
|
||||
pod = arg
|
||||
elif opt == "-a":
|
||||
autoMode=True
|
||||
servicename = "@PACKAGE@-console-proxy"
|
||||
|
||||
if autoMode:
|
||||
cloud_utils.setLogFile("/var/log/cloud/setupConsoleProxy.log")
|
||||
|
||||
stderr("Welcome to the Cloud Console Proxy setup")
|
||||
stderr("")
|
||||
|
||||
try:
|
||||
check_hostname()
|
||||
stderr("The hostname of this machine is properly set up")
|
||||
except CalledProcessError,e:
|
||||
bail(E_NOFQDN,"This machine does not have an FQDN (fully-qualified domain name) for a hostname")
|
||||
|
||||
stderr("Stopping the Cloud Console Proxy")
|
||||
cloud_utils.stop_service(servicename)
|
||||
stderr("Cloud Console Proxy stopped")
|
||||
|
||||
ports = "8002".split()
|
||||
if Fedora or CentOS:
|
||||
try:
|
||||
o = chkconfig("--list","iptables")
|
||||
if ":on" in o.stdout and os.path.exists("/etc/sysconfig/iptables"):
|
||||
stderr("Setting up firewall rules to permit traffic to Cloud services")
|
||||
service.iptables.start() ; print o.stdout + o.stderr
|
||||
for p in ports: iptables("-I","INPUT","1","-p","tcp","--dport",p,'-j','ACCEPT')
|
||||
o = service.iptables.save() ; print o.stdout + o.stderr
|
||||
except CalledProcessError,e:
|
||||
print e.stdout+e.stderr
|
||||
bail(E_FWRECONFIGFAILED,"Firewall rules could not be set")
|
||||
else:
|
||||
stderr("Setting up firewall rules to permit traffic to Cloud services")
|
||||
try:
|
||||
for p in ports: ufw.allow(p)
|
||||
stderr("Rules set")
|
||||
except CalledProcessError,e:
|
||||
print e.stdout+e.stderr
|
||||
bail(E_FWRECONFIGFAILED,"Firewall rules could not be set")
|
||||
|
||||
stderr("We are going to enable ufw now. This may disrupt network connectivity and service availability. See the ufw documentation for information on how to manage ufw firewall policies.")
|
||||
try:
|
||||
o = ufw.enable < "y\n" ; print o.stdout + o.stderr
|
||||
except CalledProcessError,e:
|
||||
print e.stdout+e.stderr
|
||||
bail(E_FWRECONFIGFAILED,"Firewall could not be enabled")
|
||||
|
||||
cloud_utils.setup_consoleproxy_config("@CPSYSCONFDIR@/agent.properties", host, zone, pod)
|
||||
stderr("Enabling and starting the Cloud Console Proxy")
|
||||
cloud_utils.enable_service(servicename)
|
||||
stderr("Cloud Console Proxy restarted")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
# FIXMES: 1) nullify networkmanager on ubuntu (asking the user first) and enable the networking service permanently
|
||||
@ -1,46 +0,0 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# Sample configuration file for VMOPS console proxy
|
||||
|
||||
instance=ConsoleProxy
|
||||
consoleproxy.httpListenPort=8002
|
||||
|
||||
#resource= the java class, which agent load to execute
|
||||
resource=com.cloud.agent.resource.consoleproxy.ConsoleProxyResource
|
||||
|
||||
#host= The IP address of management server
|
||||
host=localhost
|
||||
|
||||
#port = The port management server listening on, default is 8250
|
||||
port=8250
|
||||
|
||||
#pod= The pod, which agent belonged to
|
||||
pod=default
|
||||
|
||||
#zone= The zone, which agent belonged to
|
||||
zone=default
|
||||
|
||||
#private.network.device= the private nic device
|
||||
# if this is commented, it is autodetected on service startup
|
||||
# private.network.device=cloudbr0
|
||||
|
||||
#public.network.device= the public nic device
|
||||
# if this is commented, it is autodetected on service startup
|
||||
# public.network.device=cloudbr0
|
||||
|
||||
#guid= a GUID to identify the agent
|
||||
@ -1,23 +0,0 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
consoleproxy.tcpListenPort=0
|
||||
consoleproxy.httpListenPort=80
|
||||
consoleproxy.httpCmdListenPort=8001
|
||||
consoleproxy.jarDir=./applet/
|
||||
consoleproxy.viewerLinger=180
|
||||
consoleproxy.reconnectMaxRetry=5
|
||||