hw/virtio/virtio-balloon: move adding property to virtio_balloon_instance_init
This is in preparation for using alias property in virtio-balloon-pci and virtio-balloon-ccw. Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
97af820f53
commit
1190044ea5
@ -396,14 +396,6 @@ static void virtio_balloon_device_realize(DeviceState *dev, Error **errp)
|
|||||||
|
|
||||||
register_savevm(dev, "virtio-balloon", -1, 1,
|
register_savevm(dev, "virtio-balloon", -1, 1,
|
||||||
virtio_balloon_save, virtio_balloon_load, s);
|
virtio_balloon_save, virtio_balloon_load, s);
|
||||||
|
|
||||||
object_property_add(OBJECT(dev), "guest-stats", "guest statistics",
|
|
||||||
balloon_stats_get_all, NULL, NULL, s, NULL);
|
|
||||||
|
|
||||||
object_property_add(OBJECT(dev), "guest-stats-polling-interval", "int",
|
|
||||||
balloon_stats_get_poll_interval,
|
|
||||||
balloon_stats_set_poll_interval,
|
|
||||||
NULL, s, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void virtio_balloon_device_unrealize(DeviceState *dev, Error **errp)
|
static void virtio_balloon_device_unrealize(DeviceState *dev, Error **errp)
|
||||||
@ -417,6 +409,19 @@ static void virtio_balloon_device_unrealize(DeviceState *dev, Error **errp)
|
|||||||
virtio_cleanup(vdev);
|
virtio_cleanup(vdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void virtio_balloon_instance_init(Object *obj)
|
||||||
|
{
|
||||||
|
VirtIOBalloon *s = VIRTIO_BALLOON(obj);
|
||||||
|
|
||||||
|
object_property_add(obj, "guest-stats", "guest statistics",
|
||||||
|
balloon_stats_get_all, NULL, NULL, s, NULL);
|
||||||
|
|
||||||
|
object_property_add(obj, "guest-stats-polling-interval", "int",
|
||||||
|
balloon_stats_get_poll_interval,
|
||||||
|
balloon_stats_set_poll_interval,
|
||||||
|
NULL, s, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static Property virtio_balloon_properties[] = {
|
static Property virtio_balloon_properties[] = {
|
||||||
DEFINE_PROP_END_OF_LIST(),
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
};
|
};
|
||||||
@ -441,6 +446,7 @@ static const TypeInfo virtio_balloon_info = {
|
|||||||
.name = TYPE_VIRTIO_BALLOON,
|
.name = TYPE_VIRTIO_BALLOON,
|
||||||
.parent = TYPE_VIRTIO_DEVICE,
|
.parent = TYPE_VIRTIO_DEVICE,
|
||||||
.instance_size = sizeof(VirtIOBalloon),
|
.instance_size = sizeof(VirtIOBalloon),
|
||||||
|
.instance_init = virtio_balloon_instance_init,
|
||||||
.class_init = virtio_balloon_class_init,
|
.class_init = virtio_balloon_class_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user