Skip to content

Commit 9a27690

Browse files
author
Anthony Xu
committed
CLOUDSTACK-4649:
xs 6.1/6.2 introduce the new virtual platform, so there are two virtual platforms, windows PV driver version must match virtual platforms, this patch tracks PV driver versions in vm details and template details. Anthony
1 parent e6384be commit 9a27690

26 files changed

Lines changed: 344 additions & 106 deletions

File tree

‎core/src/com/cloud/agent/api/ClusterSyncAnswer.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818

1919
import java.util.HashMap;
2020

21-
import com.cloud.utils.Pair;
21+
import com.cloud.utils.Ternary;
2222
import com.cloud.vm.VirtualMachine.State;
2323

2424
public class ClusterSyncAnswer extends Answer {
2525
private long _clusterId;
26-
private HashMap<String, Pair<String, State>> _newStates;
26+
private HashMap<String, Ternary<String, State, String>> _newStates;
2727
private boolean _isExecuted=false;
2828

2929
// this is here because a cron command answer is being sent twice
@@ -38,7 +38,7 @@ public void setExecuted(){
3838
}
3939

4040

41-
public ClusterSyncAnswer(long clusterId, HashMap<String, Pair<String, State>> newStates){
41+
public ClusterSyncAnswer(long clusterId, HashMap<String, Ternary<String, State, String>> newStates){
4242
_clusterId = clusterId;
4343
_newStates = newStates;
4444
result = true;
@@ -48,7 +48,7 @@ public long getClusterId() {
4848
return _clusterId;
4949
}
5050

51-
public HashMap<String, Pair<String, State>> getNewStates() {
51+
public HashMap<String, Ternary<String, State, String>> getNewStates() {
5252
return _newStates;
5353
}
5454

‎core/src/com/cloud/agent/api/StartupRoutingCommand.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import com.cloud.host.Host;
2323
import com.cloud.hypervisor.Hypervisor.HypervisorType;
2424
import com.cloud.network.Networks.RouterPrivateIpStrategy;
25-
import com.cloud.utils.Pair;
25+
import com.cloud.utils.Ternary;
2626
import com.cloud.vm.VirtualMachine.State;
2727

2828
public class StartupRoutingCommand extends StartupCommand {
@@ -48,7 +48,7 @@ public String getHost() {
4848
long dom0MinMemory;
4949
boolean poolSync;
5050
Map<String, VmState> vms;
51-
HashMap<String, Pair<String, State>> _clusterVMStates;
51+
HashMap<String, Ternary<String, State, String>> _clusterVMStates;
5252
String caps;
5353
String pool;
5454
HypervisorType hypervisorType;
@@ -129,7 +129,7 @@ public void setStateChanges(Map<String, State> vms) {
129129
}
130130
}
131131

132-
public void setClusterVMStateChanges(HashMap<String, Pair<String, State>> allStates){
132+
public void setClusterVMStateChanges(HashMap<String, Ternary<String, State, String>> allStates){
133133
_clusterVMStates = allStates;
134134
}
135135

@@ -157,7 +157,7 @@ public Map<String, VmState> getVmStates() {
157157
return vms;
158158
}
159159

160-
public HashMap<String, Pair<String, State>> getClusterVMStateChanges() {
160+
public HashMap<String, Ternary<String, State, String>> getClusterVMStateChanges() {
161161
return _clusterVMStates;
162162
}
163163

‎core/src/com/cloud/agent/api/StopAnswer.java‎

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,34 @@
1717
package com.cloud.agent.api;
1818

1919
public class StopAnswer extends RebootAnswer {
20-
Integer vncPort;
20+
21+
private String hypervisortoolsversion;
2122
Integer timeOffset;
2223

2324
protected StopAnswer() {
2425
}
2526

26-
public StopAnswer(StopCommand cmd, String details, Integer vncPort, Integer timeOffset, boolean success) {
27+
public StopAnswer(StopCommand cmd, String details, String hypervisortoolsversion, Integer timeOffset, boolean success) {
2728
super(cmd, details, success);
28-
this.vncPort = vncPort;
29+
this.hypervisortoolsversion = hypervisortoolsversion;
2930
this.timeOffset = timeOffset;
3031
}
3132

32-
public StopAnswer(StopCommand cmd, String details, Integer vncPort, boolean success) {
33+
public StopAnswer(StopCommand cmd, String details, boolean success) {
3334
super(cmd, details, success);
34-
this.vncPort = vncPort;
35+
this.hypervisortoolsversion = null;
3536
this.timeOffset = null;
3637
}
3738

38-
public StopAnswer(StopCommand cmd, String details, boolean success) {
39-
super(cmd, details, success);
40-
vncPort = null;
41-
timeOffset = null;
42-
}
4339

4440
public StopAnswer(StopCommand cmd, Exception e) {
4541
super(cmd, e);
42+
this.hypervisortoolsversion = null;
43+
this.timeOffset = null;
4644
}
4745

48-
@Override
49-
public Integer getVncPort() {
50-
return vncPort;
46+
public String getHypervisorToolsVersion() {
47+
return hypervisortoolsversion;
5148
}
5249

5350
public Integer getTimeOffset() {

‎engine/schema/src/com/cloud/configuration/dao/ConfigurationDao.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ public interface ConfigurationDao extends GenericDao<ConfigurationVO, String> {
5454

5555
public String getValueAndInitIfNotExist(String name, String category, String initValue);
5656

57+
public String getValueAndInitIfNotExist(String name, String category, String initValue, String desc);
58+
5759

5860
/**
5961
* returns whether or not this is a premium configuration

‎engine/schema/src/com/cloud/configuration/dao/ConfigurationDaoImpl.java‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,13 @@ public String getValue(String name) {
169169
}
170170

171171
@Override
172-
@DB
173172
public String getValueAndInitIfNotExist(String name, String category, String initValue) {
173+
return getValueAndInitIfNotExist(name, category, initValue, "");
174+
}
175+
176+
@Override
177+
@DB
178+
public String getValueAndInitIfNotExist(String name, String category, String initValue, String desc) {
174179
String returnValue = initValue;
175180
try {
176181
ConfigurationVO config = findByName(name);
@@ -184,7 +189,7 @@ public String getValueAndInitIfNotExist(String name, String category, String ini
184189
if (category.equals("Hidden") || category.equals("Secure")) {
185190
initValue = DBEncryptionUtil.encrypt(initValue);
186191
}
187-
ConfigurationVO newConfig = new ConfigurationVO(category, "DEFAULT", "management-server", name, initValue, "");
192+
ConfigurationVO newConfig = new ConfigurationVO(category, "DEFAULT", "management-server", name, initValue, desc);
188193
persist(newConfig);
189194
}
190195
return returnValue;

‎engine/schema/src/com/cloud/storage/dao/VMTemplateDao.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,7 @@ public interface VMTemplateDao extends GenericDao<VMTemplateVO, Long> {
7676

7777
List<VMTemplateVO> findTemplatesToSyncToS3();
7878

79+
void loadDetails(VMTemplateVO tmpl);
80+
81+
void saveDetails(VMTemplateVO tmpl);
7982
}

‎engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,23 @@ public String getRoutingTemplateUniqueName() {
411411
return routerTmpltName;
412412
}
413413

414+
415+
@Override
416+
public void loadDetails(VMTemplateVO tmpl) {
417+
Map<String, String> details = _templateDetailsDao.findDetails(tmpl.getId());
418+
tmpl.setDetails(details);
419+
}
420+
421+
@Override
422+
public void saveDetails(VMTemplateVO tmpl) {
423+
Map<String, String> details = tmpl.getDetails();
424+
if (details == null) {
425+
return;
426+
}
427+
_templateDetailsDao.persist(tmpl.getId(), details);
428+
}
429+
430+
414431
/*
415432
* @Override public Set<Pair<Long, Long>> searchSwiftTemplates(String name,
416433
* String keyword, TemplateFilter templateFilter, boolean isIso,

‎plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ protected StopAnswer execute(final StopCommand cmd) {
509509
count++;
510510
}
511511

512-
return success ? new StopAnswer(cmd, "Success", 0, true) : new StopAnswer(cmd, "IPMI power off failed", false);
512+
return success ? new StopAnswer(cmd, "Success", true) : new StopAnswer(cmd, "IPMI power off failed", false);
513513
}
514514

515515
protected StartAnswer execute(StartCommand cmd) {

‎plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3275,7 +3275,7 @@ protected Answer execute(StopCommand cmd) {
32753275
}
32763276

32773277
state = State.Stopped;
3278-
return new StopAnswer(cmd, result, 0, true);
3278+
return new StopAnswer(cmd, result, true);
32793279
} catch (LibvirtException e) {
32803280
return new StopAnswer(cmd, e.getMessage(), false);
32813281
} finally {

‎plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmResourceBase.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,15 +731,15 @@ public StopAnswer execute(StopCommand cmd) {
731731
vm = OvmVm.getDetails(_conn, vmName);
732732
} catch (XmlRpcException e) {
733733
s_logger.debug("Unable to get details of vm: " + vmName + ", treating it as stopped", e);
734-
return new StopAnswer(cmd, "success", 0, true);
734+
return new StopAnswer(cmd, "success", true);
735735
}
736736

737737
deleteAllNetworkRulesForVm(vmName);
738738
OvmVm.stop(_conn, vmName);
739739
cleanup(vm);
740740

741741
state = State.Stopped;
742-
return new StopAnswer(cmd, "success", 0, true);
742+
return new StopAnswer(cmd, "success", true);
743743
} catch (Exception e) {
744744
s_logger.debug("Stop " + vmName + "failed", e);
745745
return new StopAnswer(cmd, e.getMessage(), false);

0 commit comments

Comments
 (0)