Skip to content

Commit 2ef4d52

Browse files
committed
Merge branch 'master' into rbac.
2 parents 21dc2be + 27294a3 commit 2ef4d52

2,661 files changed

Lines changed: 46045 additions & 123459 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

INSTALL.md

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -96,25 +96,22 @@ Clean and build:
9696

9797
$ mvn clean install -P systemvm,developer
9898

99-
In case you want support for VMWare, SRX and other non-Apache (referred to as nonoss)
100-
compliant libs, you may download the following jar artifacts from respective vendors:
99+
CloudStack supports several plugins that depend on libraries with distribution restrictions.
100+
Because of this they are not included in the default build. Enable these additional plugins
101+
activate their respective profiles. For convenience adding -Dnoredist will enable all plugins
102+
that depend on libraries with distribution restrictions. The build procedure expects that the
103+
required libraries are present in the maven repository.
101104

102-
deps/cloud-iControl.jar
103-
deps/cloud-manageontap.jar
104-
deps/cloud-netscaler-sdx.jar
105-
deps/cloud-netscaler.jar
106-
deps/vmware-apputils.jar
107-
deps/vmware-vim.jar
108-
deps/vmware-vim25.jar
109-
110-
Install them to ~/.m2 so maven can get them as dependencies:
105+
The following procedure can be used to add the libraries to the local maven repository. Details
106+
on obtaining the required libraries can be found in this file. Note that this will vary between
107+
releases of cloudstack
111108

112109
$ cd deps
113110
$ ./install-non-oss.sh
114111

115-
To build with nonoss components, use the build command with the nonoss flag:
112+
To build all non redistributable components, add the noredist flag to the build command:
116113

117-
$ mvn clean install -P systemvm,developer -Dnonoss
114+
$ mvn clean install -P systemvm,developer -Dnoredist
118115

119116
Clear old database (if any) and deploy the database schema:
120117

@@ -153,7 +150,7 @@ This section describes packaging and installation.
153150

154151
To create debs:
155152

156-
$ mvn -P deps # -D nonoss, for nonoss as described in the "Building" section above
153+
$ mvn -P deps # -D noredist, for noredist as described in the "Building" section above
157154
$ dpkg-buildpackage
158155

159156
All the deb packages will be created in ../$PWD
@@ -183,15 +180,15 @@ Install needed packages, apt-get upgrade for upgrading:
183180

184181
To create rpms:
185182

186-
$ mvn -P deps # -D nonoss, for nonoss as described in the "Building" section above
187-
$ ./waf rpm
183+
$ cd packaging/centos63
184+
$ bash packaging.sh [ -p NOREDIST ]
188185

189-
All the rpm packages will be create in artifacts/rpmbuild/RPMS/x86_64
186+
All the rpm packages will be create in dist/rpmbuild/RPMS/x86_64
190187

191188
To create a yum repo: (assuming appropriate user privileges)
192189

193190
$ path=/path/to/your/webserver/cloudstack
194-
$ cd artifacts/rpmbuild/RPMS/x86_64
191+
$ cd dist/rpmbuild/RPMS/x86_64
195192
$ mv *.rpm $path
196193
$ createrepo $path
197194

@@ -208,10 +205,10 @@ Installation:
208205
Install needed packages:
209206

210207
$ yum update
211-
$ yum install cloud-client # management server
208+
$ yum install cloudstack-management # management server
212209
$ yum install mysql-server # mysql server
213-
$ yum install cloud-agent # agent (kvm)
214-
$ yum install cloud-usage # usage server
210+
$ yum install cloudstack-agent # agent (kvm)
211+
$ yum install cloudstack-usage # usage server
215212

216213
## Installing CloudMonkey CLI
217214

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/python
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
from cloudutils.networkConfig import networkConfig
19+
from cloudutils.utilities import bash
20+
import logging
21+
import re
22+
def isOldStyleBridge(brName):
23+
if brName.find("cloudVirBr") == 0:
24+
return True
25+
else:
26+
return False
27+
def upgradeBridgeName(brName, enslavedDev):
28+
print("upgrade bridge: %s, %s"%(brName, enslavedDev))
29+
vlanId = brName.replace("cloudVirBr", "")
30+
print("find vlan Id: %s"%vlanId)
31+
phyDev = enslavedDev.split(".")[0]
32+
print("find physical device %s"%phyDev)
33+
newBrName = "br" + phyDev + "-" + vlanId
34+
print("new bridge name %s"%newBrName)
35+
bash("ip link set %s down"%brName)
36+
bash("ip link set %s name %s"%(brName, newBrName))
37+
bash("ip link set %s up" %newBrName)
38+
cmd = "iptables-save | grep FORWARD | grep -w " + brName
39+
rules = bash(cmd).stdout.split('\n')
40+
rules.pop()
41+
for rule in rules:
42+
try:
43+
delrule = re.sub("-A", "-D", rule)
44+
newrule = re.sub(" " + brName + " ", " " + newBrName + " ", rule)
45+
bash("iptables " + delrule)
46+
bash("iptables " + newrule)
47+
except:
48+
logging.exception("Ignoring failure to update rules for rule " + rule + " on bridge " + brName)
49+
if __name__ == '__main__':
50+
netlib = networkConfig()
51+
bridges = netlib.listNetworks()
52+
bridges = filter(isOldStyleBridge, bridges)
53+
for br in bridges:
54+
enslavedDev = netlib.getEnslavedDev(br, 1)
55+
if enslavedDev is not None:
56+
upgradeBridgeName(br, enslavedDev)
57+
58+
bridges = netlib.listNetworks()
59+
bridges = filter(isOldStyleBridge, bridges)
60+
if len(bridges) > 0:
61+
print("Warning: upgrade is not finished, still some bridges have the old style name:" + str(bridges))
62+
else:
63+
print("Upgrade succeed")

