Skip to content

Commit 3aef9f4

Browse files
committed
step1
1 parent 211b4c5 commit 3aef9f4

12 files changed

Lines changed: 52 additions & 23 deletions

File tree

‎core/src/com/cloud/dc/ClusterVO.java‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ public class ClusterVO implements Cluster {
4545
@Column(name="pod_id")
4646
long podId;
4747

48+
@Column(name="hypervisor_type")
49+
String hypervisorType;
50+
51+
4852
public ClusterVO() {
4953
}
5054

@@ -70,6 +74,14 @@ public long getPodId() {
7074
return podId;
7175
}
7276

77+
public String getHypervisorType() {
78+
return hypervisorType;
79+
}
80+
81+
public void setHypervisorType(String hy) {
82+
hypervisorType = hy;
83+
}
84+
7385
public ClusterVO(long clusterId) {
7486
this.id = clusterId;
7587
}

‎server/src/com/cloud/agent/manager/allocator/impl/UserConcentratedAllocator.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,14 @@ private long calcHostAllocatedCpuMemoryCapacity(long hostId, short capacityType)
244244
so = _offeringDao.findById(userVm.getServiceOfferingId());
245245
} else if(vm.getType() == VirtualMachine.Type.ConsoleProxy) {
246246
so = new ServiceOfferingVO("Fake Offering For DomP", 1,
247-
_proxyRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null);
247+
_proxyRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null);
248248
} else if(vm.getType() == VirtualMachine.Type.SecondaryStorageVm) {
249-
so = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null);
249+
so = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null);
250250
} else if(vm.getType() == VirtualMachine.Type.DomainRouter) {
251-
so = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null);
251+
so = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null);
252252
} else {
253253
assert(false) : "Unsupported system vm type";
254-
so = new ServiceOfferingVO("Fake Offering For unknow system VM", 1, 128, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null);
254+
so = new ServiceOfferingVO("Fake Offering For unknow system VM", 1, 128, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null);
255255
}
256256

257257
if(capacityType == CapacityVO.CAPACITY_TYPE_MEMORY) {

‎server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2303,7 +2303,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
23032303
_networkRate = ((networkRateStr == null) ? 200 : Integer.parseInt(networkRateStr));
23042304
_multicastRate = ((multicastRateStr == null) ? 10 : Integer.parseInt(multicastRateStr));
23052305
_serviceOffering = new ServiceOfferingVO("Fake Offering For DomP", 1, _proxyRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized,
2306-
useLocalStorage, true, null);
2306+
useLocalStorage, true, null, null);
23072307
_serviceOffering.setUniqueName("Cloud.com-ConsoleProxy");
23082308
_serviceOffering = _offeringDao.persistSystemServiceOffering(_serviceOffering);
23092309
_template = _templateDao.findConsoleProxyTemplate();

‎server/src/com/cloud/hypervisor/kvm/discoverer/KvmServerDiscoverer.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,14 @@
2121
import com.cloud.agent.api.Command;
2222
import com.cloud.agent.api.StartupCommand;
2323
import com.cloud.configuration.dao.ConfigurationDao;
24+
import com.cloud.dc.ClusterVO;
25+
import com.cloud.dc.dao.ClusterDao;
2426
import com.cloud.exception.DiscoveryException;
2527
import com.cloud.host.HostVO;
2628
import com.cloud.host.Status;
2729
import com.cloud.host.Status.Event;
2830
import com.cloud.host.dao.HostDao;
31+
import com.cloud.hypervisor.Hypervisor;
2932
import com.cloud.hypervisor.kvm.resource.KvmDummyResourceBase;
3033
import com.cloud.hypervisor.xen.resource.CitrixResourceBase;
3134
import com.cloud.resource.Discoverer;
@@ -47,6 +50,7 @@ public class KvmServerDiscoverer extends DiscovererBase implements Discoverer,
4750
private String _hostIp;
4851
private int _waitTime = 3; /*wait for 3 minutes*/
4952
@Inject HostDao _hostDao = null;
53+
@Inject ClusterDao _clusterDao;
5054

