2020import java .util .Map ;
2121
2222import com .cloud .template .VirtualMachineTemplate .BootloaderType ;
23+ import com .cloud .vm .VirtualMachine ;
2324import com .cloud .vm .VirtualMachine .Type ;
24- import com .cloud .vm .VirtualMachineProfile ;
2525
2626public class VirtualMachineTO {
2727 private long id ;
@@ -39,25 +39,25 @@ public class VirtualMachineTO {
3939 String [] bootupScripts ;
4040 boolean rebootOnCrash ;
4141 Monitor monitor ;
42-
42+
4343 VolumeTO [] disks ;
4444 NicTO [] nics ;
45-
46- public VirtualMachineTO (VirtualMachineProfile profile , BootloaderType bootloader ) {
47- this .id = profile .getId ();
48- this .type = profile .getType ();
49- this .cpus = profile .getCpus ();
50- this .minRam = profile .getRam ();
51- this .maxRam = profile .getRam ();
52- this .speed = profile .getSpeed ();
53- this .os = profile .getOs ();
54- this .name = profile .getName ();
45+
46+ public VirtualMachineTO (long id , String instanceName , VirtualMachine .Type type , int cpus , Integer speed , long minRam , long maxRam , BootloaderType bootloader , String os ) {
47+ this .id = id ;
48+ this .name = instanceName ;
49+ this .type = type ;
50+ this .cpus = cpus ;
51+ this .speed = speed ;
52+ this .minRam = minRam ;
53+ this .maxRam = maxRam ;
5554 this .bootloader = bootloader ;
55+ this .os = os ;
5656 }
5757
5858 protected VirtualMachineTO () {
5959 }
60-
60+
6161 public long getId () {
6262 return id ;
6363 }
@@ -69,19 +69,19 @@ public void setId(long id) {
6969 public String getName () {
7070 return name ;
7171 }
72-
72+
7373 public Monitor getMonitor () {
7474 return monitor ;
7575 }
76-
76+
7777 public void setMonitor (Monitor monitor ) {
7878 this .monitor = monitor ;
7979 }
8080
8181 public void setName (String name ) {
8282 this .name = name ;
8383 }
84-
84+
8585 public Type getType () {
8686 return type ;
8787 }
@@ -101,11 +101,11 @@ public int getCpus() {
101101 public void setCpus (int cpus ) {
102102 this .cpus = cpus ;
103103 }
104-
104+
105105 public Integer getSpeed () {
106106 return speed ;
107107 }
108-
108+
109109 public long getMinRam () {
110110 return minRam ;
111111 }
@@ -142,7 +142,7 @@ public String getOs() {
142142 public void setOs (String os ) {
143143 this .os = os ;
144144 }
145-
145+
146146 public String getBootArgs () {
147147 StringBuilder buf = new StringBuilder (bootArgs != null ? bootArgs : "" );
148148 buf .append (" " );
@@ -155,9 +155,9 @@ public String getBootArgs() {
155155 public void setBootArgs (String bootArgs ) {
156156 this .bootArgs = bootArgs ;
157157 }
158-
158+
159159 public void setBootArgs (Map <String , String > bootParams ) {
160- StringBuilder buf = new StringBuilder ();
160+ StringBuilder buf = new StringBuilder ();
161161 for (Map .Entry <String , String > entry : bootParams .entrySet ()) {
162162 buf .append (" " ).append (entry .getKey ()).append ("=" ).append (entry .getValue ());
163163 }
@@ -187,23 +187,23 @@ public NicTO[] getNics() {
187187 public void setNics (NicTO [] nics ) {
188188 this .nics = nics ;
189189 }
190-
190+
191191 public static interface Monitor {
192-
192+
193193 }
194-
194+
195195 public static class SshMonitor implements Monitor {
196196 String ip ;
197197 int port ;
198-
198+
199199 public String getIp () {
200200 return ip ;
201201 }
202-
202+
203203 public int getPort () {
204204 return port ;
205205 }
206-
206+
207207 public SshMonitor (String ip , int port ) {
208208 this .ip = ip ;
209209 this .port = port ;
0 commit comments