@@ -34,7 +34,7 @@ def _check_drives(test_microvm, assert_dict, keys_array):
34
34
assert blockdev_out_line_cols [col ] == assert_dict [key ]
35
35
36
36
37
- def test_vhost_user_block (microvm_factory , guest_kernel , rootfs_ubuntu_24 ):
37
+ def test_vhost_user_block (microvm_factory , guest_kernel , rootfs ):
38
38
"""
39
39
This test simply tries to boot a VM with
40
40
vhost-user-block as a root device.
@@ -44,13 +44,11 @@ def test_vhost_user_block(microvm_factory, guest_kernel, rootfs_ubuntu_24):
44
44
45
45
# We need to setup ssh keys manually because we did not specify rootfs
46
46
# in microvm_factory.build method
47
- ssh_key = rootfs_ubuntu_24 .with_suffix (".id_rsa" )
47
+ ssh_key = rootfs .with_suffix (".id_rsa" )
48
48
vm .ssh_key = ssh_key
49
49
vm .spawn ()
50
50
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 )
54
52
vm .add_net_iface ()
55
53
vhost_user_block_metrics = FcDeviceMetrics (
56
54
"vhost_user_block" , 1 , aggr_supported = False
@@ -67,7 +65,7 @@ def test_vhost_user_block(microvm_factory, guest_kernel, rootfs_ubuntu_24):
67
65
vhost_user_block_metrics .validate (vm )
68
66
69
67
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 ):
71
69
"""
72
70
This test simply tries to boot a VM with
73
71
vhost-user-block as a root device.
@@ -78,14 +76,14 @@ def test_vhost_user_block_read_write(microvm_factory, guest_kernel, rootfs_ubunt
78
76
79
77
# We need to setup ssh keys manually because we did not specify rootfs
80
78
# in microvm_factory.build method
81
- ssh_key = rootfs_ubuntu_24 .with_suffix (".id_rsa" )
79
+ ssh_key = rootfs .with_suffix (".id_rsa" )
82
80
vm .ssh_key = ssh_key
83
81
vm .spawn ()
84
82
vm .basic_config (add_root_device = False )
85
83
86
84
# Create a rw rootfs file that is unique to the microVM
87
85
rootfs_rw = Path (vm .chroot ()) / "rootfs"
88
- shutil .copy (rootfs_ubuntu_24 , rootfs_rw )
86
+ shutil .copy (rootfs , rootfs_rw )
89
87
90
88
vm .add_vhost_user_drive ("rootfs" , rootfs_rw , is_root_device = True )
91
89
vm .add_net_iface ()
@@ -100,7 +98,7 @@ def test_vhost_user_block_read_write(microvm_factory, guest_kernel, rootfs_ubunt
100
98
_check_drives (vm , assert_dict , assert_dict .keys ())
101
99
102
100
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 ):
104
102
"""
105
103
Test that even if backend is killed, Firecracker is still responsive.
106
104
"""
@@ -109,13 +107,11 @@ def test_vhost_user_block_disconnect(microvm_factory, guest_kernel, rootfs_ubunt
109
107
110
108
# We need to set up ssh keys manually because we did not specify rootfs
111
109
# in microvm_factory.build method
112
- ssh_key = rootfs_ubuntu_24 .with_suffix (".id_rsa" )
110
+ ssh_key = rootfs .with_suffix (".id_rsa" )
113
111
vm .ssh_key = ssh_key
114
112
vm .spawn ()
115
113
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 )
119
115
vm .add_net_iface ()
120
116
vm .start ()
121
117
@@ -127,7 +123,7 @@ def test_vhost_user_block_disconnect(microvm_factory, guest_kernel, rootfs_ubunt
127
123
_config = vm .api .vm_config .get ().json ()
128
124
129
125
130
- def test_device_ordering (microvm_factory , guest_kernel , rootfs_ubuntu_24 ):
126
+ def test_device_ordering (microvm_factory , guest_kernel , rootfs ):
131
127
"""
132
128
Verify device ordering.
133
129
@@ -139,7 +135,7 @@ def test_device_ordering(microvm_factory, guest_kernel, rootfs_ubuntu_24):
139
135
140
136
# We need to setup ssh keys manually because we did not specify rootfs
141
137
# in microvm_factory.build method
142
- ssh_key = rootfs_ubuntu_24 .with_suffix (".id_rsa" )
138
+ ssh_key = rootfs .with_suffix (".id_rsa" )
143
139
vm .ssh_key = ssh_key
144
140
vm .spawn ()
145
141
vm .basic_config (add_root_device = False )
@@ -150,17 +146,15 @@ def test_device_ordering(microvm_factory, guest_kernel, rootfs_ubuntu_24):
150
146
vm .add_drive ("scratch1" , fs1 .path )
151
147
152
148
# 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 )
156
150
157
151
# Adding third block device.
158
152
fs2 = drive_tools .FilesystemFile (os .path .join (vm .fsfiles , "scratch2" ), size = 512 )
159
153
vm .add_drive ("scratch2" , fs2 .path )
160
154
161
155
# Create a rw rootfs file that is unique to the microVM
162
156
rootfs_rw = Path (vm .chroot ()) / "rootfs"
163
- shutil .copy (rootfs_ubuntu_24 , rootfs_rw )
157
+ shutil .copy (rootfs , rootfs_rw )
164
158
165
159
# Adding forth block device.
166
160
vm .add_vhost_user_drive ("dummy_rootfs" , rootfs_rw )
@@ -171,7 +165,7 @@ def test_device_ordering(microvm_factory, guest_kernel, rootfs_ubuntu_24):
171
165
)
172
166
vm .start ()
173
167
174
- rootfs_size = rootfs_ubuntu_24 .stat ().st_size
168
+ rootfs_size = rootfs .stat ().st_size
175
169
176
170
# The devices were added in this order: fs1, rootfs, fs2. fs3
177
171
# 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):
203
197
def test_partuuid_boot (
204
198
microvm_factory ,
205
199
guest_kernel ,
206
- rootfs_ubuntu_24 ,
200
+ rootfs ,
207
201
):
208
202
"""
209
203
Test the output reported by blockdev when booting with PARTUUID.
@@ -213,15 +207,13 @@ def test_partuuid_boot(
213
207
214
208
# We need to setup ssh keys manually because we did not specify rootfs
215
209
# in microvm_factory.build method
216
- ssh_key = rootfs_ubuntu_24 .with_suffix (".id_rsa" )
210
+ ssh_key = rootfs .with_suffix (".id_rsa" )
217
211
vm .ssh_key = ssh_key
218
212
vm .spawn ()
219
213
vm .basic_config (add_root_device = False )
220
214
221
215
# 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" )
225
217
226
218
vm .add_vhost_user_drive (
227
219
"1" , disk_path , is_root_device = True , partuuid = partuuid , is_read_only = True
@@ -238,7 +230,7 @@ def test_partuuid_boot(
238
230
_check_drives (vm , assert_dict , assert_dict .keys ())
239
231
240
232
241
- def test_partuuid_update (microvm_factory , guest_kernel , rootfs_ubuntu_24 ):
233
+ def test_partuuid_update (microvm_factory , guest_kernel , rootfs ):
242
234
"""
243
235
Test successful switching from PARTUUID boot to /dev/vda boot.
244
236
"""
@@ -247,7 +239,7 @@ def test_partuuid_update(microvm_factory, guest_kernel, rootfs_ubuntu_24):
247
239
248
240
# We need to setup ssh keys manually because we did not specify rootfs
249
241
# in microvm_factory.build method
250
- ssh_key = rootfs_ubuntu_24 .with_suffix (".id_rsa" )
242
+ ssh_key = rootfs .with_suffix (".id_rsa" )
251
243
vm .ssh_key = ssh_key
252
244
vm .spawn ()
253
245
vm .basic_config (add_root_device = False )
@@ -256,16 +248,14 @@ def test_partuuid_update(microvm_factory, guest_kernel, rootfs_ubuntu_24):
256
248
# Add the root block device specified through PARTUUID.
257
249
vm .add_vhost_user_drive (
258
250
"rootfs" ,
259
- rootfs_ubuntu_24 ,
251
+ rootfs ,
260
252
is_root_device = True ,
261
253
partuuid = "0eaa91a0-01" ,
262
254
is_read_only = True ,
263
255
)
264
256
265
257
# 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 )
269
259
270
260
vhost_user_block_metrics = FcDeviceMetrics (
271
261
"vhost_user_block" , 1 , aggr_supported = False
0 commit comments