mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-31 18:33:11 +00:00
52 lines
1.6 KiB
C
52 lines
1.6 KiB
C
|
/*
|
||
|
* domain_validate.c: domain general validation functions
|
||
|
*
|
||
|
* Copyright IBM Corp, 2020
|
||
|
*
|
||
|
* This library is free software; you can redistribute it and/or
|
||
|
* modify it under the terms of the GNU Lesser General Public
|
||
|
* License as published by the Free Software Foundation; either
|
||
|
* version 2.1 of the License, or (at your option) any later version.
|
||
|
*
|
||
|
* This library is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
* Lesser General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Lesser General Public
|
||
|
* License along with this library. If not, see
|
||
|
* <http://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
|
||
|
#include <config.h>
|
||
|
|
||
|
#include "domain_validate.h"
|
||
|
#include "domain_conf.h"
|
||
|
#include "virlog.h"
|
||
|
#include "virutil.h"
|
||
|
|
||
|
#define VIR_FROM_THIS VIR_FROM_DOMAIN
|
||
|
|
||
|
VIR_LOG_INIT("conf.domain_validate");
|
||
|
|
||
|
int
|
||
|
virDomainDefBootValidate(const virDomainDef *def)
|
||
|
{
|
||
|
if (def->os.bm_timeout_set && def->os.bm_timeout > 65535) {
|
||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||
|
_("invalid value for boot menu timeout, "
|
||
|
"must be in range [0,65535]"));
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
if (def->os.bios.rt_set &&
|
||
|
(def->os.bios.rt_delay < -1 || def->os.bios.rt_delay > 65535)) {
|
||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||
|
_("invalid value for rebootTimeout, "
|
||
|
"must be in range [-1,65535]"));
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|