Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15
qemu-linux-user.15022
0072-xen-add-xen-disk-naming-for-use-in-.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0072-xen-add-xen-disk-naming-for-use-in-.patch of Package qemu-linux-user.15022
From dae0a97be51cd40900f5298dd5aadae32307a0a8 Mon Sep 17 00:00:00 2001 From: Bruce Rogers <brogers@suse.com> Date: Fri, 8 Jun 2018 11:04:36 -0600 Subject: [PATCH] xen: add xen disk naming for use in monitor Provide monitor naming of xen disks, including associating an attached dev_id for a BlockBackend which has legacy_dev set. Currently, only xen disks have legacy_dev set to true. [BR: FATE#325467, BSC#1094725] Signed-off-by: Bruce Rogers <brogers@suse.com> --- block/block-backend.c | 5 ++++- hw/block/xen_disk.c | 15 +++++++++++++++ include/hw/xen/xen.h | 2 ++ stubs/xen-common.c | 5 +++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/block/block-backend.c b/block/block-backend.c index baef8e7abc..5288b67914 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -21,6 +21,7 @@ #include "qemu/id.h" #include "trace.h" #include "migration/misc.h" +#include "hw/xen/xen.h" /* Number of coroutines to reserve per attached device model */ #define COROUTINE_POOL_RESERVATION 64 @@ -842,7 +843,9 @@ char *blk_get_attached_dev_id(BlockBackend *blk) { DeviceState *dev; - assert(!blk->legacy_dev); + if (blk->legacy_dev) { + return xen_blk_get_attached_dev_id(blk->dev); + } dev = blk->dev; if (!dev) { diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c index dceee88a78..67f8464f6a 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@ -1073,6 +1073,7 @@ static int blk_connect(struct XenDevice *xendev) unsigned int ring_size, max_grants; unsigned int i; uint32_t *domids; + Error *errp = NULL; /* read-only ? */ if (blkdev->directiosafe) { @@ -1130,6 +1131,13 @@ static int blk_connect(struct XenDevice *xendev) blk_ref(blkdev->blk); } blk_attach_dev_legacy(blkdev->blk, blkdev); + if (!monitor_add_blk(blkdev->blk, g_strdup(blkdev->dev), &errp)) { + xen_pv_printf(&blkdev->xendev, 0, "error: %s\n", + error_get_pretty(errp)); + error_free(errp); + return -1; + } + blkdev->file_size = blk_getlength(blkdev->blk); if (blkdev->file_size < 0) { BlockDriverState *bs = blk_bs(blkdev->blk); @@ -1317,6 +1325,7 @@ static void blk_disconnect(struct XenDevice *xendev) if (blkdev->blk) { blk_detach_dev(blkdev->blk, blkdev); + monitor_remove_blk(blkdev->blk); blk_unref(blkdev->blk); blkdev->blk = NULL; } @@ -1385,6 +1394,12 @@ static void blk_event(struct XenDevice *xendev) qemu_bh_schedule(blkdev->bh); } +char *xen_blk_get_attached_dev_id(void *dev) +{ + struct XenBlkDev *blkdev = dev; + return g_strdup_printf("xen-qdisk-%i", blkdev->xendev.dev); +} + struct XenDevOps xen_blkdev_ops = { .size = sizeof(struct XenBlkDev), .alloc = blk_alloc, diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h index 7efcdaa8fe..a201517675 100644 --- a/include/hw/xen/xen.h +++ b/include/hw/xen/xen.h @@ -48,4 +48,6 @@ void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length); void xen_register_framebuffer(struct MemoryRegion *mr); +char *xen_blk_get_attached_dev_id(void *dev); + #endif /* QEMU_HW_XEN_H */ diff --git a/stubs/xen-common.c b/stubs/xen-common.c index 09fce2dd36..aeac0534ac 100644 --- a/stubs/xen-common.c +++ b/stubs/xen-common.c @@ -12,3 +12,8 @@ void xenstore_store_pv_console_info(int i, Chardev *chr) { } + +char *xen_blk_get_attached_dev_id(void *dev) +{ + return g_strdup(""); +}
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor