@@ -2,10 +2,8 @@ package org.zstack.test.integration.storage.primary.local.multips
22
33import org.zstack.core.db.Q
44import org.zstack.header.image.ImageConstant
5- import org.zstack.header.volume.Volume
65import org.zstack.header.volume.VolumeVO
76import org.zstack.header.volume.VolumeVO_
8- import org.zstack.sdk.DiskOfferingInventory
97import org.zstack.sdk.ImageInventory
108import org.zstack.sdk.PrimaryStorageInventory
119import org.zstack.sdk.VmInstanceInventory
@@ -30,17 +28,6 @@ class CreateVmWithVolumeSpecifiedPsCase extends SubCase {
3028 @Override
3129 void environment () {
3230 env = env {
33- instanceOffering {
34- name = " instanceOffering"
35- memory = SizeUnit . GIGABYTE . toByte(1 )
36- cpu = 1
37- }
38-
39- diskOffering {
40- name = " diskOffering"
41- diskSize = SizeUnit . GIGABYTE . toByte(20 )
42- }
43-
4431 sftpBackupStorage {
4532 name = " sftp"
4633 url = " /sftp"
@@ -126,11 +113,14 @@ class CreateVmWithVolumeSpecifiedPsCase extends SubCase {
126113
127114 vm {
128115 name = " vm"
129- useInstanceOffering(" instanceOffering" )
116+ cpu = 1
117+ memoryGB(1 )
130118 useImage(" image1" )
131119 useL3Networks(" pubL3" )
132- useRootDiskOffering(" diskOffering" )
133120 useHost(" kvm" )
121+ disk {
122+ sizeGB(20 )
123+ }
134124 }
135125 }
136126 }
@@ -147,20 +137,26 @@ class CreateVmWithVolumeSpecifiedPsCase extends SubCase {
147137
148138 void testCreateVMPs1WithVolumePs1 () {
149139 ImageInventory iso = env. inventoryByName(" iso" ) as ImageInventory
150- DiskOfferingInventory diskOffering = env. inventoryByName(" diskOffering" ) as DiskOfferingInventory
151140 VmInstanceInventory vm = env. inventoryByName(" vm" ) as VmInstanceInventory
152141 PrimaryStorageInventory local_ps1 = env. inventoryByName(" local" ) as PrimaryStorageInventory
153- PrimaryStorageInventory local_ps2 = env. inventoryByName(" local2" ) as PrimaryStorageInventory
154142
155143 VmInstanceInventory newVm = createVmInstance {
156144 name = " new_vm"
157- instanceOfferingUuid = vm. instanceOfferingUuid
158- rootDiskOfferingUuid = diskOffering. uuid
159- dataDiskOfferingUuids = [diskOffering. uuid]
145+ cpuNum = 1
146+ memorySize = gb(1 )
160147 imageUuid = iso. uuid
161148 l3NetworkUuids = [vm. defaultL3NetworkUuid]
162- primaryStorageUuidForRootVolume = local_ps1. uuid
163- systemTags = [" primaryStorageUuidForDataVolume::${ local_ps1.uuid} " . toString()]
149+ diskAOs = [
150+ [
151+ " boot" : true ,
152+ " size" : gb(20 ),
153+ " primaryStorageUuid" : local_ps1. uuid,
154+ ],
155+ [
156+ " size" : gb(20 ),
157+ " primaryStorageUuid" : local_ps1. uuid,
158+ ],
159+ ]
164160 } as VmInstanceInventory
165161
166162 assert newVm. allVolumes. size() == 2
@@ -174,20 +170,27 @@ class CreateVmWithVolumeSpecifiedPsCase extends SubCase {
174170
175171 void testCreateVMPs1WithVolumePs2 () {
176172 ImageInventory iso = env. inventoryByName(" iso" ) as ImageInventory
177- DiskOfferingInventory diskOffering = env. inventoryByName(" diskOffering" ) as DiskOfferingInventory
178173 VmInstanceInventory vm = env. inventoryByName(" vm" ) as VmInstanceInventory
179174 PrimaryStorageInventory local_ps1 = env. inventoryByName(" local" ) as PrimaryStorageInventory
180175 PrimaryStorageInventory local_ps2 = env. inventoryByName(" local2" ) as PrimaryStorageInventory
181176
182177 VmInstanceInventory newVm = createVmInstance {
183178 name = " new_vm"
184- instanceOfferingUuid = vm. instanceOfferingUuid
185- rootDiskOfferingUuid = diskOffering. uuid
186- dataDiskOfferingUuids = [diskOffering. uuid]
179+ cpuNum = 1
180+ memorySize = gb(1 )
187181 imageUuid = iso. uuid
188182 l3NetworkUuids = [vm. defaultL3NetworkUuid]
189- primaryStorageUuidForRootVolume = local_ps1. uuid
190- systemTags = [" primaryStorageUuidForDataVolume::${ local_ps2.uuid} " . toString()]
183+ diskAOs = [
184+ [
185+ " boot" : true ,
186+ " size" : gb(20 ),
187+ " primaryStorageUuid" : local_ps1. uuid,
188+ ],
189+ [
190+ " size" : gb(20 ),
191+ " primaryStorageUuid" : local_ps2. uuid,
192+ ],
193+ ]
191194 } as VmInstanceInventory
192195
193196 retryInSecs {
@@ -200,20 +203,26 @@ class CreateVmWithVolumeSpecifiedPsCase extends SubCase {
200203
201204 void testCreateVMPs2WithVolumePs2 () {
202205 ImageInventory iso = env. inventoryByName(" iso" ) as ImageInventory
203- DiskOfferingInventory diskOffering = env. inventoryByName(" diskOffering" ) as DiskOfferingInventory
204206 VmInstanceInventory vm = env. inventoryByName(" vm" ) as VmInstanceInventory
205- PrimaryStorageInventory local_ps1 = env. inventoryByName(" local" ) as PrimaryStorageInventory
206207 PrimaryStorageInventory local_ps2 = env. inventoryByName(" local2" ) as PrimaryStorageInventory
207208
208209 VmInstanceInventory newVm = createVmInstance {
209210 name = " new_vm"
210- instanceOfferingUuid = vm. instanceOfferingUuid
211- rootDiskOfferingUuid = diskOffering. uuid
212- dataDiskOfferingUuids = [diskOffering. uuid]
211+ cpuNum = 1
212+ memorySize = gb(1 )
213213 imageUuid = iso. uuid
214214 l3NetworkUuids = [vm. defaultL3NetworkUuid]
215- primaryStorageUuidForRootVolume = local_ps2. uuid
216- systemTags = [" primaryStorageUuidForDataVolume::${ local_ps2.uuid} " . toString()]
215+ diskAOs = [
216+ [
217+ " boot" : true ,
218+ " size" : gb(20 ),
219+ " primaryStorageUuid" : local_ps2. uuid,
220+ ],
221+ [
222+ " size" : gb(20 ),
223+ " primaryStorageUuid" : local_ps2. uuid,
224+ ],
225+ ]
217226 } as VmInstanceInventory
218227
219228 retryInSecs {
@@ -226,20 +235,27 @@ class CreateVmWithVolumeSpecifiedPsCase extends SubCase {
226235
227236 void testCreateVMPs2WithVolumePs1 () {
228237 ImageInventory iso = env. inventoryByName(" iso" ) as ImageInventory
229- DiskOfferingInventory diskOffering = env. inventoryByName(" diskOffering" ) as DiskOfferingInventory
230238 VmInstanceInventory vm = env. inventoryByName(" vm" ) as VmInstanceInventory
231239 PrimaryStorageInventory local_ps1 = env. inventoryByName(" local" ) as PrimaryStorageInventory
232240 PrimaryStorageInventory local_ps2 = env. inventoryByName(" local2" ) as PrimaryStorageInventory
233241
234242 VmInstanceInventory newVm = createVmInstance {
235243 name = " new_vm"
236- instanceOfferingUuid = vm. instanceOfferingUuid
237- rootDiskOfferingUuid = diskOffering. uuid
238- dataDiskOfferingUuids = [diskOffering. uuid]
244+ cpuNum = 1
245+ memorySize = gb(1 )
239246 imageUuid = iso. uuid
240247 l3NetworkUuids = [vm. defaultL3NetworkUuid]
241- primaryStorageUuidForRootVolume = local_ps2. uuid
242- systemTags = [" primaryStorageUuidForDataVolume::${ local_ps1.uuid} " . toString()]
248+ diskAOs = [
249+ [
250+ " boot" : true ,
251+ " size" : gb(20 ),
252+ " primaryStorageUuid" : local_ps2. uuid,
253+ ],
254+ [
255+ " size" : gb(20 ),
256+ " primaryStorageUuid" : local_ps1. uuid,
257+ ],
258+ ]
243259 } as VmInstanceInventory
244260
245261 retryInSecs {
0 commit comments