libxl: reject unknown flags

* src/libxl/libxl_driver.c (libxlOpen, libxlDomainReboot)
(libxlDomainXMLFromNative, libxlDomainXMLToNative)
(libxlDomainCreateWithFlags): Reject unknown flags.
This commit is contained in:
Eric Blake 2011-07-06 16:17:10 -06:00
parent 23cbf1e0d4
commit 9110941cfd

View File

@ -1063,8 +1063,10 @@ libxlActive(void)
static virDrvOpenStatus
libxlOpen(virConnectPtr conn,
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
unsigned int flags ATTRIBUTE_UNUSED)
unsigned int flags)
{
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
if (conn->uri == NULL) {
if (libxl_driver == NULL)
return VIR_DRV_OPEN_DECLINED;
@ -1482,13 +1484,15 @@ cleanup:
}
static int
libxlDomainReboot(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED)
libxlDomainReboot(virDomainPtr dom, unsigned int flags)
{
libxlDriverPrivatePtr driver = dom->conn->privateData;
virDomainObjPtr vm;
int ret = -1;
libxlDomainObjPrivatePtr priv;
virCheckFlags(0, -1);
libxlDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) {
@ -2511,7 +2515,7 @@ libxlDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
static char *
libxlDomainXMLFromNative(virConnectPtr conn, const char * nativeFormat,
const char * nativeConfig,
unsigned int flags ATTRIBUTE_UNUSED)
unsigned int flags)
{
libxlDriverPrivatePtr driver = conn->privateData;
const libxl_version_info *ver_info;
@ -2519,6 +2523,8 @@ libxlDomainXMLFromNative(virConnectPtr conn, const char * nativeFormat,
virConfPtr conf = NULL;
char *xml = NULL;
virCheckFlags(0, NULL);
if (STRNEQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) {
libxlError(VIR_ERR_INVALID_ARG,
_("unsupported config type %s"), nativeFormat);
@ -2551,7 +2557,7 @@ cleanup:
static char *
libxlDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,
const char * domainXml,
unsigned int flags ATTRIBUTE_UNUSED)
unsigned int flags)
{
libxlDriverPrivatePtr driver = conn->privateData;
const libxl_version_info *ver_info;
@ -2560,6 +2566,8 @@ libxlDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,
int len = MAX_CONFIG_SIZE;
char *ret = NULL;
virCheckFlags(0, NULL);
if (STRNEQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) {
libxlError(VIR_ERR_INVALID_ARG,
_("unsupported config type %s"), nativeFormat);
@ -2623,7 +2631,7 @@ libxlNumDefinedDomains(virConnectPtr conn)
static int
libxlDomainCreateWithFlags(virDomainPtr dom,
unsigned int flags ATTRIBUTE_UNUSED)
unsigned int flags)
{
libxlDriverPrivatePtr driver = dom->conn->privateData;
virDomainObjPtr vm;