qemu: blockjob: Remove 'disabledBitmapsBase' field from commit job private data

New semantics of the bitmap handling don't need this. Remove the field
and all uses of it including the status XML.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Peter Krempa 2020-05-29 10:52:19 +02:00
parent b5eaabfbf8
commit 057e4bc591
5 changed files with 1 additions and 75 deletions

View File

@ -84,11 +84,6 @@ qemuBlockJobDataDisposeJobdata(qemuBlockJobDataPtr job)
virObjectUnref(job->data.backup.store);
g_free(job->data.backup.bitmap);
}
if (job->type == QEMU_BLOCKJOB_TYPE_COMMIT ||
job->type == QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT) {
virStringListFree(job->data.commit.disabledBitmapsBase);
}
}
@ -290,7 +285,6 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm,
virStorageSourcePtr topparent,
virStorageSourcePtr top,
virStorageSourcePtr base,
char ***disabledBitmapsBase,
bool delete_imgs,
unsigned int jobflags)
{
@ -316,7 +310,6 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm,
job->data.commit.top = top;
job->data.commit.base = base;
job->data.commit.deleteCommittedImages = delete_imgs;
job->data.commit.disabledBitmapsBase = g_steal_pointer(disabledBitmapsBase);
job->jobflags = jobflags;
if (qemuBlockJobRegister(job, vm, disk, true) < 0)
@ -1369,40 +1362,6 @@ qemuBlockJobProcessEventFailedActiveCommit(virQEMUDriverPtr driver,
}
static void
qemuBlockJobProcessEventFailedCommitCommon(virDomainObjPtr vm,
qemuBlockJobDataPtr job,
qemuDomainAsyncJob asyncJob)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
g_autoptr(virJSONValue) actions = virJSONValueNewArray();
char **disabledBitmaps = job->data.commit.disabledBitmapsBase;
if (!disabledBitmaps || !*disabledBitmaps)
return;
for (; *disabledBitmaps; disabledBitmaps++) {
qemuMonitorTransactionBitmapEnable(actions,
job->data.commit.base->nodeformat,
*disabledBitmaps);
}
if (qemuBlockReopenReadWrite(vm, job->data.commit.base, asyncJob) < 0)
return;
if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0)
return;
qemuMonitorTransaction(priv->mon, &actions);
if (qemuDomainObjExitMonitor(priv->driver, vm) < 0)
return;
if (qemuBlockReopenReadOnly(vm, job->data.commit.base, asyncJob) < 0)
return;
}
static void
qemuBlockJobProcessEventConcludedCreate(virQEMUDriverPtr driver,
virDomainObjPtr vm,
@ -1510,8 +1469,6 @@ qemuBlockJobEventProcessConcludedTransition(qemuBlockJobDataPtr job,
case QEMU_BLOCKJOB_TYPE_COMMIT:
if (success)
qemuBlockJobProcessEventCompletedCommit(driver, vm, job, asyncJob);
else
qemuBlockJobProcessEventFailedCommitCommon(vm, job, asyncJob);
break;
case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT:
@ -1519,7 +1476,6 @@ qemuBlockJobEventProcessConcludedTransition(qemuBlockJobDataPtr job,
qemuBlockJobProcessEventCompletedActiveCommit(driver, vm, job, asyncJob);
} else {
qemuBlockJobProcessEventFailedActiveCommit(driver, vm, job);
qemuBlockJobProcessEventFailedCommitCommon(vm, job, asyncJob);
}
break;

View File

@ -88,8 +88,6 @@ struct _qemuBlockJobCommitData {
virStorageSourcePtr top;
virStorageSourcePtr base;
bool deleteCommittedImages;
char **disabledBitmapsBase; /* a NULL-terminated list of bitmap names which
were disabled in @base for the commit job */
};
@ -187,7 +185,6 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm,
virStorageSourcePtr topparent,
virStorageSourcePtr top,
virStorageSourcePtr base,
char ***disabledBitmapsBase,
bool delete_imgs,
unsigned int jobflags);

View File

@ -2623,7 +2623,6 @@ qemuDomainPrivateBlockJobFormatCommit(qemuBlockJobDataPtr job,
virBufferPtr buf)
{
g_auto(virBuffer) disabledBitmapsBuf = VIR_BUFFER_INIT_CHILD(buf);
char **bitmaps = job->data.commit.disabledBitmapsBase;
if (job->data.commit.base)
virBufferAsprintf(buf, "<base node='%s'/>\n", job->data.commit.base->nodeformat);
@ -2637,9 +2636,6 @@ qemuDomainPrivateBlockJobFormatCommit(qemuBlockJobDataPtr job,
if (job->data.commit.deleteCommittedImages)
virBufferAddLit(buf, "<deleteCommittedImages/>\n");
while (bitmaps && *bitmaps)
virBufferEscapeString(&disabledBitmapsBuf, "<bitmap name='%s'/>\n", *(bitmaps++));
virXMLFormatElement(buf, "disabledBaseBitmaps", NULL, &disabledBitmapsBuf);
}
@ -3260,9 +3256,6 @@ static int
qemuDomainObjPrivateXMLParseBlockjobDataCommit(qemuBlockJobDataPtr job,
xmlXPathContextPtr ctxt)
{
g_autofree xmlNodePtr *nodes = NULL;
ssize_t nnodes;
if (job->type == QEMU_BLOCKJOB_TYPE_COMMIT) {
qemuDomainObjPrivateXMLParseBlockjobNodename(job,
"string(./topparent/@node)",
@ -3289,21 +3282,6 @@ qemuDomainObjPrivateXMLParseBlockjobDataCommit(qemuBlockJobDataPtr job,
!job->data.commit.base)
return -1;
if ((nnodes = virXPathNodeSet("./disabledBaseBitmaps/bitmap", ctxt, &nodes)) > 0) {
size_t i;
job->data.commit.disabledBitmapsBase = g_new0(char *, nnodes + 1);
for (i = 0; i < nnodes; i++) {
char *tmp;
if (!(tmp = virXMLPropString(nodes[i], "name")))
return -1;
job->data.commit.disabledBitmapsBase[i] = g_steal_pointer(&tmp);
}
}
return 0;
}

View File

@ -18548,7 +18548,6 @@ qemuDomainBlockCommit(virDomainPtr dom,
const char *nodebase = NULL;
bool persistjob = false;
bool blockdev = false;
VIR_AUTOSTRINGLIST bitmapDisableList = NULL;
virCheckFlags(VIR_DOMAIN_BLOCK_COMMIT_SHALLOW |
VIR_DOMAIN_BLOCK_COMMIT_ACTIVE |
@ -18713,7 +18712,7 @@ qemuDomainBlockCommit(virDomainPtr dom,
}
if (!(job = qemuBlockJobDiskNewCommit(vm, disk, top_parent, topSource,
baseSource, &bitmapDisableList,
baseSource,
flags & VIR_DOMAIN_BLOCK_COMMIT_DELETE,
flags)))
goto endjob;

View File

@ -243,10 +243,6 @@
<base node='libvirt-19-format'/>
<top node='libvirt-17-format'/>
<deleteCommittedImages/>
<disabledBaseBitmaps>
<bitmap name='test'/>
<bitmap name='test1'/>
</disabledBaseBitmaps>
</blockjob>
<blockjob name='create-libvirt-1337-storage' type='create' state='running'>
<create mode='storage'/>