#include "libqos/pci-pc.h"
#include "qemu-common.h"
+#include "qapi/qmp/qdict.h"
#include "qemu/host-utils.h"
#include "hw/pci/pci_ids.h"
{
AHCIQState *s;
- s = g_malloc0(sizeof(AHCIQState));
+ s = g_new0(AHCIQState, 1);
s->parent = qtest_pc_vboot(cli, ap);
+ global_qtest = s->parent->qts;
alloc_set_flags(s->parent->alloc, ALLOC_LEAK_ASSERT);
/* Verify that we have an AHCI device present. */
- s->dev = get_ahci_device(&s->fingerprint);
+ s->dev = get_ahci_device(s->parent->qts, &s->fingerprint);
return s;
}
AHCIQState *src, *dst;
char *uri = g_strdup_printf("unix:%s", mig_socket);
- src = ahci_boot("-m 1024 -M q35 "
+ src = ahci_boot("-m 384 -M q35 "
"-drive if=ide,file=%s,format=%s ", tmp_path, imgfmt);
- dst = ahci_boot("-m 1024 -M q35 "
+ dst = ahci_boot("-m 384 -M q35 "
"-drive if=ide,file=%s,format=%s "
"-incoming %s", tmp_path, imgfmt, uri);
unsigned char *rx = g_malloc0(bufsize);
char *uri = g_strdup_printf("unix:%s", mig_socket);
- src = ahci_boot_and_enable("-m 1024 -M q35 "
+ src = ahci_boot_and_enable("-m 384 -M q35 "
"-drive if=ide,format=%s,file=%s ",
imgfmt, tmp_path);
- dst = ahci_boot("-m 1024 -M q35 "
+ dst = ahci_boot("-m 384 -M q35 "
"-drive if=ide,format=%s,file=%s "
"-incoming %s", imgfmt, tmp_path, uri);
QDict *rsp;
fd = prepare_iso(iso_size, &tx, &iso);
- ahci = ahci_boot_and_enable("-drive if=none,id=drive0,file=%s,format=raw "
+ ahci = ahci_boot_and_enable("-blockdev node-name=drive0,driver=file,filename=%s "
"-M q35 "
- "-device ide-cd,drive=drive0 ", iso);
+ "-device ide-cd,id=cd0,drive=drive0 ", iso);
port = ahci_port_select(ahci);
ahci_atapi_eject(ahci, port);
/* Remove media */
qmp_async("{'execute': 'blockdev-open-tray', "
- "'arguments': {'device': 'drive0'}}");
+ "'arguments': {'id': 'cd0'}}");
atapi_wait_tray(true);
rsp = qmp_receive();
QDECREF(rsp);
- qmp_discard_response("{'execute': 'x-blockdev-remove-medium', "
- "'arguments': {'device': 'drive0'}}");
+ qmp_discard_response("{'execute': 'blockdev-remove-medium', "
+ "'arguments': {'id': 'cd0'}}");
/* Test the tray without a medium */
ahci_atapi_load(ahci, port);
"'driver': 'raw', "
"'file': { 'driver': 'file', "
"'filename': %s }}}", iso);
- qmp_discard_response("{'execute': 'x-blockdev-insert-medium',"
- "'arguments': { 'device': 'drive0', "
+ qmp_discard_response("{'execute': 'blockdev-insert-medium',"
+ "'arguments': { 'id': 'cd0', "
"'node-name': 'node0' }}");
/* Again, the event shows up first */
qmp_async("{'execute': 'blockdev-close-tray', "
- "'arguments': {'device': 'drive0'}}");
+ "'arguments': {'id': 'cd0'}}");
atapi_wait_tray(false);
rsp = qmp_receive();
QDECREF(rsp);
char *name;
AHCIIOTestOptions *opts;
- opts = g_malloc(sizeof(AHCIIOTestOptions));
+ opts = g_new(AHCIIOTestOptions, 1);
opts->length = len;
opts->address_type = addr;
opts->io_type = type;
if ((addr == ADDR_MODE_LBA48) && (offset == OFFSET_HIGH) &&
(mb_to_sectors(test_image_size_mb) <= 0xFFFFFFF)) {
g_test_message("%s: skipped; test image too small", name);
+ g_free(opts);
g_free(name);
return;
}