diff options
author | Gonglei <arei.gonglei@huawei.com> | 2014-10-07 16:00:35 +0800 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2014-10-15 10:45:51 +0200 |
commit | d2b186f96d19c1f8a6b7e528ff32c24096d5b204 (patch) | |
tree | 374ba75e25297bf22c16921a8b0b40d12fd1ce6b /hw/ide | |
parent | 33739c712982929a7763f0ae42a0a9c3b3f21796 (diff) |
ide: add calling add_boot_device_patch in bootindex setter function
On this way, we can assure the new bootindex take effect
during vm rebooting. Meanwhile set the initial value of
bootindex to -1.
Because ide devcies's unit property maybe
do not initialize when set_bootindex function is called,
so that we don't know its suffix. So we have to save the
call add_boot_device_path() on ide realize/init function.
When we want to change bootindex during vm rebooting, we
can call it in setter function.
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/ide')
-rw-r--r-- | hw/ide/qdev.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 7e6902073e..9814ef0d24 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -219,6 +219,10 @@ static void ide_dev_set_bootindex(Object *obj, Visitor *v, void *opaque, /* change bootindex to a new one */ d->conf.bootindex = boot_index; + if (d->unit != -1) { + add_boot_device_path(d->conf.bootindex, &d->qdev, + d->unit ? "/disk@1" : "/disk@0"); + } out: if (local_err) { error_propagate(errp, local_err); @@ -230,6 +234,7 @@ static void ide_dev_instance_init(Object *obj) object_property_add(obj, "bootindex", "int32", ide_dev_get_bootindex, ide_dev_set_bootindex, NULL, NULL, NULL); + object_property_set_int(obj, -1, "bootindex", NULL); } static int ide_hd_initfn(IDEDevice *dev) |