bootindex: move calling add_boot_device_patch to bootindex setter function
On this way, we can assure the new bootindex take effect during vm rebooting. Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
d2b186f96d
commit
d749e10c4f
@ -212,6 +212,8 @@ static void device_set_bootindex(Object *obj, Visitor *v, void *opaque,
|
||||
/* change bootindex to a new one */
|
||||
*prop->bootindex = boot_index;
|
||||
|
||||
add_boot_device_path(*prop->bootindex, prop->dev, prop->suffix);
|
||||
|
||||
out:
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
|
@ -2216,9 +2216,6 @@ static void isabus_fdc_realize(DeviceState *dev, Error **errp)
|
||||
error_propagate(errp, err);
|
||||
return;
|
||||
}
|
||||
|
||||
add_boot_device_path(isa->bootindexA, dev, "/floppy@0");
|
||||
add_boot_device_path(isa->bootindexB, dev, "/floppy@1");
|
||||
}
|
||||
|
||||
static void sysbus_fdc_initfn(Object *obj)
|
||||
|
@ -768,8 +768,6 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp)
|
||||
bdrv_set_guest_block_size(s->bs, s->conf->logical_block_size);
|
||||
|
||||
bdrv_iostatus_enable(s->bs);
|
||||
|
||||
add_boot_device_path(s->conf->bootindex, dev, "/disk@0,0");
|
||||
}
|
||||
|
||||
static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp)
|
||||
|
@ -1825,8 +1825,6 @@ static int assigned_initfn(struct PCIDevice *pci_dev)
|
||||
|
||||
assigned_dev_load_option_rom(dev);
|
||||
|
||||
add_boot_device_path(dev->bootindex, &pci_dev->qdev, NULL);
|
||||
|
||||
return 0;
|
||||
|
||||
assigned_out:
|
||||
|
@ -4296,7 +4296,6 @@ static int vfio_initfn(PCIDevice *pdev)
|
||||
}
|
||||
}
|
||||
|
||||
add_boot_device_path(vdev->bootindex, &pdev->qdev, NULL);
|
||||
vfio_register_err_notifier(vdev);
|
||||
|
||||
return 0;
|
||||
|
@ -1569,8 +1569,6 @@ static int pci_e1000_init(PCIDevice *pci_dev)
|
||||
|
||||
qemu_format_nic_info_str(qemu_get_queue(d->nic), macaddr);
|
||||
|
||||
add_boot_device_path(d->conf.bootindex, dev, "/ethernet-phy@0");
|
||||
|
||||
d->autoneg_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, e1000_autoneg_timer, d);
|
||||
d->mit_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, e1000_mit_timer, d);
|
||||
|
||||
|
@ -1901,8 +1901,6 @@ static int e100_nic_init(PCIDevice *pci_dev)
|
||||
s->vmstate->name = qemu_get_queue(s->nic)->model;
|
||||
vmstate_register(&pci_dev->qdev, -1, s->vmstate, s);
|
||||
|
||||
add_boot_device_path(s->conf.bootindex, &pci_dev->qdev, "/ethernet-phy@0");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -738,8 +738,6 @@ static int pci_ne2000_init(PCIDevice *pci_dev)
|
||||
object_get_typename(OBJECT(pci_dev)), pci_dev->qdev.id, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->c.macaddr.a);
|
||||
|
||||
add_boot_device_path(s->c.bootindex, &pci_dev->qdev, "/ethernet-phy@0");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1735,8 +1735,6 @@ int pcnet_common_init(DeviceState *dev, PCNetState *s, NetClientInfo *info)
|
||||
s->nic = qemu_new_nic(info, &s->conf, object_get_typename(OBJECT(dev)), dev->id, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
|
||||
add_boot_device_path(s->conf.bootindex, dev, "/ethernet-phy@0");
|
||||
|
||||
/* Initialize the PROM */
|
||||
|
||||
/*
|
||||
|
@ -3538,8 +3538,6 @@ static int pci_rtl8139_init(PCIDevice *dev)
|
||||
s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, rtl8139_timer, s);
|
||||
rtl8139_set_next_tctr_time(s, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL));
|
||||
|
||||
add_boot_device_path(s->conf.bootindex, d, "/ethernet-phy@0");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -221,8 +221,6 @@ static int spapr_vlan_init(VIOsPAPRDevice *sdev)
|
||||
object_get_typename(OBJECT(sdev)), sdev->qdev.id, dev);
|
||||
qemu_format_nic_info_str(qemu_get_queue(dev->nic), dev->nicconf.macaddr.a);
|
||||
|
||||
add_boot_device_path(dev->nicconf.bootindex, DEVICE(dev), "");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1661,8 +1661,6 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp)
|
||||
n->qdev = dev;
|
||||
register_savevm(dev, "virtio-net", -1, VIRTIO_NET_VM_VERSION,
|
||||
virtio_net_save, virtio_net_load, n);
|
||||
|
||||
add_boot_device_path(n->nic_conf.bootindex, dev, "/ethernet-phy@0");
|
||||
}
|
||||
|
||||
static void virtio_net_device_unrealize(DeviceState *dev, Error **errp)
|
||||
|
@ -2172,8 +2172,6 @@ static int vmxnet3_pci_init(PCIDevice *pci_dev)
|
||||
register_savevm(dev, "vmxnet3-msix", -1, 1,
|
||||
vmxnet3_msix_save, vmxnet3_msix_load, s);
|
||||
|
||||
add_boot_device_path(s->conf.bootindex, dev, "/ethernet-phy@0");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2269,7 +2269,6 @@ static void scsi_realize(SCSIDevice *dev, Error **errp)
|
||||
bdrv_set_guest_block_size(s->qdev.conf.bs, s->qdev.blocksize);
|
||||
|
||||
bdrv_iostatus_enable(s->qdev.conf.bs);
|
||||
add_boot_device_path(s->qdev.conf.bootindex, &dev->qdev, NULL);
|
||||
}
|
||||
|
||||
static void scsi_hd_realize(SCSIDevice *dev, Error **errp)
|
||||
|
@ -413,9 +413,6 @@ static void scsi_generic_realize(SCSIDevice *s, Error **errp)
|
||||
/* define device state */
|
||||
s->type = scsiid.scsi_type;
|
||||
DPRINTF("device type %d\n", s->type);
|
||||
if (s->type == TYPE_DISK || s->type == TYPE_ROM) {
|
||||
add_boot_device_path(s->conf.bootindex, &s->qdev, NULL);
|
||||
}
|
||||
|
||||
switch (s->type) {
|
||||
case TYPE_TAPE:
|
||||
|
@ -1371,8 +1371,6 @@ static void usb_net_realize(USBDevice *dev, Error **errrp)
|
||||
s->conf.macaddr.a[4],
|
||||
s->conf.macaddr.a[5]);
|
||||
usb_desc_set_string(dev, STRING_ETHADDR, s->usbstring_mac);
|
||||
|
||||
add_boot_device_path(s->conf.bootindex, &dev->qdev, "/ethernet@0");
|
||||
}
|
||||
|
||||
static void usb_net_instance_init(Object *obj)
|
||||
|
@ -978,7 +978,6 @@ static void usb_host_realize(USBDevice *udev, Error **errp)
|
||||
qemu_add_exit_notifier(&s->exit);
|
||||
|
||||
QTAILQ_INSERT_TAIL(&hostdevs, s, next);
|
||||
add_boot_device_path(s->bootindex, &udev->qdev, NULL);
|
||||
usb_host_auto_check(NULL);
|
||||
}
|
||||
|
||||
|
@ -1401,7 +1401,6 @@ static void usbredir_realize(USBDevice *udev, Error **errp)
|
||||
usbredir_chardev_read, usbredir_chardev_event, dev);
|
||||
|
||||
qemu_add_vm_change_state_handler(usbredir_vm_state_change, dev);
|
||||
add_boot_device_path(dev->bootindex, &udev->qdev, NULL);
|
||||
}
|
||||
|
||||
static void usbredir_cleanup_device_queues(USBRedirDevice *dev)
|
||||
|
Loading…
Reference in New Issue
Block a user