5155
@Override
5256
public boolean processAnswer(long agentId, long seq, Answer[] answers) {
@@ -224,6 +228,11 @@ public Map<? extends ServerResource, Map<String, String>> find(long dcId,
224228
kvmResource.configure("kvm agent", params);
225229
kvmResource.setRemoteAgent(true);
226230
resources.put(kvmResource, details);
231+
232+
/*set cluster hypervisor type to xenserver*/
233+
ClusterVO clu = _clusterDao.findById(clusterId);
234+
clu.setHypervisorType(Hypervisor.Type.KVM.toString());
235+
_clusterDao.update(clusterId, clu);
227236
return resources;
228237
} catch (Exception e) {
229238
String msg = " can't setup agent, due to " + e.toString() + " - " + e.getMessage();

‎server/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import com.cloud.host.HostVO;
5151
import com.cloud.host.Status;
5252
import com.cloud.host.dao.HostDao;
53+
import com.cloud.hypervisor.Hypervisor;
5354
import com.cloud.hypervisor.xen.resource.CitrixResourceBase;
5455
import com.cloud.hypervisor.xen.resource.XcpServerResource;
5556
import com.cloud.hypervisor.xen.resource.XenServerResource;
@@ -245,6 +246,12 @@ public Map<? extends ServerResource, Map<String, String>> find(long dcId, Long p
245246
if (!addHostsToPool(url, conn, dcId, podId, clusterId, resources)) {
246247
return null;
247248
}
249+
250+
/*set cluster hypervisor type to xenserver*/
251+
ClusterVO clu = _clusterDao.findById(clusterId);
252+
clu.setHypervisorType(Hypervisor.Type.XenServer.toString());
253+
_clusterDao.update(clusterId, clu);
254+
248255
} catch (SessionAuthenticationFailed e) {
249256
s_logger.warn("Authentication error", e);
250257
return null;

‎server/src/com/cloud/network/NetworkManagerImpl.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1873,7 +1873,7 @@ public boolean configure(final String name, final Map<String, Object> params) th
18731873
String multicastRateStr = _configDao.getValue("multicast.throttling.rate");
18741874
_networkRate = ((networkRateStr == null) ? 200 : Integer.parseInt(networkRateStr));
18751875
_multicastRate = ((multicastRateStr == null) ? 10 : Integer.parseInt(multicastRateStr));
1876-
_offering = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, useLocalStorage, true, null);
1876+
_offering = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, useLocalStorage, true, null, null);
18771877
_offering.setUniqueName("Cloud.Com-SoftwareRouter");
18781878
_offering = _serviceOfferingDao.persistSystemServiceOffering(_offering);
18791879
_template = _templateDao.findRoutingTemplate();

‎server/src/com/cloud/server/ConfigurationServerImpl.java‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ public void persistDefaultValues() throws InvalidParameterValueException, Intern
119119
_configDao.update("hypervisor.type", "xenserver");
120120
s_logger.debug("ConfigurationServer changed the hypervisor type to \"xenserver\".");
121121

122-
_configDao.update("secondary.storage.vm", "true");
123-
s_logger.debug("ConfigurationServer made secondary storage vm required.");
122+
//_configDao.update("secondary.storage.vm", "true");
123+
//s_logger.debug("ConfigurationServer made secondary storage vm required.");
124124

125-
_configDao.update("secstorage.encrypt.copy", "true");
126-
s_logger.debug("ConfigurationServer made secondary storage copy encrypted.");
125+
//_configDao.update("secstorage.encrypt.copy", "true");
126+
//s_logger.debug("ConfigurationServer made secondary storage copy encrypted.");
127127

128-
_configDao.update("secstorage.secure.copy.cert", "realhostip");
129-
s_logger.debug("ConfigurationServer made secondary storage copy use realhostip.");
128+
//_configDao.update("secstorage.secure.copy.cert", "realhostip");
129+
//s_logger.debug("ConfigurationServer made secondary storage copy use realhostip.");
130130
}
131131

