2121
2222import com .cloud .template .VirtualMachineTemplate .BootloaderType ;
2323import com .cloud .vm .VirtualMachine .Type ;
24+ import com .cloud .vm .VirtualMachineProfile ;
2425
2526public class VirtualMachineTO {
2627 private long id ;
2728 private String name ;
2829 private BootloaderType bootloader ;
2930 Type type ;
3031 int cpus ;
31- Integer weight ;
32- Integer utilization ;
32+ Integer speed ;
3333 long minRam ;
3434 long maxRam ;
3535 String hostName ;
@@ -42,7 +42,19 @@ public class VirtualMachineTO {
4242 VolumeTO [] disks ;
4343 NicTO [] nics ;
4444
45- public VirtualMachineTO () {
45+ public VirtualMachineTO (VirtualMachineProfile profile , BootloaderType bootloader ) {
46+ this .id = profile .getId ();
47+ this .type = profile .getType ();
48+ this .cpus = profile .getCpus ();
49+ this .minRam = profile .getRam ();
50+ this .maxRam = profile .getRam ();
51+ this .speed = profile .getSpeed ();
52+ this .os = profile .getOs ();
53+ this .name = profile .getName ();
54+ this .bootloader = bootloader ;
55+ }
56+
57+ protected VirtualMachineTO () {
4658 }
4759
4860 public long getId () {
@@ -81,22 +93,10 @@ public void setCpus(int cpus) {
8193 this .cpus = cpus ;
8294 }
8395
84- public Integer getWeight () {
85- return weight ;
86- }
87-
88- public void setWeight (Integer weight ) {
89- this .weight = weight ;
90- }
91-
92- public Integer getUtilization () {
93- return utilization ;
96+ public Integer getSpeed () {
97+ return speed ;
9498 }
9599
96- public void setUtiliziation (Integer utilization ) {
97- this .utilization = utilization ;
98- }
99-
100100 public long getMinRam () {
101101 return minRam ;
102102 }
@@ -133,8 +133,13 @@ public String getOs() {
133133 public void setOs (String os ) {
134134 this .os = os ;
135135 }
136-
136+
137137 public String getBootArgs () {
138+ StringBuilder buf = new StringBuilder (bootArgs != null ? bootArgs : "" );
139+ buf .append (" " );
140+ for (NicTO nic : nics ) {
141+ buf .append ("" );
142+ }
138143 return bootArgs ;
139144 }
140145
@@ -162,12 +167,11 @@ public void setDisks(VolumeTO[] disks) {
162167 this .disks = disks ;
163168 }
164169
165- public NicTO [] getNetworks () {
170+ public NicTO [] getNics () {
166171 return nics ;
167172 }
168173
169174 public void setNics (NicTO [] nics ) {
170175 this .nics = nics ;
171176 }
172-
173177}
0 commit comments