Skip to content

Commit 5f6387e

Browse files
committed
add clouddev
1 parent 3938c24 commit 5f6387e

19 files changed

Lines changed: 3322 additions & 45 deletions

File tree

build.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<import file="${base.dir}/build/build-marvin.xml" optional="true"/>
2828
<import file="${base.dir}/build/package.xml" optional="true"/>
2929
<import file="${base.dir}/build/developer.xml" optional="true"/>
30+
<import file="${base.dir}/build/build-clouddev.xml" optional="true"/>
3031
<import file="${base.dir}/build/build-usage.xml" optional="false"/>
3132
<import file="${base.dir}/build/build-aws-api.xml" optional="false"/>
3233
</project>

build/build-clouddev.xml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one or more
4+
contributor license agreements. See the NOTICE file distributed with
5+
this work for additional information regarding copyright ownership.
6+
The ASF licenses this file to You under the Apache License, Version 2.0
7+
(the "License"); you may not use this file except in compliance with
8+
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, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
-->
18+
19+
20+
<project name="CloudDev Targets" basedir=".">
21+
22+
23+
<condition property="port" value="${rport}" else="2222">
24+
<isset property="rport"/>
25+
</condition>
26+
27+
<condition property="host" value="${rhost}" else="localhost">
28+
<isset property="rhost"/>
29+
</condition>
30+
31+
<target name="deploydbIfSet" if="deploydb.is.set">
32+
<echo message="ant deploydb"/>
33+
<sshexec host="${host}" port="${port}" username="root" password="password" command="echo $CATALINA_HOME; export CATALINA_HOME=/opt/apache-tomcat-6.0.32;killall java;cd /opt/incubator-cloudstack;ant deploycddb"/>
34+
</target>
35+
36+
<target name="rdeploydb">
37+
<echo message="ant rdeploydb"/>
38+
<sshexec host="${host}" port="${port}" username="root" password="password" command="echo $CATALINA_HOME; export CATALINA_HOME=/opt/apache-tomcat-6.0.32;killall java;cd /opt/incubator-cloudstack;ant deploycddb"/>
39+
</target>
40+
41+
<target name="deploycddb" description="deploy specific db configuration for clouddev" depends="deploydb">
42+
<exec dir="${db.scripts.dir}" executable="bash">
43+
<arg value="deploy-db-clouddev.sh" />
44+
</exec>
45+
</target>
46+
47+
<target name="rdebug-suspend" >
48+
<echo message="ant debug-suspend"/>
49+
<sshexec host="${host}" port="${port}" username="root" password="password" command="killall java;sleep 1;echo $CATALINA_HOME; export CATALINA_HOME=/opt/apache-tomcat-6.0.32;cd /opt/incubator-cloudstack;ant deploy-server;ant debug-suspend"/>
50+
</target>
51+
52+
<target name="rdebug">
53+
<echo message="ant debug"/>
54+
<sshexec host="${host}" port="${port}" username="root" password="password" command="killall java;sleep 1;echo $CATALINA_HOME; export CATALINA_HOME=/opt/apache-tomcat-6.0.32;cd /opt/incubator-cloudstack;ant deploy-server; ant debug"/>
55+
</target>
56+
57+
58+
<target name="rdeploy" description="deploy to remote">
59+
<condition property="zip.uptodate">
60+
<available file="${deploy.work.dir}/client.zip" type="file"/>
61+
</condition>
62+
63+
64+
65+
<echo message="copying build folder to remote"/>
66+
<scp trust="yes" port="${port}" todir="root:password@${host}:/opt/incubator-cloudstack/build">
67+
<fileset dir="build">
68+
</fileset>
69+
</scp>
70+
71+
<echo message="copying deps folder to remote"/>
72+
<scp trust="yes" port="${port}" todir="root:password@${host}:/opt/incubator-cloudstack/deps">
73+
<fileset dir="deps">
74+
</fileset>
75+
</scp>
76+
77+
<echo message="copying target folder to remote"/>
78+
<scp trust="yes" port="${port}" todir="root:password@${host}:/opt/incubator-cloudstack/target">
79+
<fileset dir="target">
80+
</fileset>
81+
</scp>
82+
83+
<echo message="copying dist folder to remote"/>
84+
<scp trust="yes" port="${port}" todir="root:password@${host}:/opt/incubator-cloudstack/dist">
85+
<fileset dir="dist">
86+
</fileset>
87+
</scp>
88+
89+
<sshexec host="${host}" port="${port}" username="root" password="password" command="echo $CATALINA_HOME; export CATALINA_HOME=/opt/apache-tomcat-6.0.32;cd /opt/incubator-cloudstack;ant deploy-server"/>
90+
91+
</target>
92+
93+
</project>

plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java

Lines changed: 53 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import com.cloud.hypervisor.Hypervisor;
6060
import com.cloud.hypervisor.Hypervisor.HypervisorType;
6161
import com.cloud.hypervisor.xen.resource.CitrixResourceBase;
62+
import com.cloud.hypervisor.xen.resource.XcpOssResource;
6263
import com.cloud.hypervisor.xen.resource.XcpServerResource;
6364
import com.cloud.hypervisor.xen.resource.XenServer56FP1Resource;
6465
import com.cloud.hypervisor.xen.resource.XenServer56Resource;
@@ -253,8 +254,15 @@ public Map<? extends ServerResource, Map<String, String>> find(long dcId, Long p
253254
String hostAddr = record.address;
254255

255256
String prodVersion = record.softwareVersion.get("product_version");
257+
if (prodVersion == null) {
258+
prodVersion = record.softwareVersion.get("platform_version");
259+
}
256260
String xenVersion = record.softwareVersion.get("xen");
257261
String hostOS = record.softwareVersion.get("product_brand");
262+
if (hostOS == null) {
263+
hostOS = record.softwareVersion.get("platform_name");
264+
}
265+
258266
String hostOSVer = prodVersion;
259267
String hostKernelVer = record.softwareVersion.get("linux");
260268

@@ -400,34 +408,49 @@ protected boolean addHostsToPool(Connection conn, String hostIp, Long clusterId)
400408
}
401409

402410
protected CitrixResourceBase createServerResource(long dcId, Long podId, Host.Record record) {
403-
String prodBrand = record.softwareVersion.get("product_brand").trim();
404-
String prodVersion = record.softwareVersion.get("product_version").trim();
405-
406-
if(prodBrand.equals("XCP") && (prodVersion.equals("1.0.0") || prodVersion.equals("1.1.0") || prodVersion.equals("5.6.100") || prodVersion.startsWith("1.4") ))
407-
return new XcpServerResource();
411+
String prodBrand = record.softwareVersion.get("product_brand");
412+
if (prodBrand == null) {
413+
prodBrand = record.softwareVersion.get("platform_name").trim();
414+
} else {
415+
prodBrand = prodBrand.trim();
416+
}
417+
String prodVersion = record.softwareVersion.get("product_version");
418+
if (prodVersion == null) {
419+
prodVersion = record.softwareVersion.get("platform_version").trim();
420+
} else {
421+
prodVersion = prodVersion.trim();
422+
}
408423

409-
if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.0"))
410-
return new XenServer56Resource();
411-
412-
if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.0"))
413-
return new XenServer600Resource();
414-
415-
if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.2"))
416-
return new XenServer602Resource();
424+
if(prodBrand.equals("XCP") && (prodVersion.equals("1.0.0") || prodVersion.equals("1.1.0") || prodVersion.equals("5.6.100") || prodVersion.startsWith("1.4") ))
425+
return new XcpServerResource();
426+
427+
if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.0"))
428+
return new XenServer56Resource();
429+
430+
if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.0"))
431+
return new XenServer600Resource();
432+
433+
if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.2"))
434+
return new XenServer602Resource();
435+
436+
if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.100")) {
437+
String prodVersionTextShort = record.softwareVersion.get("product_version_text_short").trim();
438+
if("5.6 SP2".equals(prodVersionTextShort)) {
439+
return new XenServer56SP2Resource();
440+
} else if("5.6 FP1".equals(prodVersionTextShort)) {
441+
return new XenServer56FP1Resource();
442+
}
443+
}
444+
445+
if (prodBrand.equals("XCP_Kronos")) {
446+
return new XcpOssResource();
447+
}
448+
449+
String msg = "Only support XCP 1.0.0, 1.1.0, 1.5 beta; XenServer 5.6, XenServer 5.6 FP1, XenServer 5.6 SP2, Xenserver 6.0, 6.0.2 but this one is " + prodBrand + " " + prodVersion;
450+
_alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, dcId, podId, msg, msg);
451+
s_logger.debug(msg);
452+
throw new RuntimeException(msg);
417453

