@@ -34,7 +34,7 @@ def _check_drives(test_microvm, assert_dict, keys_array):
3434 assert blockdev_out_line_cols [col ] == assert_dict [key ]
3535
3636
37- def test_vhost_user_block (microvm_factory , guest_kernel , rootfs_ubuntu_24 ):
37+ def test_vhost_user_block (microvm_factory , guest_kernel , rootfs ):
3838 """
3939 This test simply tries to boot a VM with
4040 vhost-user-block as a root device.
@@ -44,13 +44,11 @@ def test_vhost_user_block(microvm_factory, guest_kernel, rootfs_ubuntu_24):
4444
4545 # We need to setup ssh keys manually because we did not specify rootfs
4646 # in microvm_factory.build method
47- ssh_key = rootfs_ubuntu_24 .with_suffix (".id_rsa" )
47+ ssh_key = rootfs .with_suffix (".id_rsa" )
4848 vm .ssh_key = ssh_key
4949 vm .spawn ()
5050 vm .basic_config (add_root_device = False )
51- vm .add_vhost_user_drive (
52- "rootfs" , rootfs_ubuntu_24 , is_root_device = True , is_read_only = True
53- )
51+ vm .add_vhost_user_drive ("rootfs" , rootfs , is_root_device = True , is_read_only = True )
5452 vm .add_net_iface ()
5553 vhost_user_block_metrics = FcDeviceMetrics (
5654 "vhost_user_block" , 1 , aggr_supported = False
@@ -67,7 +65,7 @@ def test_vhost_user_block(microvm_factory, guest_kernel, rootfs_ubuntu_24):
6765 vhost_user_block_metrics .validate (vm )
6866
6967
70- def test_vhost_user_block_read_write (microvm_factory , guest_kernel , rootfs_ubuntu_24 ):
68+ def test_vhost_user_block_read_write (microvm_factory , guest_kernel , rootfs ):
7169 """
7270 This test simply tries to boot a VM with
7371 vhost-user-block as a root device.
@@ -78,14 +76,14 @@ def test_vhost_user_block_read_write(microvm_factory, guest_kernel, rootfs_ubunt
7876
7977 # We need to setup ssh keys manually because we did not specify rootfs
8078 # in microvm_factory.build method
81- ssh_key = rootfs_ubuntu_24 .with_suffix (".id_rsa" )
79+ ssh_key = rootfs .with_suffix (".id_rsa" )
8280 vm .ssh_key = ssh_key
8381 vm .spawn ()
8482 vm .basic_config (add_root_device = False )
8583
8684 # Create a rw rootfs file that is unique to the microVM
8785 rootfs_rw = Path (vm .chroot ()) / "rootfs"
88- shutil .copy (rootfs_ubuntu_24 , rootfs_rw )
86+ shutil .copy (rootfs , rootfs_rw )
8987
9088 vm .add_vhost_user_drive ("rootfs" , rootfs_rw , is_root_device = True )
9189 vm .add_net_iface ()
@@ -100,7 +98,7 @@ def test_vhost_user_block_read_write(microvm_factory, guest_kernel, rootfs_ubunt
10098 _check_drives (vm , assert_dict , assert_dict .keys ())
10199
102100
103- def test_vhost_user_block_disconnect (microvm_factory , guest_kernel , rootfs_ubuntu_24 ):
101+ def test_vhost_user_block_disconnect (microvm_factory , guest_kernel , rootfs ):
104102 """
105103 Test that even if backend is killed, Firecracker is still responsive.
106104 """
@@ -109,13 +107,11 @@ def test_vhost_user_block_disconnect(microvm_factory, guest_kernel, rootfs_ubunt
109107
110108 # We need to set up ssh keys manually because we did not specify rootfs
111109 # in microvm_factory.build method
112- ssh_key = rootfs_ubuntu_24 .with_suffix (".id_rsa" )
110+ ssh_key = rootfs .with_suffix (".id_rsa" )
113111 vm .ssh_key = ssh_key
114112 vm .spawn ()
115113 vm .basic_config (add_root_device = False )
116- vm .add_vhost_user_drive (
117- "rootfs" , rootfs_ubuntu_24 , is_root_device = True , is_read_only = True
118- )
114+ vm .add_vhost_user_drive ("rootfs" , rootfs , is_root_device = True , is_read_only = True )
119115 vm .add_net_iface ()
120116 vm .start ()
121117
@@ -127,7 +123,7 @@ def test_vhost_user_block_disconnect(microvm_factory, guest_kernel, rootfs_ubunt
127123 _config = vm .api .vm_config .get ().json ()
128124
129125
130- def test_device_ordering (microvm_factory , guest_kernel , rootfs_ubuntu_24 ):
126+ def test_device_ordering (microvm_factory , guest_kernel , rootfs ):
131127 """
132128 Verify device ordering.
133129
@@ -139,7 +135,7 @@ def test_device_ordering(microvm_factory, guest_kernel, rootfs_ubuntu_24):
139135
140136 # We need to setup ssh keys manually because we did not specify rootfs
141137 # in microvm_factory.build method
142- ssh_key = rootfs_ubuntu_24 .with_suffix (".id_rsa" )
138+ ssh_key = rootfs .with_suffix (".id_rsa" )
143139 vm .ssh_key = ssh_key
144140 vm .spawn ()
145141 vm .basic_config (add_root_device = False )
@@ -150,17 +146,15 @@ def test_device_ordering(microvm_factory, guest_kernel, rootfs_ubuntu_24):
150146 vm .add_drive ("scratch1" , fs1 .path )
151147
152148 # Adding second block device (rootfs)
153- vm .add_vhost_user_drive (
154- "rootfs" , rootfs_ubuntu_24 , is_root_device = True , is_read_only = True
155- )
149+ vm .add_vhost_user_drive ("rootfs" , rootfs , is_root_device = True , is_read_only = True )
156150
157151 # Adding third block device.
158152 fs2 = drive_tools .FilesystemFile (os .path .join (vm .fsfiles , "scratch2" ), size = 512 )
159153 vm .add_drive ("scratch2" , fs2 .path )
160154
161155 # Create a rw rootfs file that is unique to the microVM
162156 rootfs_rw = Path (vm .chroot ()) / "rootfs"
163- shutil .copy (rootfs_ubuntu_24 , rootfs_rw )
157+ shutil .copy (rootfs , rootfs_rw )
164158
165159 # Adding forth block device.
166160 vm .add_vhost_user_drive ("dummy_rootfs" , rootfs_rw )
@@ -171,7 +165,7 @@ def test_device_ordering(microvm_factory, guest_kernel, rootfs_ubuntu_24):
171165 )
172166 vm .start ()
173167
174- rootfs_size = rootfs_ubuntu_24 .stat ().st_size
168+ rootfs_size = rootfs .stat ().st_size
175169
176170 # The devices were added in this order: fs1, rootfs, fs2. fs3
177171 # However, the rootfs is the root device and goes first,
@@ -203,7 +197,7 @@ def test_device_ordering(microvm_factory, guest_kernel, rootfs_ubuntu_24):
203197def test_partuuid_boot (
204198 microvm_factory ,
205199 guest_kernel ,
206- rootfs_ubuntu_24 ,
200+ rootfs ,
207201):
208202 """
209203 Test the output reported by blockdev when booting with PARTUUID.
@@ -213,15 +207,13 @@ def test_partuuid_boot(
213207
214208 # We need to setup ssh keys manually because we did not specify rootfs
215209 # in microvm_factory.build method
216- ssh_key = rootfs_ubuntu_24 .with_suffix (".id_rsa" )
210+ ssh_key = rootfs .with_suffix (".id_rsa" )
217211 vm .ssh_key = ssh_key
218212 vm .spawn ()
219213 vm .basic_config (add_root_device = False )
220214
221215 # Create a rootfs with partuuid unique to this microVM
222- partuuid , disk_path = partuuid_and_disk_path (
223- rootfs_ubuntu_24 , Path (vm .chroot ()) / "disk.img"
224- )
216+ partuuid , disk_path = partuuid_and_disk_path (rootfs , Path (vm .chroot ()) / "disk.img" )
225217
226218 vm .add_vhost_user_drive (
227219 "1" , disk_path , is_root_device = True , partuuid = partuuid , is_read_only = True
@@ -238,7 +230,7 @@ def test_partuuid_boot(
238230 _check_drives (vm , assert_dict , assert_dict .keys ())
239231
240232
241- def test_partuuid_update (microvm_factory , guest_kernel , rootfs_ubuntu_24 ):
233+ def test_partuuid_update (microvm_factory , guest_kernel , rootfs ):
242234 """
243235 Test successful switching from PARTUUID boot to /dev/vda boot.
244236 """
@@ -247,7 +239,7 @@ def test_partuuid_update(microvm_factory, guest_kernel, rootfs_ubuntu_24):
247239
248240 # We need to setup ssh keys manually because we did not specify rootfs
249241 # in microvm_factory.build method
250- ssh_key = rootfs_ubuntu_24 .with_suffix (".id_rsa" )
242+ ssh_key = rootfs .with_suffix (".id_rsa" )
251243 vm .ssh_key = ssh_key
252244 vm .spawn ()
253245 vm .basic_config (add_root_device = False )
@@ -256,16 +248,14 @@ def test_partuuid_update(microvm_factory, guest_kernel, rootfs_ubuntu_24):
256248 # Add the root block device specified through PARTUUID.
257249 vm .add_vhost_user_drive (
258250 "rootfs" ,
259- rootfs_ubuntu_24 ,
251+ rootfs ,
260252 is_root_device = True ,
261253 partuuid = "0eaa91a0-01" ,
262254 is_read_only = True ,
263255 )
264256
265257 # Adding a drive with the same ID creates another backend with another socket.
266- vm .add_vhost_user_drive (
267- "rootfs" , rootfs_ubuntu_24 , is_root_device = True , is_read_only = True
268- )
258+ vm .add_vhost_user_drive ("rootfs" , rootfs , is_root_device = True , is_read_only = True )
269259
270260 vhost_user_block_metrics = FcDeviceMetrics (
271261 "vhost_user_block" , 1 , aggr_supported = False
0 commit comments