2323import com .cloud .hypervisor .Hypervisor .HypervisorType ;
2424import com .cloud .network .Networks .RouterPrivateIpStrategy ;
2525import com .cloud .utils .Pair ;
26- import com .cloud .vm .VirtualMachine .State ;
26+ import com .cloud .vm .VirtualMachine .PowerState ;
2727
2828public class StartupRoutingCommand extends StartupCommand {
29- public static class VmState {
30- State state ;
31- String host ;
32- public VmState () {
33- }
34- public VmState (State state , String host ) {
35- this .state = state ;
36- this .host = host ;
37- }
38- public State getState () {
39- return state ;
40- }
41- public String getHost () {
42- return host ;
43- }
44- }
4529 int cpus ;
4630 long speed ;
4731 long memory ;
4832 long dom0MinMemory ;
4933 boolean poolSync ;
50- Map <String , VmState > vms ;
51- HashMap <String , Pair <String , State >> _clusterVMStates ;
34+ Map <String , HostVmStateReportEntry > vms ;
35+ HashMap <String , Pair <String , PowerState >> _clusterVMStates ;
5236 String caps ;
5337 String pool ;
5438 HypervisorType hypervisorType ;
@@ -59,7 +43,6 @@ public StartupRoutingCommand() {
5943 super (Host .Type .Routing );
6044 hostDetails = new HashMap <String , String >();
6145 getHostDetails ().put (RouterPrivateIpStrategy .class .getCanonicalName (), RouterPrivateIpStrategy .DcGlobal .toString ());
62-
6346 }
6447
6548 public StartupRoutingCommand (int cpus ,
@@ -69,8 +52,9 @@ public StartupRoutingCommand(int cpus,
6952 String caps ,
7053 HypervisorType hypervisorType ,
7154 RouterPrivateIpStrategy privIpStrategy ,
72- Map <String , VmState > vms ) {
73- this (cpus , speed , memory , dom0MinMemory , caps , hypervisorType , vms );
55+ Map <String , HostVmStateReportEntry > vms ) {
56+
57+ this (cpus , speed , memory , dom0MinMemory , caps , hypervisorType , vms );
7458 getHostDetails ().put (RouterPrivateIpStrategy .class .getCanonicalName (), privIpStrategy .toString ());
7559 }
7660
@@ -81,9 +65,10 @@ public StartupRoutingCommand(int cpus,
8165 String caps ,
8266 HypervisorType hypervisorType ,
8367 RouterPrivateIpStrategy privIpStrategy ) {
84- this (cpus , speed , memory , dom0MinMemory , caps , hypervisorType , new HashMap <String ,String >(), new HashMap <String , VmState >());
85- getHostDetails ().put (RouterPrivateIpStrategy .class .getCanonicalName (), privIpStrategy .toString ());
86- }
68+
69+ this (cpus , speed , memory , dom0MinMemory , caps , hypervisorType , new HashMap <String ,String >(), new HashMap <String , HostVmStateReportEntry >());
70+ getHostDetails ().put (RouterPrivateIpStrategy .class .getCanonicalName (), privIpStrategy .toString ());
71+ }
8772
8873 public StartupRoutingCommand (int cpus ,
8974 long speed ,
@@ -92,7 +77,7 @@ public StartupRoutingCommand(int cpus,
9277 final String caps ,
9378 final HypervisorType hypervisorType ,
9479 final Map <String , String > hostDetails ,
95- Map <String , VmState > vms ) {
80+ Map <String , HostVmStateReportEntry > vms ) {
9681 super (Host .Type .Routing );
9782 this .cpus = cpus ;
9883 this .speed = speed ;
@@ -107,29 +92,29 @@ public StartupRoutingCommand(int cpus,
10792
10893 public StartupRoutingCommand (int cpus2 , long speed2 , long memory2 ,
10994 long dom0MinMemory2 , String caps2 , HypervisorType hypervisorType2 ,
110- Map <String , VmState > vms2 ) {
95+ Map <String , HostVmStateReportEntry > vms2 ) {
11196 this (cpus2 , speed2 , memory2 , dom0MinMemory2 , caps2 , hypervisorType2 , new HashMap <String ,String >(), vms2 );
11297 }
11398
114- public StartupRoutingCommand (int cpus , long speed , long memory , long dom0MinMemory , final String caps , final HypervisorType hypervisorType , final Map <String , String > hostDetails , Map <String , VmState > vms , String hypervisorVersion ) {
99+ public StartupRoutingCommand (int cpus , long speed , long memory , long dom0MinMemory , final String caps , final HypervisorType hypervisorType , final Map <String , String > hostDetails , Map <String , HostVmStateReportEntry > vms , String hypervisorVersion ) {
115100 this (cpus , speed , memory , dom0MinMemory , caps , hypervisorType , hostDetails , vms );
116101 this .hypervisorVersion = hypervisorVersion ;
117102 }
118103
119- public void setChanges (Map <String , VmState > vms ) {
104+ public void setChanges (Map <String , HostVmStateReportEntry > vms ) {
120105 this .vms = vms ;
121106 }
122107
123- public void setStateChanges (Map <String , State > vms ) {
108+ public void setStateChanges (Map <String , PowerState > vms ) {
124109 for ( String vm_name : vms .keySet () ) {
125110 if ( this .vms == null ) {
126- this .vms = new HashMap <String , VmState >();
111+ this .vms = new HashMap <String , HostVmStateReportEntry >();
127112 }
128- this .vms .put (vm_name , new VmState (vms .get (vm_name ), null ));
113+ this .vms .put (vm_name , new HostVmStateReportEntry (vms .get (vm_name ), null ));
129114 }
130115 }
131116
132- public void setClusterVMStateChanges (HashMap <String , Pair <String , State >> allStates ){
117+ public void setClusterVMStateChanges (HashMap <String , Pair <String , PowerState >> allStates ){
133118 _clusterVMStates = allStates ;
134119 }
135120
@@ -153,11 +138,11 @@ public long getDom0MinMemory() {
153138 return dom0MinMemory ;
154139 }
155140
156- public Map <String , VmState > getVmStates () {
141+ public Map <String , HostVmStateReportEntry > getVmStates () {
157142 return vms ;
158143 }
159144
160- public HashMap <String , Pair <String , State >> getClusterVMStateChanges () {
145+ public HashMap <String , Pair <String , PowerState >> getClusterVMStateChanges () {
161146 return _clusterVMStates ;
162147 }
163148
0 commit comments