@@ -49,6 +49,7 @@ static char tmp_path[] = "/tmp/qtest.XXXXXX";
49
49
static char debug_path [] = "/tmp/qtest-blkdebug.XXXXXX" ;
50
50
static char mig_socket [] = "/tmp/qtest-migration.XXXXXX" ;
51
51
static bool ahci_pedantic ;
52
+ static const char * imgfmt ;
52
53
53
54
/*** Function Declarations ***/
54
55
static void ahci_test_port_spec (AHCIQState * ahci , uint8_t port );
@@ -175,11 +176,11 @@ static AHCIQState *ahci_boot(const char *cli, ...)
175
176
va_end (ap );
176
177
} else {
177
178
cli = "-drive if=none,id=drive0,file=%s,cache=writeback,serial=%s"
178
- ",format=qcow2 "
179
+ ",format=%s "
179
180
" -M q35 "
180
181
"-device ide-hd,drive=drive0 "
181
182
"-global ide-hd.ver=%s" ;
182
- s = ahci_boot (cli , tmp_path , "testdisk" , "version" );
183
+ s = ahci_boot (cli , tmp_path , "testdisk" , imgfmt , "version" );
183
184
}
184
185
185
186
return s ;
@@ -1078,12 +1079,12 @@ static void test_flush_retry(void)
1078
1079
1079
1080
prepare_blkdebug_script (debug_path , "flush_to_disk" );
1080
1081
ahci = ahci_boot_and_enable ("-drive file=blkdebug:%s:%s,if=none,id=drive0,"
1081
- "format=qcow2 ,cache=writeback,"
1082
+ "format=%s ,cache=writeback,"
1082
1083
"rerror=stop,werror=stop "
1083
1084
"-M q35 "
1084
1085
"-device ide-hd,drive=drive0 " ,
1085
1086
debug_path ,
1086
- tmp_path );
1087
+ tmp_path , imgfmt );
1087
1088
1088
1089
/* Issue Flush Command and wait for error */
1089
1090
port = ahci_port_select (ahci );
@@ -1113,10 +1114,10 @@ static void test_migrate_sanity(void)
1113
1114
char * uri = g_strdup_printf ("unix:%s" , mig_socket );
1114
1115
1115
1116
src = ahci_boot ("-m 1024 -M q35 "
1116
- "-hda %s " , tmp_path );
1117
+ "-drive if=ide,file=%s,format=%s " , tmp_path , imgfmt );
1117
1118
dst = ahci_boot ("-m 1024 -M q35 "
1118
- "-hda %s "
1119
- "-incoming %s" , tmp_path , uri );
1119
+ "-drive if=ide,file=%s,format= %s "
1120
+ "-incoming %s" , tmp_path , imgfmt , uri );
1120
1121
1121
1122
ahci_migrate (src , dst , uri );
1122
1123
@@ -1138,10 +1139,11 @@ static void ahci_migrate_simple(uint8_t cmd_read, uint8_t cmd_write)
1138
1139
char * uri = g_strdup_printf ("unix:%s" , mig_socket );
1139
1140
1140
1141
src = ahci_boot_and_enable ("-m 1024 -M q35 "
1141
- "-hda %s " , tmp_path );
1142
+ "-drive if=ide,format=%s,file=%s " ,
1143
+ imgfmt , tmp_path );
1142
1144
dst = ahci_boot ("-m 1024 -M q35 "
1143
- "-hda %s "
1144
- "-incoming %s" , tmp_path , uri );
1145
+ "-drive if=ide,format=%s,file= %s "
1146
+ "-incoming %s" , imgfmt , tmp_path , uri );
1145
1147
1146
1148
set_context (src -> parent );
1147
1149
@@ -1197,12 +1199,12 @@ static void ahci_halted_io_test(uint8_t cmd_read, uint8_t cmd_write)
1197
1199
prepare_blkdebug_script (debug_path , "write_aio" );
1198
1200
1199
1201
ahci = ahci_boot_and_enable ("-drive file=blkdebug:%s:%s,if=none,id=drive0,"
1200
- "format=qcow2 ,cache=writeback,"
1202
+ "format=%s ,cache=writeback,"
1201
1203
"rerror=stop,werror=stop "
1202
1204
"-M q35 "
1203
1205
"-device ide-hd,drive=drive0 " ,
1204
1206
debug_path ,
1205
- tmp_path );
1207
+ tmp_path , imgfmt );
1206
1208
1207
1209
/* Initialize and prepare */
1208
1210
port = ahci_port_select (ahci );
@@ -1263,20 +1265,20 @@ static void ahci_migrate_halted_io(uint8_t cmd_read, uint8_t cmd_write)
1263
1265
prepare_blkdebug_script (debug_path , "write_aio" );
1264
1266
1265
1267
src = ahci_boot_and_enable ("-drive file=blkdebug:%s:%s,if=none,id=drive0,"
1266
- "format=qcow2 ,cache=writeback,"
1268
+ "format=%s ,cache=writeback,"
1267
1269
"rerror=stop,werror=stop "
1268
1270
"-M q35 "
1269
1271
"-device ide-hd,drive=drive0 " ,
1270
1272
debug_path ,
1271
- tmp_path );
1273
+ tmp_path , imgfmt );
1272
1274
1273
1275
dst = ahci_boot ("-drive file=%s,if=none,id=drive0,"
1274
- "format=qcow2 ,cache=writeback,"
1276
+ "format=%s ,cache=writeback,"
1275
1277
"rerror=stop,werror=stop "
1276
1278
"-M q35 "
1277
1279
"-device ide-hd,drive=drive0 "
1278
1280
"-incoming %s" ,
1279
- tmp_path , uri );
1281
+ tmp_path , imgfmt , uri );
1280
1282
1281
1283
set_context (src -> parent );
1282
1284
@@ -1335,15 +1337,17 @@ static void test_flush_migrate(void)
1335
1337
prepare_blkdebug_script (debug_path , "flush_to_disk" );
1336
1338
1337
1339
src = ahci_boot_and_enable ("-drive file=blkdebug:%s:%s,if=none,id=drive0,"
1338
- "cache=writeback,rerror=stop,werror=stop "
1340
+ "cache=writeback,rerror=stop,werror=stop,"
1341
+ "format=%s "
1339
1342
"-M q35 "
1340
1343
"-device ide-hd,drive=drive0 " ,
1341
- debug_path , tmp_path );
1344
+ debug_path , tmp_path , imgfmt );
1342
1345
dst = ahci_boot ("-drive file=%s,if=none,id=drive0,"
1343
- "cache=writeback,rerror=stop,werror=stop "
1346
+ "cache=writeback,rerror=stop,werror=stop,"
1347
+ "format=%s "
1344
1348
"-M q35 "
1345
1349
"-device ide-hd,drive=drive0 "
1346
- "-incoming %s" , tmp_path , uri );
1350
+ "-incoming %s" , tmp_path , imgfmt , uri );
1347
1351
1348
1352
set_context (src -> parent );
1349
1353
@@ -1626,9 +1630,12 @@ int main(int argc, char **argv)
1626
1630
return 0 ;
1627
1631
}
1628
1632
1629
- /* Create a temporary qcow2 image */
1630
- close (mkstemp (tmp_path ));
1633
+ /* Create a temporary image */
1634
+ fd = mkstemp (tmp_path );
1635
+ g_assert (fd >= 0 );
1636
+ imgfmt = "qcow2" ;
1631
1637
mkqcow2 (tmp_path , TEST_IMAGE_SIZE_MB );
1638
+ close (fd );
1632
1639
1633
1640
/* Create temporary blkdebug instructions */
1634
1641
fd = mkstemp (debug_path );
0 commit comments