mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-03 17:47:15 +03:00
qemuBlockStorageSourceChainData: Add handling of 'copy-on-read' filter layer
qemuBlockStorageSourceChainData encapsulates the backend of the disk for startup and hotplug operations. Add the handling for the copy-on-read filter so that the hotplug code doesn't need to have separate cleanup. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
02f843e70a
commit
0ad33f48c5
@ -1947,6 +1947,9 @@ qemuBlockStorageSourceChainDataFree(qemuBlockStorageSourceChainData *data)
|
||||
for (i = 0; i < data->nsrcdata; i++)
|
||||
qemuBlockStorageSourceAttachDataFree(data->srcdata[i]);
|
||||
|
||||
virJSONValueFree(data->copyOnReadProps);
|
||||
g_free(data->copyOnReadNodename);
|
||||
|
||||
g_free(data->srcdata);
|
||||
g_free(data);
|
||||
}
|
||||
@ -2054,6 +2057,11 @@ qemuBlockStorageSourceChainAttach(qemuMonitor *mon,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (data->copyOnReadProps) {
|
||||
if (qemuMonitorBlockdevAdd(mon, &data->copyOnReadProps) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2072,6 +2080,10 @@ qemuBlockStorageSourceChainDetach(qemuMonitor *mon,
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (data->copyOnReadAttached)
|
||||
ignore_value(qemuMonitorBlockdevDel(mon, data->copyOnReadNodename));
|
||||
|
||||
|
||||
for (i = 0; i < data->nsrcdata; i++)
|
||||
qemuBlockStorageSourceAttachRollback(mon, data->srcdata[i]);
|
||||
}
|
||||
|
@ -150,6 +150,10 @@ qemuBlockStorageSourceDetachOneBlockdev(virQEMUDriver *driver,
|
||||
struct _qemuBlockStorageSourceChainData {
|
||||
qemuBlockStorageSourceAttachData **srcdata;
|
||||
size_t nsrcdata;
|
||||
|
||||
virJSONValue *copyOnReadProps;
|
||||
char *copyOnReadNodename;
|
||||
bool copyOnReadAttached;
|
||||
};
|
||||
|
||||
typedef struct _qemuBlockStorageSourceChainData qemuBlockStorageSourceChainData;
|
||||
|
Loading…
x
Reference in New Issue
Block a user