---
src/esx/esx_driver.c | 43 ++++++++++++-------------
src/nwfilter/nwfilter_driver.c | 4 ++-
src/qemu/qemu_driver.c | 68 +++++++++++++++++++---------------------
src/storage/storage_driver.c | 6 +---
src/vbox/vbox_tmpl.c | 41 ++++++++++++++++-------
src/xen/xend_internal.c | 4 ++
6 files changed, 88 insertions(+), 78 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 4ed9890..d9a1cfd 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -3296,7 +3296,7 @@ esxDomainIsPersistent(virDomainPtr domain ATTRIBUTE_UNUSED)
static virDomainSnapshotPtr
esxDomainSnapshotCreateXML(virDomainPtr domain, const char *xmlDesc,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
esxPrivate *priv = domain->conn->privateData;
virDomainSnapshotDefPtr def = NULL;
@@ -3308,6 +3308,8 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char
*xmlDesc,
esxVI_TaskInfoState taskInfoState;
virDomainSnapshotPtr snapshot = NULL;
+ virCheckFlags(0, NULL);
+
if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
@@ -3369,7 +3371,7 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char
*xmlDesc,
static char *
esxDomainSnapshotDumpXML(virDomainSnapshotPtr snapshot,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
esxPrivate *priv = snapshot->domain->conn->privateData;
esxVI_VirtualMachineSnapshotTree *rootSnapshotList = NULL;
@@ -3379,6 +3381,8 @@ esxDomainSnapshotDumpXML(virDomainSnapshotPtr snapshot,
char uuid_string[VIR_UUID_STRING_BUFLEN] = "";
char *xml = NULL;
+ virCheckFlags(0, NULL);
+
memset(&def, 0, sizeof (virDomainSnapshotDef));
if (esxVI_EnsureSession(priv->host) < 0) {
@@ -3423,12 +3427,14 @@ esxDomainSnapshotDumpXML(virDomainSnapshotPtr snapshot,
static int
-esxDomainSnapshotNum(virDomainPtr domain, unsigned int flags ATTRIBUTE_UNUSED)
+esxDomainSnapshotNum(virDomainPtr domain, unsigned int flags)
{
int result = 0;
esxPrivate *priv = domain->conn->privateData;
esxVI_VirtualMachineSnapshotTree *rootSnapshotTreeList = NULL;
+ virCheckFlags(0, -1);
+
if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
@@ -3455,12 +3461,14 @@ esxDomainSnapshotNum(virDomainPtr domain, unsigned int flags
ATTRIBUTE_UNUSED)
static int
esxDomainSnapshotListNames(virDomainPtr domain, char **names, int nameslen,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
int result = 0;
esxPrivate *priv = domain->conn->privateData;
esxVI_VirtualMachineSnapshotTree *rootSnapshotTreeList = NULL;
+ virCheckFlags(0, -1);
+
if (names == NULL || nameslen < 0) {
ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", _("Invalid argument"));
return -1;
@@ -3496,7 +3504,7 @@ esxDomainSnapshotListNames(virDomainPtr domain, char **names, int
nameslen,
static virDomainSnapshotPtr
esxDomainSnapshotLookupByName(virDomainPtr domain, const char *name,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
esxPrivate *priv = domain->conn->privateData;
esxVI_VirtualMachineSnapshotTree *rootSnapshotTreeList = NULL;
@@ -3504,6 +3512,8 @@ esxDomainSnapshotLookupByName(virDomainPtr domain, const char
*name,
esxVI_VirtualMachineSnapshotTree *snapshotTreeParent = NULL;
virDomainSnapshotPtr snapshot = NULL;
+ virCheckFlags(0, NULL);
+
if (esxVI_EnsureSession(priv->host) < 0) {
goto cleanup;
}
@@ -3533,12 +3543,7 @@ esxDomainHasCurrentSnapshot(virDomainPtr domain, unsigned int
flags)
esxPrivate *priv = domain->conn->privateData;
esxVI_VirtualMachineSnapshotTree *currentSnapshotTree = NULL;
- if (flags != 0) {
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- _("Unsupported flags (0x%x) passed to %s"),
- flags, __FUNCTION__);
- return -1;
- }
+ virCheckFlags(0, -1);
if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
@@ -3574,12 +3579,7 @@ esxDomainSnapshotCurrent(virDomainPtr domain, unsigned int flags)
esxPrivate *priv = domain->conn->privateData;
esxVI_VirtualMachineSnapshotTree *currentSnapshotTree = NULL;
- if (flags != 0) {
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- _("Unsupported flags (0x%x) passed to %s"),
- flags, __FUNCTION__);
- return NULL;
- }
+ virCheckFlags(0, NULL);
if (esxVI_EnsureSession(priv->host) < 0) {
goto cleanup;
@@ -3612,12 +3612,7 @@ esxDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, unsigned
int flags)
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- if (flags != 0) {
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- _("Unsupported flags (0x%x) passed to %s"),
- flags, __FUNCTION__);
- return -1;
- }
+ virCheckFlags(0, -1);
if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
@@ -3670,6 +3665,8 @@ esxDomainSnapshotDelete(virDomainSnapshotPtr snapshot, unsigned int
flags)
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
+ virCheckFlags(VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN, -1);
+
if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index f237b7c..35ce807 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -374,11 +374,13 @@ cleanup:
static char *
nwfilterDumpXML(virNWFilterPtr obj,
- unsigned int flags ATTRIBUTE_UNUSED) {
+ unsigned int flags) {
virNWFilterDriverStatePtr driver = obj->conn->nwfilterPrivateData;
virNWFilterPoolObjPtr pool;
char *ret = NULL;
+ virCheckFlags(0, NULL);
+
nwfilterDriverLock(driver);
pool = virNWFilterPoolObjFindByUUID(&driver->pools, obj->uuid);
nwfilterDriverUnlock(driver);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index df1d435..3981a8d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4997,12 +4997,7 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int flags)
int ret = -1;
int compressed;
- if (flags != 0) {
- qemuReportError(VIR_ERR_INVALID_ARG,
- _("unsupported flags (0x%x) passed to '%s'"),
- flags, __FUNCTION__);
- return -1;
- }
+ virCheckFlags(0, -1);
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
@@ -5063,12 +5058,7 @@ qemuDomainHasManagedSaveImage(virDomainPtr dom, unsigned int
flags)
int ret = -1;
char *name = NULL;
- if (flags != 0) {
- qemuReportError(VIR_ERR_INVALID_ARG,
- _("unsupported flags (0x%x) passed to '%s'"),
- flags, __FUNCTION__);
- return -1;
- }
+ virCheckFlags(0, -1);
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
@@ -5102,12 +5092,7 @@ qemuDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags)
int ret = -1;
char *name = NULL;
- if (flags != 0) {
- qemuReportError(VIR_ERR_INVALID_ARG,
- _("unsupported flags (0x%x) passed to '%s'"),
- flags, __FUNCTION__);
- return -1;
- }
+ virCheckFlags(0, -1);
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
@@ -7630,11 +7615,8 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
virCgroupPtr cgroup = NULL;
int ret = -1;
- if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
- qemuReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("cannot modify the persistent
configuration of a domain"));
- return -1;
- }
+ virCheckFlags(VIR_DOMAIN_DEVICE_MODIFY_CURRENT |
+ VIR_DOMAIN_DEVICE_MODIFY_LIVE, -1);
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
@@ -10516,11 +10498,7 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom,
qemuDomainObjPrivatePtr priv;
int ret = -1;
- if (flags != 0) {
- qemuReportError(VIR_ERR_INVALID_ARG,
- _("unsupported flags (0x%x) passed to '%s'"),
flags, __FUNCTION__);
- return -1;
- }
+ virCheckFlags(0, -1);
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
@@ -10679,7 +10657,7 @@ static int qemuDomainSnapshotIsAllowed(virDomainObjPtr vm)
static virDomainSnapshotPtr qemuDomainSnapshotCreateXML(virDomainPtr domain,
const char *xmlDesc,
- unsigned int flags
ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
struct qemud_driver *driver = domain->conn->privateData;
virDomainObjPtr vm = NULL;
@@ -10691,6 +10669,8 @@ static virDomainSnapshotPtr
qemuDomainSnapshotCreateXML(virDomainPtr domain,
const char *qemuimgarg[] = { NULL, "snapshot", "-c", NULL, NULL,
NULL };
int i;
+ virCheckFlags(0, NULL);
+
qemuDriverLock(driver);
virUUIDFormat(domain->uuid, uuidstr);
vm = virDomainFindByUUID(&driver->domains, domain->uuid);
@@ -10796,12 +10776,14 @@ cleanup:
static int qemuDomainSnapshotListNames(virDomainPtr domain, char **names,
int nameslen,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
struct qemud_driver *driver = domain->conn->privateData;
virDomainObjPtr vm = NULL;
int n = -1;
+ virCheckFlags(0, -1);
+
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, domain->uuid);
if (!vm) {
@@ -10822,12 +10804,14 @@ cleanup:
}
static int qemuDomainSnapshotNum(virDomainPtr domain,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
struct qemud_driver *driver = domain->conn->privateData;
virDomainObjPtr vm = NULL;
int n = -1;
+ virCheckFlags(0, -1);
+
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, domain->uuid);
if (!vm) {
@@ -10849,13 +10833,15 @@ cleanup:
static virDomainSnapshotPtr qemuDomainSnapshotLookupByName(virDomainPtr domain,
const char *name,
- unsigned int flags
ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
struct qemud_driver *driver = domain->conn->privateData;
virDomainObjPtr vm;
virDomainSnapshotObjPtr snap = NULL;
virDomainSnapshotPtr snapshot = NULL;
+ virCheckFlags(0, NULL);
+
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, domain->uuid);
if (!vm) {
@@ -10883,12 +10869,14 @@ cleanup:
}
static int qemuDomainHasCurrentSnapshot(virDomainPtr domain,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
struct qemud_driver *driver = domain->conn->privateData;
virDomainObjPtr vm;
int ret = -1;
+ virCheckFlags(0, -1);
+
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, domain->uuid);
if (!vm) {
@@ -10909,12 +10897,14 @@ cleanup:
}
static virDomainSnapshotPtr qemuDomainSnapshotCurrent(virDomainPtr domain,
- unsigned int flags
ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
struct qemud_driver *driver = domain->conn->privateData;
virDomainObjPtr vm;
virDomainSnapshotPtr snapshot = NULL;
+ virCheckFlags(0, NULL);
+
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, domain->uuid);
if (!vm) {
@@ -10941,7 +10931,7 @@ cleanup:
}
static char *qemuDomainSnapshotDumpXML(virDomainSnapshotPtr snapshot,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
struct qemud_driver *driver = snapshot->domain->conn->privateData;
virDomainObjPtr vm = NULL;
@@ -10949,6 +10939,8 @@ static char *qemuDomainSnapshotDumpXML(virDomainSnapshotPtr
snapshot,
virDomainSnapshotObjPtr snap = NULL;
char uuidstr[VIR_UUID_STRING_BUFLEN];
+ virCheckFlags(0, NULL);
+
qemuDriverLock(driver);
virUUIDFormat(snapshot->domain->uuid, uuidstr);
vm = virDomainFindByUUID(&driver->domains, snapshot->domain->uuid);
@@ -10976,7 +10968,7 @@ cleanup:
}
static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
struct qemud_driver *driver = snapshot->domain->conn->privateData;
virDomainObjPtr vm = NULL;
@@ -10987,6 +10979,8 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr
snapshot,
qemuDomainObjPrivatePtr priv;
int rc;
+ virCheckFlags(0, -1);
+
qemuDriverLock(driver);
virUUIDFormat(snapshot->domain->uuid, uuidstr);
vm = virDomainFindByUUID(&driver->domains, snapshot->domain->uuid);
@@ -11212,6 +11206,8 @@ static int qemuDomainSnapshotDelete(virDomainSnapshotPtr
snapshot,
char uuidstr[VIR_UUID_STRING_BUFLEN];
struct snap_remove rem;
+ virCheckFlags(VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN, -1);
+
qemuDriverLock(driver);
virUUIDFormat(snapshot->domain->uuid, uuidstr);
vm = virDomainFindByUUID(&driver->domains, snapshot->domain->uuid);
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index d476822..2c69ba9 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1681,11 +1681,7 @@ storageVolumeWipe(virStorageVolPtr obj,
virStorageVolDefPtr vol = NULL;
int ret = -1;
- if (flags != 0) {
- virStorageReportError(VIR_ERR_INVALID_ARG,
- _("Unsupported flags (0x%x) passed to
'%s'"), flags, __FUNCTION__);
- goto out;
- }
+ virCheckFlags(0, -1);
storageDriverLock(driver);
pool = virStoragePoolObjFindByName(&driver->pools, obj->pool);
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index a07cf8e..0ea99d1 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -4877,11 +4877,8 @@ static int vboxDomainAttachDeviceFlags(virDomainPtr dom, const char
*xml,
static int vboxDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml,
unsigned int flags) {
- if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
- vboxError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot modify the persistent configuration of a
domain"));
- return -1;
- }
+ virCheckFlags(VIR_DOMAIN_DEVICE_MODIFY_CURRENT |
+ VIR_DOMAIN_DEVICE_MODIFY_LIVE, -1);
return vboxDomainAttachDeviceImpl(dom, xml, 1);
}
@@ -5166,7 +5163,7 @@ cleanup:
static virDomainSnapshotPtr
vboxDomainSnapshotCreateXML(virDomainPtr dom,
const char *xmlDesc,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
VBOX_OBJECT_CHECK(dom->conn, virDomainSnapshotPtr, NULL);
virDomainSnapshotDefPtr def = NULL;
@@ -5185,6 +5182,8 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom,
PRInt32 result;
#endif
+ virCheckFlags(0, NULL);
+
if (!(def = virDomainSnapshotDefParseString(xmlDesc, 1)))
goto cleanup;
@@ -5282,7 +5281,7 @@ cleanup:
static char *
vboxDomainSnapshotDumpXML(virDomainSnapshotPtr snapshot,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
virDomainPtr dom = snapshot->domain;
VBOX_OBJECT_CHECK(dom->conn, char *, NULL);
@@ -5298,6 +5297,8 @@ vboxDomainSnapshotDumpXML(virDomainSnapshotPtr snapshot,
PRBool online = PR_FALSE;
char uuidstr[VIR_UUID_STRING_BUFLEN];
+ virCheckFlags(0, NULL);
+
#if VBOX_API_VERSION == 2002
if (VIR_ALLOC(domiid) < 0) {
virReportOOMError();
@@ -5399,7 +5400,7 @@ no_memory:
static int
vboxDomainSnapshotNum(virDomainPtr dom,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
VBOX_OBJECT_CHECK(dom->conn, int, -1);
vboxIID *iid = NULL;
@@ -5407,6 +5408,8 @@ vboxDomainSnapshotNum(virDomainPtr dom,
nsresult rc;
PRUint32 snapshotCount;
+ virCheckFlags(0, -1);
+
#if VBOX_API_VERSION == 2002
if (VIR_ALLOC(iid) < 0) {
virReportOOMError();
@@ -5442,7 +5445,7 @@ static int
vboxDomainSnapshotListNames(virDomainPtr dom,
char **names,
int nameslen,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
VBOX_OBJECT_CHECK(dom->conn, int, -1);
vboxIID *iid = NULL;
@@ -5452,6 +5455,8 @@ vboxDomainSnapshotListNames(virDomainPtr dom,
int count = 0;
int i;
+ virCheckFlags(0, -1);
+
#if VBOX_API_VERSION == 2002
if (VIR_ALLOC(iid) < 0) {
virReportOOMError();
@@ -5512,7 +5517,7 @@ cleanup:
static virDomainSnapshotPtr
vboxDomainSnapshotLookupByName(virDomainPtr dom,
const char *name,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
VBOX_OBJECT_CHECK(dom->conn, virDomainSnapshotPtr, NULL);
vboxIID *iid = NULL;
@@ -5520,6 +5525,8 @@ vboxDomainSnapshotLookupByName(virDomainPtr dom,
ISnapshot *snapshot = NULL;
nsresult rc;
+ virCheckFlags(0, NULL);
+
#if VBOX_API_VERSION == 2002
if (VIR_ALLOC(iid) < 0) {
virReportOOMError();
@@ -5549,7 +5556,7 @@ cleanup:
static int
vboxDomainHasCurrentSnapshot(virDomainPtr dom,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
VBOX_OBJECT_CHECK(dom->conn, int, -1);
vboxIID *iid = NULL;
@@ -5557,6 +5564,8 @@ vboxDomainHasCurrentSnapshot(virDomainPtr dom,
ISnapshot *snapshot = NULL;
nsresult rc;
+ virCheckFlags(0, -1);
+
#if VBOX_API_VERSION == 2002
if (VIR_ALLOC(iid) < 0) {
virReportOOMError();
@@ -5592,7 +5601,7 @@ cleanup:
static virDomainSnapshotPtr
vboxDomainSnapshotCurrent(virDomainPtr dom,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
VBOX_OBJECT_CHECK(dom->conn, virDomainSnapshotPtr, NULL);
vboxIID *iid = NULL;
@@ -5602,6 +5611,8 @@ vboxDomainSnapshotCurrent(virDomainPtr dom,
char *name = NULL;
nsresult rc;
+ virCheckFlags(0, NULL);
+
#if VBOX_API_VERSION == 2002
if (VIR_ALLOC(iid) < 0) {
virReportOOMError();
@@ -5763,7 +5774,7 @@ cleanup:
static int
vboxDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
virDomainPtr dom = snapshot->domain;
VBOX_OBJECT_CHECK(dom->conn, int, -1);
@@ -5775,6 +5786,8 @@ vboxDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
PRUint32 state;
nsresult rc;
+ virCheckFlags(0, -1);
+
#if VBOX_API_VERSION == 2002
if (VIR_ALLOC(domiid) < 0) {
virReportOOMError();
@@ -5941,6 +5954,8 @@ vboxDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
PRUint32 state;
nsresult rc;
+ virCheckFlags(VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN, -1);
+
#if VBOX_API_VERSION == 2002
if (VIR_ALLOC(domiid) < 0) {
virReportOOMError();
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index c4e73b7..d81f6e3 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -4202,6 +4202,10 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
virBuffer buf = VIR_BUFFER_INITIALIZER;
char class[8], ref[80];
+ virCheckFlags(VIR_DOMAIN_DEVICE_MODIFY_CURRENT |
+ VIR_DOMAIN_DEVICE_MODIFY_LIVE |
+ VIR_DOMAIN_DEVICE_MODIFY_CONFIG, -1);
+
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return -1;
--
1.7.0.4