Re: [PATCH 3/6] conf: domain: Improve vcpus validation reporting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 22, 2010 at 04:35:31PM -0500, Cole Robinson wrote:
> 
> Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
> ---
>  src/conf/domain_conf.c |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 11a6280..045934d 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -4569,7 +4569,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
>          def->maxvcpus = 1;
>      } else {
>          def->maxvcpus = count;
> -        if (def->maxvcpus != count || count == 0) {
> +        if (count == 0) {
>              virDomainReportError(VIR_ERR_XML_ERROR,
>                                   _("invalid maxvcpus %lu"), count);
>              goto error;
> @@ -4585,11 +4585,18 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
>          def->vcpus = def->maxvcpus;
>      } else {
>          def->vcpus = count;
> -        if (def->vcpus != count || count == 0 || def->maxvcpus < count) {
> +        if (count == 0) {
>              virDomainReportError(VIR_ERR_XML_ERROR,
>                                   _("invalid current vcpus %lu"), count);
>              goto error;
>          }
> +
> +        if (def->maxvcpus < count) {
> +            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
> +                _("maxvcpus must not be less than current vcpus (%d < %lu)"),
> +                def->maxvcpus, count);
> +            goto error;
> +        }
>      }


ACK

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]