virDomainCheckpointAlignDisks: Use virDomainDiskByName

We don't need the index that virDomainDiskIndexByName returns.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2020-12-01 17:55:54 +01:00
parent 092e6f2201
commit 22115266b7

View File

@ -315,17 +315,14 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr chkdef)
/* Double check requested disks. */ /* Double check requested disks. */
for (i = 0; i < chkdef->ndisks; i++) { for (i = 0; i < chkdef->ndisks; i++) {
virDomainCheckpointDiskDefPtr chkdisk = &chkdef->disks[i]; virDomainCheckpointDiskDefPtr chkdisk = &chkdef->disks[i];
int idx = virDomainDiskIndexByName(domdef, chkdisk->name, false); virDomainDiskDefPtr domdisk = virDomainDiskByName(domdef, chkdisk->name, false);
virDomainDiskDefPtr domdisk;
if (idx < 0) { if (!domdisk) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("no disk named '%s'"), chkdisk->name); _("no disk named '%s'"), chkdisk->name);
return -1; return -1;
} }
domdisk = domdef->disks[idx];
if (virHashHasEntry(map, domdisk->dst)) { if (virHashHasEntry(map, domdisk->dst)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("disk '%s' specified twice"), _("disk '%s' specified twice"),