agent/bindir/libvirtqemuhook.in

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/python
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
import sys
19+
from xml.dom.minidom import parse
20+
from cloudutils.configFileOps import configFileOps
21+
from cloudutils.networkConfig import networkConfig
22+
def isOldStyleBridge(brName):
23+
if brName.find("cloudVirBr") == 0:
24+
return True
25+
else:
26+
return False
27+
def getGuestNetworkDevice():
28+
netlib = networkConfig()
29+
cfo = configFileOps("/etc/cloudstack/agent/agent.properties")
30+
guestDev = cfo.getEntry("guest.network.device")
31+
enslavedDev = netlib.getEnslavedDev(guestDev, 1)
32+
return enslavedDev
33+
def handleMigrateBegin():
34+
try:
35+
domain = parse(sys.stdin)
36+
for interface in domain.getElementsByTagName("interface"):
37+
source = interface.getElementsByTagName("source")[0]
38+
bridge = source.getAttribute("bridge")
39+
if not isOldStyleBridge(bridge):
40+
continue
41+
vlanId = bridge.replace("cloudVirBr","")
42+
phyDev = getGuestNetworkDevice()
43+
newBrName="br" + phyDev + "-" + vlanId
44+
source.setAttribute("bridge", newBrName)
45+
print(domain.toxml())
46+
except:
47+
pass
48+
if __name__ == '__main__':
49+
if len(sys.argv) != 5:
50+
sys.exit(0)
51+
52+
if sys.argv[2] == "migrate" and sys.argv[3] == "begin":
53+
handleMigrateBegin()

agent/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
<artifactId>cloud-utils</artifactId>
3737
<version>${project.version}</version>
3838
</dependency>
39+
<dependency>
40+
<groupId>commons-io</groupId>
41+
<artifactId>commons-io</artifactId>
42+
</dependency>
3943
<dependency>
4044
<groupId>commons-daemon</groupId>
4145
<artifactId>commons-daemon</artifactId>

agent/scripts/_run.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

agent/scripts/agent.sh

Lines changed: 0 additions & 31 deletions
This file was deleted.

agent/scripts/run.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.

agent/src/com/cloud/agent/Agent.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import java.util.List;
2727
import java.util.Map;
2828
import java.util.Timer;
29-
import java.util.TimerTask;
3029
import java.util.concurrent.ExecutorService;
3130
import java.util.concurrent.LinkedBlockingQueue;
3231
import java.util.concurrent.SynchronousQueue;
@@ -36,6 +35,7 @@
3635

3736
import javax.naming.ConfigurationException;
3837

38+
import org.apache.cloudstack.managed.context.ManagedContextTimerTask;
3939
import org.apache.log4j.Logger;
4040

4141
import com.cloud.agent.api.AgentControlAnswer;
@@ -45,7 +45,6 @@
4545
import com.cloud.agent.api.CronCommand;
4646
import com.cloud.agent.api.MaintainAnswer;
4747
import com.cloud.agent.api.MaintainCommand;
48-
import com.cloud.agent.api.ModifySshKeysCommand;
4948
import com.cloud.agent.api.PingCommand;
5049
import com.cloud.agent.api.ReadyCommand;
5150
import com.cloud.agent.api.ShutdownCommand;
@@ -731,7 +730,7 @@ public void run() {
731730
}
732731
}
733732

734-
public class WatchTask extends TimerTask {
733+
public class WatchTask extends ManagedContextTimerTask {
735734
protected Request _request;
736735
protected Agent _agent;
737736
protected Link _link;
@@ -744,7 +743,7 @@ public WatchTask(final Link link, final Request request, final Agent agent) {
744743
}
745744

746745
@Override
747-
public void run() {
746+
protected void runInContext() {
748747
if (s_logger.isTraceEnabled()) {
749748
s_logger.trace("Scheduling " + (_request instanceof Response ? "Ping" : "Watch Task"));
750749
}
@@ -760,7 +759,7 @@ public void run() {
760759
}
761760
}
762761

763-
public class StartupTask extends TimerTask {
762+
public class StartupTask extends ManagedContextTimerTask {
764763
protected Link _link;
765764
protected volatile boolean cancelled = false;
766765

@@ -782,7 +781,7 @@ public synchronized boolean cancel() {
782781
}
783782

784783
@Override
785-
public synchronized void run() {
784+
protected synchronized void runInContext() {
786785
if (!cancelled) {
787786
if (s_logger.isInfoEnabled()) {
788787
s_logger.info("The startup command is now cancelled");

0 commit comments

Comments
 (0)