mirror of https://github.com/proxmox/mirror_qemu
xen: handle backend deletion from xenstore
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>master
parent
9468e9c41a
commit
77ba8fef89
|
@ -592,7 +592,7 @@ static void xenstore_update_be(char *watch, char *type, int dom,
|
||||||
struct XenDevOps *ops)
|
struct XenDevOps *ops)
|
||||||
{
|
{
|
||||||
struct XenDevice *xendev;
|
struct XenDevice *xendev;
|
||||||
char path[XEN_BUFSIZE], *dom0;
|
char path[XEN_BUFSIZE], *dom0, *bepath;
|
||||||
unsigned int len, dev;
|
unsigned int len, dev;
|
||||||
|
|
||||||
dom0 = xs_get_domain_path(xenstore, 0);
|
dom0 = xs_get_domain_path(xenstore, 0);
|
||||||
|
@ -611,15 +611,16 @@ static void xenstore_update_be(char *watch, char *type, int dom,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0) {
|
|
||||||
/* FIXME: detect devices being deleted from xenstore ... */
|
|
||||||
xen_be_del_xendev(dom, dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
xendev = xen_be_get_xendev(type, dom, dev, ops);
|
xendev = xen_be_get_xendev(type, dom, dev, ops);
|
||||||
if (xendev != NULL) {
|
if (xendev != NULL) {
|
||||||
xen_be_backend_changed(xendev, path);
|
bepath = xs_read(xenstore, 0, xendev->be, &len);
|
||||||
xen_be_check_state(xendev);
|
if (bepath == NULL) {
|
||||||
|
xen_be_del_xendev(dom, dev);
|
||||||
|
} else {
|
||||||
|
free(bepath);
|
||||||
|
xen_be_backend_changed(xendev, path);
|
||||||
|
xen_be_check_state(xendev);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -745,6 +745,10 @@ static int blk_free(struct XenDevice *xendev)
|
||||||
struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev);
|
struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev);
|
||||||
struct ioreq *ioreq;
|
struct ioreq *ioreq;
|
||||||
|
|
||||||
|
if (blkdev->bs || blkdev->sring) {
|
||||||
|
blk_disconnect(xendev);
|
||||||
|
}
|
||||||
|
|
||||||
while (!QLIST_EMPTY(&blkdev->freelist)) {
|
while (!QLIST_EMPTY(&blkdev->freelist)) {
|
||||||
ioreq = QLIST_FIRST(&blkdev->freelist);
|
ioreq = QLIST_FIRST(&blkdev->freelist);
|
||||||
QLIST_REMOVE(ioreq, list);
|
QLIST_REMOVE(ioreq, list);
|
||||||
|
|
Loading…
Reference in New Issue