mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 01:34:11 +03:00
snapshot: Drop pointless function virDomainMomentIsCurrentName
The qemu driver already had a full-blown virDomainMomentObjPtr to
check against, and the test driver ought to have one since we get
better error checking that the user passed in a valid object. Removes
the need for a helper function added in commit commit 4819f54b
.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
0bc965342b
commit
3d7c683a27
@ -409,15 +409,6 @@ virDomainMomentGetCurrentName(virDomainMomentObjListPtr moments)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Return true if name matches the current moment */
|
|
||||||
bool
|
|
||||||
virDomainMomentIsCurrentName(virDomainMomentObjListPtr moments,
|
|
||||||
const char *name)
|
|
||||||
{
|
|
||||||
return moments->current && STREQ(moments->current->def->name, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Update the current moment, using NULL if no current remains */
|
/* Update the current moment, using NULL if no current remains */
|
||||||
void
|
void
|
||||||
virDomainMomentSetCurrent(virDomainMomentObjListPtr moments,
|
virDomainMomentSetCurrent(virDomainMomentObjListPtr moments,
|
||||||
|
@ -109,8 +109,6 @@ virDomainMomentObjPtr virDomainMomentFindByName(virDomainMomentObjListPtr moment
|
|||||||
int virDomainMomentObjListSize(virDomainMomentObjListPtr moments);
|
int virDomainMomentObjListSize(virDomainMomentObjListPtr moments);
|
||||||
virDomainMomentObjPtr virDomainMomentGetCurrent(virDomainMomentObjListPtr moments);
|
virDomainMomentObjPtr virDomainMomentGetCurrent(virDomainMomentObjListPtr moments);
|
||||||
const char *virDomainMomentGetCurrentName(virDomainMomentObjListPtr moments);
|
const char *virDomainMomentGetCurrentName(virDomainMomentObjListPtr moments);
|
||||||
bool virDomainMomentIsCurrentName(virDomainMomentObjListPtr moments,
|
|
||||||
const char *name);
|
|
||||||
void virDomainMomentSetCurrent(virDomainMomentObjListPtr moments,
|
void virDomainMomentSetCurrent(virDomainMomentObjListPtr moments,
|
||||||
virDomainMomentObjPtr moment);
|
virDomainMomentObjPtr moment);
|
||||||
bool virDomainMomentObjListRemove(virDomainMomentObjListPtr moments,
|
bool virDomainMomentObjListRemove(virDomainMomentObjListPtr moments,
|
||||||
|
@ -187,15 +187,6 @@ virDomainSnapshotGetCurrentName(virDomainSnapshotObjListPtr snapshots)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Return true if name matches the current snapshot */
|
|
||||||
bool
|
|
||||||
virDomainSnapshotIsCurrentName(virDomainSnapshotObjListPtr snapshots,
|
|
||||||
const char *name)
|
|
||||||
{
|
|
||||||
return virDomainMomentIsCurrentName(snapshots->base, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Update the current snapshot, using NULL if no current remains */
|
/* Update the current snapshot, using NULL if no current remains */
|
||||||
void
|
void
|
||||||
virDomainSnapshotSetCurrent(virDomainSnapshotObjListPtr snapshots,
|
virDomainSnapshotSetCurrent(virDomainSnapshotObjListPtr snapshots,
|
||||||
|
@ -44,8 +44,6 @@ virDomainMomentObjPtr virDomainSnapshotFindByName(virDomainSnapshotObjListPtr sn
|
|||||||
const char *name);
|
const char *name);
|
||||||
virDomainMomentObjPtr virDomainSnapshotGetCurrent(virDomainSnapshotObjListPtr snapshots);
|
virDomainMomentObjPtr virDomainSnapshotGetCurrent(virDomainSnapshotObjListPtr snapshots);
|
||||||
const char *virDomainSnapshotGetCurrentName(virDomainSnapshotObjListPtr snapshots);
|
const char *virDomainSnapshotGetCurrentName(virDomainSnapshotObjListPtr snapshots);
|
||||||
bool virDomainSnapshotIsCurrentName(virDomainSnapshotObjListPtr snapshots,
|
|
||||||
const char *name);
|
|
||||||
void virDomainSnapshotSetCurrent(virDomainSnapshotObjListPtr snapshots,
|
void virDomainSnapshotSetCurrent(virDomainSnapshotObjListPtr snapshots,
|
||||||
virDomainMomentObjPtr snapshot);
|
virDomainMomentObjPtr snapshot);
|
||||||
bool virDomainSnapshotObjListRemove(virDomainSnapshotObjListPtr snapshots,
|
bool virDomainSnapshotObjListRemove(virDomainSnapshotObjListPtr snapshots,
|
||||||
|
@ -995,7 +995,6 @@ virDomainSnapshotFindByName;
|
|||||||
virDomainSnapshotForEach;
|
virDomainSnapshotForEach;
|
||||||
virDomainSnapshotGetCurrent;
|
virDomainSnapshotGetCurrent;
|
||||||
virDomainSnapshotGetCurrentName;
|
virDomainSnapshotGetCurrentName;
|
||||||
virDomainSnapshotIsCurrentName;
|
|
||||||
virDomainSnapshotObjListFree;
|
virDomainSnapshotObjListFree;
|
||||||
virDomainSnapshotObjListGetNames;
|
virDomainSnapshotObjListGetNames;
|
||||||
virDomainSnapshotObjListNew;
|
virDomainSnapshotObjListNew;
|
||||||
|
@ -16201,7 +16201,7 @@ qemuDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot,
|
|||||||
if (!(snap = qemuSnapObjFromSnapshot(vm, snapshot)))
|
if (!(snap = qemuSnapObjFromSnapshot(vm, snapshot)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = virDomainSnapshotIsCurrentName(vm->snapshots, snapshot->name);
|
ret = snap == virDomainSnapshotGetCurrent(vm->snapshots);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
|
@ -6248,15 +6248,20 @@ testDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virDomainObjPtr vm = NULL;
|
virDomainObjPtr vm = NULL;
|
||||||
int ret;
|
int ret = -1;
|
||||||
|
virDomainMomentObjPtr snap = NULL;
|
||||||
|
|
||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
if (!(vm = testDomObjFromSnapshot(snapshot)))
|
if (!(vm = testDomObjFromSnapshot(snapshot)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ret = virDomainSnapshotIsCurrentName(vm->snapshots, snapshot->name);
|
if (!(snap = testSnapObjFromSnapshot(vm, snapshot)))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
ret = snap == virDomainSnapshotGetCurrent(vm->snapshots);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user