418-
if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.100")) {
419-
String prodVersionTextShort = record.softwareVersion.get("product_version_text_short").trim();
420-
if("5.6 SP2".equals(prodVersionTextShort)) {
421-
return new XenServer56SP2Resource();
422-
} else if("5.6 FP1".equals(prodVersionTextShort)) {
423-
return new XenServer56FP1Resource();
424-
}
425-
}
426-
427-
String msg = "Only support XCP 1.0.0, 1.1.0, 1.5 beta; XenServer 5.6, XenServer 5.6 FP1, XenServer 5.6 SP2, Xenserver 6.0, 6.0.2 but this one is " + prodBrand + " " + prodVersion;
428-
_alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, dcId, podId, msg, msg);
429-
s_logger.debug(msg);
430-
throw new RuntimeException(msg);
431454
}
432455

433456
protected void serverConfig() {
@@ -457,8 +480,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
457480
Boolean.parseBoolean(value);
458481

459482
value = _params.get("xen.check.hvm");
460-
_checkHvm = value == null ? true : Boolean.parseBoolean(value);
461-
483+
_checkHvm = false;
462484
_connPool = XenServerConnectionPool.getInstance();
463485

464486
_agentMgr.registerForHostEvents(this, true, false, true);
@@ -567,7 +589,10 @@ public void processConnect(HostVO agent, StartupCommand cmd, boolean forRebalanc
567589
} else if("5.6 FP1".equals(prodVersionTextShort)) {
568590
resource = XenServer56FP1Resource.class.getName();
569591
}
592+
} else if (prodBrand.equals("XCP_Kronos")) {
593+
resource = XcpOssResource.class.getName();
570594
}
595+
571596
if( resource == null ){
572597
String msg = "Only support XCP 1.0.0, 1.1.0, 1.5 beta; XenServer 5.6, 5.6 FP1, 5.6 SP2 and Xenserver 6.0 , 6.0.2 but this one is " + prodBrand + " " + prodVersion;
573598
s_logger.debug(msg);

plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
286286
protected List<VIF> _tmpDom0Vif = new ArrayList<VIF>();
287287

288288
public enum SRType {
289-
NFS, LVM, ISCSI, ISO, LVMOISCSI, LVMOHBA, EXT;
289+
NFS, LVM, ISCSI, ISO, LVMOISCSI, LVMOHBA, EXT, FILE;
290290

291291
String _str;
292292

@@ -1066,7 +1066,7 @@ protected String handleVmStartFailure(Connection conn, String vmName, VM vm, Str
10661066
}
10671067

10681068
protected VBD createPatchVbd(Connection conn, String vmName, VM vm) throws XmlRpcException, XenAPIException {
1069-
1069+
10701070
if( _host.systemvmisouuid == null ) {
10711071
Set<SR> srs = SR.getByNameLabel(conn, "XenServer Tools");
10721072
if( srs.size() != 1 ) {
@@ -1100,8 +1100,8 @@ protected VBD createPatchVbd(Connection conn, String vmName, VM vm) throws XmlRp
11001100
cdromVBDR.type = Types.VbdType.CD;
11011101
VBD cdromVBD = VBD.create(conn, cdromVBDR);
11021102
cdromVBD.insert(conn, VDI.getByUuid(conn, _host.systemvmisouuid));
1103-
1104-
return cdromVBD;
1103+
1104+
return cdromVBD;
11051105
}
11061106

11071107
protected void destroyPatchVbd(Connection conn, String vmName) throws XmlRpcException, XenAPIException {
@@ -3870,7 +3870,7 @@ protected SR getLocalEXTSR(Connection conn) {
38703870
Map<SR, SR.Record> map = SR.getAllRecords(conn);
38713871
for (Map.Entry<SR, SR.Record> entry : map.entrySet()) {
38723872
SR.Record srRec = entry.getValue();
3873-
if (SRType.EXT.equals(srRec.type)) {
3873+
if (SRType.FILE.equals(srRec.type) || SRType.EXT.equals(srRec.type)) {
38743874
Set<PBD> pbds = srRec.PBDs;
38753875
if (pbds == null) {
38763876
continue;
@@ -3902,6 +3902,8 @@ protected StartupStorageCommand initializeLocalSR(Connection conn) {
39023902
SR lvmsr = getLocalLVMSR(conn);
39033903
if (lvmsr != null) {
39043904
try {
3905+
_host.localSRuuid = lvmsr.getUuid(conn);
3906+
39053907
String lvmuuid = lvmsr.getUuid(conn);
39063908
long cap = lvmsr.getPhysicalSize(conn);
39073909
if (cap > 0) {
@@ -3932,6 +3934,7 @@ protected StartupStorageCommand initializeLocalSR(Connection conn) {
39323934
if (extsr != null) {
39333935
try {
39343936
String extuuid = extsr.getUuid(conn);
3937+
_host.localSRuuid = extuuid;
39353938
long cap = extsr.getPhysicalSize(conn);
39363939
if (cap > 0) {
39373940
long avail = cap - extsr.getPhysicalUtilisation(conn);
@@ -3956,6 +3959,7 @@ protected StartupStorageCommand initializeLocalSR(Connection conn) {
39563959
s_logger.warn(msg);
39573960
}
39583961
}
3962+
39593963
return null;
39603964
}
39613965

@@ -4033,7 +4037,13 @@ protected boolean getHostInfo(Connection conn) throws IllegalArgumentException{
40334037
break;
40344038
}
40354039
Host.Record hr = myself.getRecord(conn);
4036-
_host.product_version = hr.softwareVersion.get("product_version").trim();
4040+
4041+
_host.product_version = hr.softwareVersion.get("product_version");
4042+
if (_host.product_version == null) {
4043+
_host.product_version = hr.softwareVersion.get("platform_version");
4044+
} else {
4045+
_host.product_version = _host.product_version.trim();
4046+
}
40374047

40384048
XsLocalNetwork privateNic = getManagementNetwork(conn);
40394049
_privateNetworkName = privateNic.getNetworkRecord(conn).nameLabel;
@@ -4493,8 +4503,10 @@ protected boolean setupServer(Connection conn) {
44934503
} finally {
44944504
sshConnection.close();
44954505
}
4506+
44964507
hr.tags.add("vmops-version-" + version);
44974508
host.setTags(conn, hr.tags);
4509+
44984510
return true;
44994511
} catch (XenAPIException e) {
45004512
String msg = "Xen setup failed due to " + e.toString();
@@ -5106,13 +5118,19 @@ protected void fillHostInfo(Connection conn, StartupRoutingCommand cmd) {
51065118
if (details == null) {
51075119
details = new HashMap<String, String>();
51085120
}
5109-
details.put("product_brand", hr.softwareVersion.get("product_brand"));
5110-
details.put("product_version", hr.softwareVersion.get("product_version"));
5121+
5122+
String productBrand = hr.softwareVersion.get("product_brand");
5123+
if (productBrand == null) {
5124+
productBrand = hr.softwareVersion.get("platform_name");
5125+
}
5126+
details.put("product_brand", productBrand);
5127+
details.put("product_version", _host.product_version);
5128+
51115129
if( hr.softwareVersion.get("product_version_text_short") != null ) {
51125130
details.put("product_version_text_short", hr.softwareVersion.get("product_version_text_short"));
51135131
cmd.setHypervisorVersion(hr.softwareVersion.get("product_version_text_short"));
51145132
}else{
5115-
cmd.setHypervisorVersion(hr.softwareVersion.get("product_version"));
5133+
cmd.setHypervisorVersion(_host.product_version);
51165134
}
51175135
if (_privateNetworkName != null) {
51185136
details.put("private.network.device", _privateNetworkName);
@@ -5165,9 +5183,9 @@ protected void fillHostInfo(Connection conn, StartupRoutingCommand cmd) {
51655183
cmd.setPrivateMacAddress(pifr.MAC);
51665184
cmd.setPrivateNetmask(pifr.netmask);
51675185
} else {
5168-
String msg = "Private network " + _privateNetworkName + " doesn't have IP address, please check the host network configuration";
5169-
s_logger.error(msg);
5170-
throw new CloudRuntimeException(msg);
5186+
cmd.setPrivateIpAddress(_host.ip);
5187+
cmd.setPrivateMacAddress(pifr.MAC);
5188+
cmd.setPrivateNetmask("255.255.255.0");
51715189
}
51725190

51735191
pif = PIF.getByUuid(conn, _host.storagePif1);
@@ -5330,7 +5348,6 @@ public CreateAnswer execute(CreateCommand cmd) {
53305348
vdir.virtualSize = dskch.getSize();
53315349
vdi = VDI.create(conn, vdir);
53325350
}
5333-
53345351
VDI.Record vdir;
53355352
vdir = vdi.getRecord(conn);
53365353
s_logger.debug("Succesfully created VDI for " + cmd + ". Uuid = " + vdir.uuid);
@@ -6764,6 +6781,7 @@ protected class XsHost {
67646781
public int speed;
67656782
public int cpus;
67666783
public String product_version;
6784+
public String localSRuuid;
67676785

67686786
@Override
67696787
public String toString() {

0 commit comments

Comments
 (0)