132132
boolean externalIpAlloator = Boolean.parseBoolean(_configDao.getValue("direct.attach.network.externalIpAllocator.enabled"));

‎server/src/com/cloud/server/ManagementServerImpl.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4433,7 +4433,7 @@ public void updateConfiguration(long userId, String name, String value) throws I
44334433

44344434
@Override
44354435
public ServiceOfferingVO createServiceOffering(long userId, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA, boolean useVirtualNetwork, String tags) {
4436-
return _configMgr.createServiceOffering(userId, name, cpu, ramSize, speed, displayText, localStorageRequired, offerHA, useVirtualNetwork, tags);
4436+
return _configMgr.createServiceOffering(userId, name, cpu, ramSize, speed, displayText, localStorageRequired, offerHA, useVirtualNetwork, tags, null);
44374437
}
44384438

44394439
@Override

‎server/src/com/cloud/storage/allocator/LocalStoragePoolAllocator.java‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,14 @@ private boolean hostHasCpuMemoryCapacity(long hostId, List<Long> vmOnHost, VMIns
146146
so = _offeringDao.findById(userVm.getServiceOfferingId());
147147
} else if(vm.getType() == VirtualMachine.Type.ConsoleProxy) {
148148
so = new ServiceOfferingVO("Fake Offering For DomP", 1,
149-
_proxyRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null);
149+
_proxyRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null);
150150
} else if(vm.getType() == VirtualMachine.Type.SecondaryStorageVm) {
151-
so = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null);
151+
so = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null);
152152
} else if(vm.getType() == VirtualMachine.Type.DomainRouter) {
153-
so = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null);
153+
so = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null);
154154
} else {
155155
assert(false) : "Unsupported system vm type";
156-
so = new ServiceOfferingVO("Fake Offering For unknow system VM", 1, 128, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null);
156+
so = new ServiceOfferingVO("Fake Offering For unknow system VM", 1, 128, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null);
157157
}
158158

159159
long usedMemory = calcHostAllocatedCpuMemoryCapacity(vmOnHost, CapacityVO.CAPACITY_TYPE_MEMORY);
@@ -243,14 +243,14 @@ private long calcHostAllocatedCpuMemoryCapacity(List<Long> vmOnHost, short capac
243243
so = _offeringDao.findById(userVm.getServiceOfferingId());
244244
} else if(vm.getType() == VirtualMachine.Type.ConsoleProxy) {
245245
so = new ServiceOfferingVO("Fake Offering For DomP", 1,
246-
_proxyRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null);
246+
_proxyRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null);
247247
} else if(vm.getType() == VirtualMachine.Type.SecondaryStorageVm) {
248-
so = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null);
248+
so = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null);
249249
} else if(vm.getType() == VirtualMachine.Type.DomainRouter) {
250-
so = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null);
250+
so = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null);
251251
} else {
252252
assert(false) : "Unsupported system vm type";
253-
so = new ServiceOfferingVO("Fake Offering For unknow system VM", 1, 128, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null);
253+
so = new ServiceOfferingVO("Fake Offering For unknow system VM", 1, 128, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null);
254254
}
255255

256256
if(capacityType == CapacityVO.CAPACITY_TYPE_MEMORY) {

‎server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ public boolean configure(String name, Map<String, Object> params)
13901390
String multicastRateStr = _configDao.getValue("multicast.throttling.rate");
13911391
_networkRate = ((networkRateStr == null) ? 200 : Integer.parseInt(networkRateStr));
13921392
_multicastRate = ((multicastRateStr == null) ? 10 : Integer.parseInt(multicastRateStr));
1393-
_serviceOffering = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, useLocalStorage, true, null);
1393+
_serviceOffering = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, useLocalStorage, true, null, null);
13941394
_serviceOffering.setUniqueName("Cloud.com-SecondaryStorage");
13951395
_serviceOffering = _offeringDao.persistSystemServiceOffering(_serviceOffering);
13961396
_template = _templateDao.findConsoleProxyTemplate();

0 commit comments

Comments
 (0)