mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-31 18:15:25 +00:00
conf: expand iotune params if only group name is given
Currently, if only iotune group name is given for some disk and no any params then later start of domain will fail. I guess it will be convenient to allow such configuration if there is another disk in the same iotune group with iotune params set. The meaning is that the first disk have same iotunes and the latter. Thus one can easily add a disk to iotune group - just add group name parameter and no need to copy all the params. Also let's expand iotunes params in the described case so we don't need to refer to another disk to know iotunes and this will make logic in many places simple. Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
67ebd6ac26
commit
eb4455daab
@ -5110,6 +5110,32 @@ virDomainRNGDefPostParse(virDomainRNGDefPtr rng)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
virDomainDiskExpandGroupIoTune(virDomainDiskDefPtr disk,
|
||||
const virDomainDef *def)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (!disk->blkdeviotune.group_name ||
|
||||
virDomainBlockIoTuneInfoHasAny(&disk->blkdeviotune))
|
||||
return;
|
||||
|
||||
for (i = 0; i < def->ndisks; i++) {
|
||||
virDomainDiskDefPtr d = def->disks[i];
|
||||
|
||||
if (STRNEQ_NULLABLE(disk->blkdeviotune.group_name, d->blkdeviotune.group_name) ||
|
||||
!virDomainBlockIoTuneInfoHasAny(&d->blkdeviotune))
|
||||
continue;
|
||||
|
||||
|
||||
VIR_FREE(disk->blkdeviotune.group_name);
|
||||
virDomainBlockIoTuneInfoCopy(&d->blkdeviotune, &disk->blkdeviotune);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virDomainDiskDefPostParse(virDomainDiskDefPtr disk,
|
||||
const virDomainDef *def,
|
||||
@ -5155,6 +5181,8 @@ virDomainDiskDefPostParse(virDomainDiskDefPtr disk,
|
||||
return -1;
|
||||
}
|
||||
|
||||
virDomainDiskExpandGroupIoTune(disk, def);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -31758,3 +31786,12 @@ virDomainBlockIoTuneInfoHasAny(const virDomainBlockIoTuneInfo *iotune)
|
||||
virDomainBlockIoTuneInfoHasMax(iotune) ||
|
||||
virDomainBlockIoTuneInfoHasMaxLength(iotune);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
virDomainBlockIoTuneInfoCopy(const virDomainBlockIoTuneInfo *src,
|
||||
virDomainBlockIoTuneInfoPtr dst)
|
||||
{
|
||||
*dst = *src;
|
||||
dst->group_name = g_strdup(src->group_name);
|
||||
}
|
||||
|
@ -489,6 +489,7 @@ struct _virDomainBlockIoTuneInfo {
|
||||
unsigned long long total_iops_sec_max_length;
|
||||
unsigned long long read_iops_sec_max_length;
|
||||
unsigned long long write_iops_sec_max_length;
|
||||
/* Don't forget to update virDomainBlockIoTuneInfoCopy. */
|
||||
};
|
||||
|
||||
|
||||
@ -3710,3 +3711,7 @@ virDomainBlockIoTuneInfoHasMaxLength(const virDomainBlockIoTuneInfo *iotune);
|
||||
|
||||
bool
|
||||
virDomainBlockIoTuneInfoHasAny(const virDomainBlockIoTuneInfo *iotune);
|
||||
|
||||
void
|
||||
virDomainBlockIoTuneInfoCopy(const virDomainBlockIoTuneInfo *src,
|
||||
virDomainBlockIoTuneInfoPtr dst);
|
||||
|
@ -226,6 +226,7 @@ virDomainActualNetDefFree;
|
||||
virDomainActualNetDefValidate;
|
||||
virDomainBlockedReasonTypeFromString;
|
||||
virDomainBlockedReasonTypeToString;
|
||||
virDomainBlockIoTuneInfoCopy;
|
||||
virDomainBlockIoTuneInfoHasAny;
|
||||
virDomainBlockIoTuneInfoHasBasic;
|
||||
virDomainBlockIoTuneInfoHasMax;
|
||||
|
Loading…
Reference in New Issue
Block a user