mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
Drop needless ret variable
In few places we have the following code pattern: int ret; ... /* @ret is not accessed here */ ret = f(...); return ret; This pattern can be written less verbose: ... return f(...); This patch was generated with following coccinelle spatch: @@ type T; constant C; expression f; identifier ret; @@ -T ret = C; ... when != ret -ret = f; -return ret; +return f; Afterwards I needed to fix a few places, e.g. comment in virDomainNetIPParseXML() was removed too because coccinelle thinks it refers to @ret while in fact it doesn't. Also in few places it replaced @ret declaration with a few spaces instead of removing the line. But nothing terribly wrong. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
b3739aa63f
commit
3b4df5d350
@ -630,30 +630,24 @@ static int
|
|||||||
bhyveConnectListDomains(virConnectPtr conn, int *ids, int maxids)
|
bhyveConnectListDomains(virConnectPtr conn, int *ids, int maxids)
|
||||||
{
|
{
|
||||||
bhyveConnPtr privconn = conn->privateData;
|
bhyveConnPtr privconn = conn->privateData;
|
||||||
int n;
|
|
||||||
|
|
||||||
if (virConnectListDomainsEnsureACL(conn) < 0)
|
if (virConnectListDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
n = virDomainObjListGetActiveIDs(privconn->domains, ids, maxids,
|
return virDomainObjListGetActiveIDs(privconn->domains, ids, maxids,
|
||||||
virConnectListDomainsCheckACL, conn);
|
virConnectListDomainsCheckACL, conn);
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
bhyveConnectNumOfDomains(virConnectPtr conn)
|
bhyveConnectNumOfDomains(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
bhyveConnPtr privconn = conn->privateData;
|
bhyveConnPtr privconn = conn->privateData;
|
||||||
int count;
|
|
||||||
|
|
||||||
if (virConnectNumOfDomainsEnsureACL(conn) < 0)
|
if (virConnectNumOfDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
count = virDomainObjListNumOfDomains(privconn->domains, true,
|
return virDomainObjListNumOfDomains(privconn->domains, true,
|
||||||
virConnectNumOfDomainsCheckACL, conn);
|
virConnectNumOfDomainsCheckACL, conn);
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -661,31 +655,28 @@ bhyveConnectListDefinedDomains(virConnectPtr conn, char **const names,
|
|||||||
int maxnames)
|
int maxnames)
|
||||||
{
|
{
|
||||||
bhyveConnPtr privconn = conn->privateData;
|
bhyveConnPtr privconn = conn->privateData;
|
||||||
int n;
|
|
||||||
|
|
||||||
if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
|
if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memset(names, 0, sizeof(*names) * maxnames);
|
memset(names, 0, sizeof(*names) * maxnames);
|
||||||
n = virDomainObjListGetInactiveNames(privconn->domains, names,
|
return virDomainObjListGetInactiveNames(privconn->domains, names,
|
||||||
maxnames, virConnectListDefinedDomainsCheckACL, conn);
|
maxnames,
|
||||||
|
virConnectListDefinedDomainsCheckACL,
|
||||||
return n;
|
conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
bhyveConnectNumOfDefinedDomains(virConnectPtr conn)
|
bhyveConnectNumOfDefinedDomains(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
bhyveConnPtr privconn = conn->privateData;
|
bhyveConnPtr privconn = conn->privateData;
|
||||||
int count;
|
|
||||||
|
|
||||||
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
|
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
count = virDomainObjListNumOfDomains(privconn->domains, false,
|
return virDomainObjListNumOfDomains(privconn->domains, false,
|
||||||
virConnectNumOfDefinedDomainsCheckACL, conn);
|
virConnectNumOfDefinedDomainsCheckACL,
|
||||||
|
conn);
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
@ -771,17 +762,14 @@ bhyveConnectListAllDomains(virConnectPtr conn,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
bhyveConnPtr privconn = conn->privateData;
|
bhyveConnPtr privconn = conn->privateData;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
|
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
|
||||||
|
|
||||||
if (virConnectListAllDomainsEnsureACL(conn) < 0)
|
if (virConnectListAllDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ret = virDomainObjListExport(privconn->domains, conn, domains,
|
return virDomainObjListExport(privconn->domains, conn, domains,
|
||||||
virConnectListAllDomainsCheckACL, flags);
|
virConnectListAllDomainsCheckACL, flags);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static virDomainPtr
|
static virDomainPtr
|
||||||
|
@ -73,13 +73,10 @@ virDomainCheckpointDiskDefClear(virDomainCheckpointDiskDefPtr disk)
|
|||||||
virDomainCheckpointDefPtr
|
virDomainCheckpointDefPtr
|
||||||
virDomainCheckpointDefNew(void)
|
virDomainCheckpointDefNew(void)
|
||||||
{
|
{
|
||||||
virDomainCheckpointDefPtr def;
|
|
||||||
|
|
||||||
if (virDomainCheckpointInitialize() < 0)
|
if (virDomainCheckpointInitialize() < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
def = virObjectNew(virDomainCheckpointDefClass);
|
return virObjectNew(virDomainCheckpointDefClass);
|
||||||
return def;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -8322,7 +8322,6 @@ static virNetDevIPAddrPtr
|
|||||||
virDomainNetIPParseXML(xmlNodePtr node)
|
virDomainNetIPParseXML(xmlNodePtr node)
|
||||||
{
|
{
|
||||||
/* Parse the prefix in every case */
|
/* Parse the prefix in every case */
|
||||||
virNetDevIPAddrPtr ret = NULL;
|
|
||||||
unsigned int prefixValue = 0;
|
unsigned int prefixValue = 0;
|
||||||
int family = AF_UNSPEC;
|
int family = AF_UNSPEC;
|
||||||
g_autofree virNetDevIPAddrPtr ip = NULL;
|
g_autofree virNetDevIPAddrPtr ip = NULL;
|
||||||
@ -8374,8 +8373,7 @@ virDomainNetIPParseXML(xmlNodePtr node)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&ip);
|
return g_steal_pointer(&ip);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -9239,7 +9237,6 @@ virDomainStorageSourceParseBase(const char *type,
|
|||||||
const char *index)
|
const char *index)
|
||||||
{
|
{
|
||||||
g_autoptr(virStorageSource) src = NULL;
|
g_autoptr(virStorageSource) src = NULL;
|
||||||
virStorageSourcePtr ret = NULL;
|
|
||||||
|
|
||||||
if (!(src = virStorageSourceNew()))
|
if (!(src = virStorageSourceNew()))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -9267,8 +9264,7 @@ virDomainStorageSourceParseBase(const char *type,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&src);
|
return g_steal_pointer(&src);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -18368,7 +18364,6 @@ virDomainIOThreadPinDefParseXML(xmlNodePtr node,
|
|||||||
static virBitmapPtr
|
static virBitmapPtr
|
||||||
virDomainEmulatorPinDefParseXML(xmlNodePtr node)
|
virDomainEmulatorPinDefParseXML(xmlNodePtr node)
|
||||||
{
|
{
|
||||||
virBitmapPtr ret = NULL;
|
|
||||||
g_autofree char *tmp = NULL;
|
g_autofree char *tmp = NULL;
|
||||||
g_autoptr(virBitmap) def = NULL;
|
g_autoptr(virBitmap) def = NULL;
|
||||||
|
|
||||||
@ -18387,8 +18382,7 @@ virDomainEmulatorPinDefParseXML(xmlNodePtr node)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&def);
|
return g_steal_pointer(&def);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,13 +113,10 @@ virDomainSnapshotDiskDefFree(virDomainSnapshotDiskDefPtr disk)
|
|||||||
virDomainSnapshotDefPtr
|
virDomainSnapshotDefPtr
|
||||||
virDomainSnapshotDefNew(void)
|
virDomainSnapshotDefNew(void)
|
||||||
{
|
{
|
||||||
virDomainSnapshotDefPtr def;
|
|
||||||
|
|
||||||
if (virDomainSnapshotInitialize() < 0)
|
if (virDomainSnapshotInitialize() < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
def = virObjectNew(virDomainSnapshotDefClass);
|
return virObjectNew(virDomainSnapshotDefClass);
|
||||||
return def;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -846,7 +846,6 @@ virStoragePoolDefPtr
|
|||||||
virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
|
virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
|
||||||
{
|
{
|
||||||
virStoragePoolOptionsPtr options;
|
virStoragePoolOptionsPtr options;
|
||||||
virStoragePoolDefPtr ret = NULL;
|
|
||||||
xmlNodePtr source_node;
|
xmlNodePtr source_node;
|
||||||
g_autoptr(virStoragePoolDef) def = NULL;
|
g_autoptr(virStoragePoolDef) def = NULL;
|
||||||
g_autofree char *type = NULL;
|
g_autofree char *type = NULL;
|
||||||
@ -995,8 +994,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&def);
|
return g_steal_pointer(&def);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1270,7 +1268,6 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
|
|||||||
xmlXPathContextPtr ctxt,
|
xmlXPathContextPtr ctxt,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virStorageVolDefPtr ret = NULL;
|
|
||||||
virStorageVolOptionsPtr options;
|
virStorageVolOptionsPtr options;
|
||||||
xmlNodePtr node;
|
xmlNodePtr node;
|
||||||
size_t i;
|
size_t i;
|
||||||
@ -1430,8 +1427,7 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
|
|||||||
VIR_FREE(nodes);
|
VIR_FREE(nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&def);
|
return g_steal_pointer(&def);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1689,14 +1685,11 @@ virStoragePoolSaveXML(const char *path,
|
|||||||
const char *xml)
|
const char *xml)
|
||||||
{
|
{
|
||||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
virUUIDFormat(def->uuid, uuidstr);
|
virUUIDFormat(def->uuid, uuidstr);
|
||||||
ret = virXMLSaveFile(path,
|
return virXMLSaveFile(path,
|
||||||
virXMLPickShellSafeComment(def->name, uuidstr),
|
virXMLPickShellSafeComment(def->name, uuidstr),
|
||||||
"pool-edit", xml);
|
"pool-edit", xml);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,10 +91,7 @@ virNWFilterBindingObjSetDef(virNWFilterBindingObjPtr obj,
|
|||||||
virNWFilterBindingDefPtr
|
virNWFilterBindingDefPtr
|
||||||
virNWFilterBindingObjStealDef(virNWFilterBindingObjPtr obj)
|
virNWFilterBindingObjStealDef(virNWFilterBindingObjPtr obj)
|
||||||
{
|
{
|
||||||
virNWFilterBindingDefPtr def;
|
return g_steal_pointer(&obj->def);
|
||||||
|
|
||||||
def = g_steal_pointer(&obj->def);
|
|
||||||
return def;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -520,11 +520,8 @@ virStreamInData(virStreamPtr stream,
|
|||||||
virCheckNonNullArgReturn(data, -1);
|
virCheckNonNullArgReturn(data, -1);
|
||||||
virCheckNonNullArgReturn(length, -1);
|
virCheckNonNullArgReturn(length, -1);
|
||||||
|
|
||||||
if (stream->driver->streamInData) {
|
if (stream->driver->streamInData)
|
||||||
int ret;
|
return (stream->driver->streamInData)(stream, data, length);
|
||||||
ret = (stream->driver->streamInData)(stream, data, length);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
virReportUnsupportedError();
|
virReportUnsupportedError();
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1009,30 +1009,24 @@ static int
|
|||||||
libxlConnectListDomains(virConnectPtr conn, int *ids, int nids)
|
libxlConnectListDomains(virConnectPtr conn, int *ids, int nids)
|
||||||
{
|
{
|
||||||
libxlDriverPrivatePtr driver = conn->privateData;
|
libxlDriverPrivatePtr driver = conn->privateData;
|
||||||
int n;
|
|
||||||
|
|
||||||
if (virConnectListDomainsEnsureACL(conn) < 0)
|
if (virConnectListDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
n = virDomainObjListGetActiveIDs(driver->domains, ids, nids,
|
return virDomainObjListGetActiveIDs(driver->domains, ids, nids,
|
||||||
virConnectListDomainsCheckACL, conn);
|
virConnectListDomainsCheckACL, conn);
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
libxlConnectNumOfDomains(virConnectPtr conn)
|
libxlConnectNumOfDomains(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
libxlDriverPrivatePtr driver = conn->privateData;
|
libxlDriverPrivatePtr driver = conn->privateData;
|
||||||
int n;
|
|
||||||
|
|
||||||
if (virConnectNumOfDomainsEnsureACL(conn) < 0)
|
if (virConnectNumOfDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
n = virDomainObjListNumOfDomains(driver->domains, true,
|
return virDomainObjListNumOfDomains(driver->domains, true,
|
||||||
virConnectNumOfDomainsCheckACL, conn);
|
virConnectNumOfDomainsCheckACL, conn);
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static virDomainPtr
|
static virDomainPtr
|
||||||
@ -2776,29 +2770,26 @@ libxlConnectListDefinedDomains(virConnectPtr conn,
|
|||||||
char **const names, int nnames)
|
char **const names, int nnames)
|
||||||
{
|
{
|
||||||
libxlDriverPrivatePtr driver = conn->privateData;
|
libxlDriverPrivatePtr driver = conn->privateData;
|
||||||
int n;
|
|
||||||
|
|
||||||
if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
|
if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
n = virDomainObjListGetInactiveNames(driver->domains, names, nnames,
|
return virDomainObjListGetInactiveNames(driver->domains, names, nnames,
|
||||||
virConnectListDefinedDomainsCheckACL, conn);
|
virConnectListDefinedDomainsCheckACL,
|
||||||
return n;
|
conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
libxlConnectNumOfDefinedDomains(virConnectPtr conn)
|
libxlConnectNumOfDefinedDomains(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
libxlDriverPrivatePtr driver = conn->privateData;
|
libxlDriverPrivatePtr driver = conn->privateData;
|
||||||
int n;
|
|
||||||
|
|
||||||
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
|
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
n = virDomainObjListNumOfDomains(driver->domains, false,
|
return virDomainObjListNumOfDomains(driver->domains, false,
|
||||||
virConnectNumOfDefinedDomainsCheckACL,
|
virConnectNumOfDefinedDomainsCheckACL,
|
||||||
conn);
|
conn);
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -5715,17 +5706,14 @@ libxlConnectListAllDomains(virConnectPtr conn,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
libxlDriverPrivatePtr driver = conn->privateData;
|
libxlDriverPrivatePtr driver = conn->privateData;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
|
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
|
||||||
|
|
||||||
if (virConnectListAllDomainsEnsureACL(conn) < 0)
|
if (virConnectListAllDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ret = virDomainObjListExport(driver->domains, conn, domains,
|
return virDomainObjListExport(driver->domains, conn, domains,
|
||||||
virConnectListAllDomainsCheckACL, flags);
|
virConnectListAllDomainsCheckACL, flags);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Which features are supported by this driver? */
|
/* Which features are supported by this driver? */
|
||||||
|
@ -348,59 +348,49 @@ static int lxcDomainIsUpdated(virDomainPtr dom)
|
|||||||
static int lxcConnectListDomains(virConnectPtr conn, int *ids, int nids)
|
static int lxcConnectListDomains(virConnectPtr conn, int *ids, int nids)
|
||||||
{
|
{
|
||||||
virLXCDriverPtr driver = conn->privateData;
|
virLXCDriverPtr driver = conn->privateData;
|
||||||
int n;
|
|
||||||
|
|
||||||
if (virConnectListDomainsEnsureACL(conn) < 0)
|
if (virConnectListDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
n = virDomainObjListGetActiveIDs(driver->domains, ids, nids,
|
return virDomainObjListGetActiveIDs(driver->domains, ids, nids,
|
||||||
virConnectListDomainsCheckACL, conn);
|
virConnectListDomainsCheckACL, conn);
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lxcConnectNumOfDomains(virConnectPtr conn)
|
static int lxcConnectNumOfDomains(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
virLXCDriverPtr driver = conn->privateData;
|
virLXCDriverPtr driver = conn->privateData;
|
||||||
int n;
|
|
||||||
|
|
||||||
if (virConnectNumOfDomainsEnsureACL(conn) < 0)
|
if (virConnectNumOfDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
n = virDomainObjListNumOfDomains(driver->domains, true,
|
return virDomainObjListNumOfDomains(driver->domains, true,
|
||||||
virConnectNumOfDomainsCheckACL, conn);
|
virConnectNumOfDomainsCheckACL, conn);
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lxcConnectListDefinedDomains(virConnectPtr conn,
|
static int lxcConnectListDefinedDomains(virConnectPtr conn,
|
||||||
char **const names, int nnames)
|
char **const names, int nnames)
|
||||||
{
|
{
|
||||||
virLXCDriverPtr driver = conn->privateData;
|
virLXCDriverPtr driver = conn->privateData;
|
||||||
int n;
|
|
||||||
|
|
||||||
if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
|
if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
n = virDomainObjListGetInactiveNames(driver->domains, names, nnames,
|
return virDomainObjListGetInactiveNames(driver->domains, names, nnames,
|
||||||
virConnectListDefinedDomainsCheckACL, conn);
|
virConnectListDefinedDomainsCheckACL,
|
||||||
|
conn);
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int lxcConnectNumOfDefinedDomains(virConnectPtr conn)
|
static int lxcConnectNumOfDefinedDomains(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
virLXCDriverPtr driver = conn->privateData;
|
virLXCDriverPtr driver = conn->privateData;
|
||||||
int n;
|
|
||||||
|
|
||||||
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
|
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
n = virDomainObjListNumOfDomains(driver->domains, false,
|
return virDomainObjListNumOfDomains(driver->domains, false,
|
||||||
virConnectNumOfDefinedDomainsCheckACL, conn);
|
virConnectNumOfDefinedDomainsCheckACL,
|
||||||
|
conn);
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3254,16 +3244,14 @@ lxcConnectListAllDomains(virConnectPtr conn,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virLXCDriverPtr driver = conn->privateData;
|
virLXCDriverPtr driver = conn->privateData;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
|
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
|
||||||
|
|
||||||
if (virConnectListAllDomainsEnsureACL(conn) < 0)
|
if (virConnectListAllDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ret = virDomainObjListExport(driver->domains, conn, domains,
|
return virDomainObjListExport(driver->domains, conn, domains,
|
||||||
virConnectListAllDomainsCheckACL, flags);
|
virConnectListAllDomainsCheckACL, flags);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -703,7 +703,6 @@ static int
|
|||||||
lxcConvertNetworkSettings(virDomainDefPtr def, virConfPtr properties)
|
lxcConvertNetworkSettings(virDomainDefPtr def, virConfPtr properties)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
int result = -1;
|
|
||||||
size_t i;
|
size_t i;
|
||||||
lxcNetworkParseData data = {def, NULL, NULL, NULL, NULL,
|
lxcNetworkParseData data = {def, NULL, NULL, NULL, NULL,
|
||||||
NULL, NULL, NULL, NULL, 0,
|
NULL, NULL, NULL, NULL, 0,
|
||||||
@ -727,9 +726,7 @@ lxcConvertNetworkSettings(virDomainDefPtr def, virConfPtr properties)
|
|||||||
/* When no network type is provided LXC only adds loopback */
|
/* When no network type is provided LXC only adds loopback */
|
||||||
def->features[VIR_DOMAIN_FEATURE_PRIVNET] = VIR_TRISTATE_SWITCH_ON;
|
def->features[VIR_DOMAIN_FEATURE_PRIVNET] = VIR_TRISTATE_SWITCH_ON;
|
||||||
}
|
}
|
||||||
result = 0;
|
return 0;
|
||||||
|
|
||||||
return result;
|
|
||||||
|
|
||||||
error:
|
error:
|
||||||
for (i = 0; i < data.nips; i++)
|
for (i = 0; i < data.nips; i++)
|
||||||
|
@ -3128,17 +3128,13 @@ static int
|
|||||||
networkConnectNumOfNetworks(virConnectPtr conn)
|
networkConnectNumOfNetworks(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
virNetworkDriverStatePtr driver = networkGetDriver();
|
virNetworkDriverStatePtr driver = networkGetDriver();
|
||||||
int nactive;
|
|
||||||
|
|
||||||
if (virConnectNumOfNetworksEnsureACL(conn) < 0)
|
if (virConnectNumOfNetworksEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
nactive = virNetworkObjListNumOfNetworks(driver->networks,
|
return virNetworkObjListNumOfNetworks(driver->networks, true,
|
||||||
true,
|
virConnectNumOfNetworksCheckACL,
|
||||||
virConnectNumOfNetworksCheckACL,
|
conn);
|
||||||
conn);
|
|
||||||
|
|
||||||
return nactive;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3148,17 +3144,12 @@ networkConnectListNetworks(virConnectPtr conn,
|
|||||||
int maxnames)
|
int maxnames)
|
||||||
{
|
{
|
||||||
virNetworkDriverStatePtr driver = networkGetDriver();
|
virNetworkDriverStatePtr driver = networkGetDriver();
|
||||||
int got = 0;
|
|
||||||
|
|
||||||
if (virConnectListNetworksEnsureACL(conn) < 0)
|
if (virConnectListNetworksEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
got = virNetworkObjListGetNames(driver->networks,
|
return virNetworkObjListGetNames(driver->networks, true, names, maxnames,
|
||||||
true, names, maxnames,
|
virConnectListNetworksCheckACL, conn);
|
||||||
virConnectListNetworksCheckACL,
|
|
||||||
conn);
|
|
||||||
|
|
||||||
return got;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3166,17 +3157,13 @@ static int
|
|||||||
networkConnectNumOfDefinedNetworks(virConnectPtr conn)
|
networkConnectNumOfDefinedNetworks(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
virNetworkDriverStatePtr driver = networkGetDriver();
|
virNetworkDriverStatePtr driver = networkGetDriver();
|
||||||
int ninactive = 0;
|
|
||||||
|
|
||||||
if (virConnectNumOfDefinedNetworksEnsureACL(conn) < 0)
|
if (virConnectNumOfDefinedNetworksEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ninactive = virNetworkObjListNumOfNetworks(driver->networks,
|
return virNetworkObjListNumOfNetworks(driver->networks, false,
|
||||||
false,
|
virConnectNumOfDefinedNetworksCheckACL,
|
||||||
virConnectNumOfDefinedNetworksCheckACL,
|
conn);
|
||||||
conn);
|
|
||||||
|
|
||||||
return ninactive;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3186,16 +3173,13 @@ networkConnectListDefinedNetworks(virConnectPtr conn,
|
|||||||
int maxnames)
|
int maxnames)
|
||||||
{
|
{
|
||||||
virNetworkDriverStatePtr driver = networkGetDriver();
|
virNetworkDriverStatePtr driver = networkGetDriver();
|
||||||
int got = 0;
|
|
||||||
|
|
||||||
if (virConnectListDefinedNetworksEnsureACL(conn) < 0)
|
if (virConnectListDefinedNetworksEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
got = virNetworkObjListGetNames(driver->networks,
|
return virNetworkObjListGetNames(driver->networks, false, names, maxnames,
|
||||||
false, names, maxnames,
|
virConnectListDefinedNetworksCheckACL,
|
||||||
virConnectListDefinedNetworksCheckACL,
|
conn);
|
||||||
conn);
|
|
||||||
return got;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -704,19 +704,13 @@ nwfilterConnectListAllNWFilterBindings(virConnectPtr conn,
|
|||||||
virNWFilterBindingPtr **bindings,
|
virNWFilterBindingPtr **bindings,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
|
|
||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
if (virConnectListAllNWFilterBindingsEnsureACL(conn) < 0)
|
if (virConnectListAllNWFilterBindingsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ret = virNWFilterBindingObjListExport(driver->bindings,
|
return virNWFilterBindingObjListExport(driver->bindings, conn, bindings,
|
||||||
conn,
|
virConnectListAllNWFilterBindingsCheckACL);
|
||||||
bindings,
|
|
||||||
virConnectListAllNWFilterBindingsCheckACL);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3165,7 +3165,6 @@ phypDomainLookupByName(virConnectPtr conn, const char *lpar_name)
|
|||||||
{
|
{
|
||||||
phyp_driverPtr phyp_driver = conn->privateData;
|
phyp_driverPtr phyp_driver = conn->privateData;
|
||||||
LIBSSH2_SESSION *session = phyp_driver->session;
|
LIBSSH2_SESSION *session = phyp_driver->session;
|
||||||
virDomainPtr dom = NULL;
|
|
||||||
int lpar_id = 0;
|
int lpar_id = 0;
|
||||||
char *managed_system = phyp_driver->managed_system;
|
char *managed_system = phyp_driver->managed_system;
|
||||||
unsigned char lpar_uuid[VIR_UUID_BUFLEN];
|
unsigned char lpar_uuid[VIR_UUID_BUFLEN];
|
||||||
@ -3177,9 +3176,7 @@ phypDomainLookupByName(virConnectPtr conn, const char *lpar_name)
|
|||||||
if (phypGetLparUUID(lpar_uuid, lpar_id, conn) == -1)
|
if (phypGetLparUUID(lpar_uuid, lpar_id, conn) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dom = virGetDomain(conn, lpar_name, lpar_uuid, lpar_id);
|
return virGetDomain(conn, lpar_name, lpar_uuid, lpar_id);
|
||||||
|
|
||||||
return dom;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static virDomainPtr
|
static virDomainPtr
|
||||||
|
@ -698,20 +698,16 @@ int
|
|||||||
qemuBuildSecretInfoProps(qemuDomainSecretInfoPtr secinfo,
|
qemuBuildSecretInfoProps(qemuDomainSecretInfoPtr secinfo,
|
||||||
virJSONValuePtr *propsret)
|
virJSONValuePtr *propsret)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
g_autofree char *keyid = NULL;
|
g_autofree char *keyid = NULL;
|
||||||
|
|
||||||
if (!(keyid = qemuDomainGetMasterKeyAlias()))
|
if (!(keyid = qemuDomainGetMasterKeyAlias()))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ret = qemuMonitorCreateObjectProps(propsret,
|
return qemuMonitorCreateObjectProps(propsret, "secret",
|
||||||
"secret", secinfo->s.aes.alias,
|
secinfo->s.aes.alias, "s:data",
|
||||||
"s:data", secinfo->s.aes.ciphertext,
|
secinfo->s.aes.ciphertext, "s:keyid",
|
||||||
"s:keyid", keyid,
|
keyid, "s:iv", secinfo->s.aes.iv,
|
||||||
"s:iv", secinfo->s.aes.iv,
|
"s:format", "base64", NULL);
|
||||||
"s:format", "base64", NULL);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -10743,7 +10739,6 @@ qemuBuildStorageSourceAttachPrepareDrive(virDomainDiskDefPtr disk,
|
|||||||
virQEMUCapsPtr qemuCaps)
|
virQEMUCapsPtr qemuCaps)
|
||||||
{
|
{
|
||||||
g_autoptr(qemuBlockStorageSourceAttachData) data = NULL;
|
g_autoptr(qemuBlockStorageSourceAttachData) data = NULL;
|
||||||
qemuBlockStorageSourceAttachDataPtr ret = NULL;
|
|
||||||
|
|
||||||
if (VIR_ALLOC(data) < 0)
|
if (VIR_ALLOC(data) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -10752,9 +10747,7 @@ qemuBuildStorageSourceAttachPrepareDrive(virDomainDiskDefPtr disk,
|
|||||||
!(data->driveAlias = qemuAliasDiskDriveFromDisk(disk)))
|
!(data->driveAlias = qemuAliasDiskDriveFromDisk(disk)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ret = g_steal_pointer(&data);
|
return g_steal_pointer(&data);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1711,29 +1711,23 @@ static char *qemuConnectGetHostname(virConnectPtr conn)
|
|||||||
static int qemuConnectListDomains(virConnectPtr conn, int *ids, int nids)
|
static int qemuConnectListDomains(virConnectPtr conn, int *ids, int nids)
|
||||||
{
|
{
|
||||||
virQEMUDriverPtr driver = conn->privateData;
|
virQEMUDriverPtr driver = conn->privateData;
|
||||||
int n;
|
|
||||||
|
|
||||||
if (virConnectListDomainsEnsureACL(conn) < 0)
|
if (virConnectListDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
n = virDomainObjListGetActiveIDs(driver->domains, ids, nids,
|
return virDomainObjListGetActiveIDs(driver->domains, ids, nids,
|
||||||
virConnectListDomainsCheckACL, conn);
|
virConnectListDomainsCheckACL, conn);
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qemuConnectNumOfDomains(virConnectPtr conn)
|
static int qemuConnectNumOfDomains(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
virQEMUDriverPtr driver = conn->privateData;
|
virQEMUDriverPtr driver = conn->privateData;
|
||||||
int n;
|
|
||||||
|
|
||||||
if (virConnectNumOfDomainsEnsureACL(conn) < 0)
|
if (virConnectNumOfDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
n = virDomainObjListNumOfDomains(driver->domains, true,
|
return virDomainObjListNumOfDomains(driver->domains, true,
|
||||||
virConnectNumOfDomainsCheckACL, conn);
|
virConnectNumOfDomainsCheckACL, conn);
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4079,7 +4073,6 @@ static char *
|
|||||||
getAutoDumpPath(virQEMUDriverPtr driver,
|
getAutoDumpPath(virQEMUDriverPtr driver,
|
||||||
virDomainObjPtr vm)
|
virDomainObjPtr vm)
|
||||||
{
|
{
|
||||||
char *dumpfile = NULL;
|
|
||||||
g_autofree char *domname = virDomainDefGetShortName(vm->def);
|
g_autofree char *domname = virDomainDefGetShortName(vm->def);
|
||||||
char timestr[100];
|
char timestr[100];
|
||||||
struct tm time_info;
|
struct tm time_info;
|
||||||
@ -4094,9 +4087,7 @@ getAutoDumpPath(virQEMUDriverPtr driver,
|
|||||||
localtime_r(&curtime, &time_info);
|
localtime_r(&curtime, &time_info);
|
||||||
strftime(timestr, sizeof(timestr), "%Y-%m-%d-%H:%M:%S", &time_info);
|
strftime(timestr, sizeof(timestr), "%Y-%m-%d-%H:%M:%S", &time_info);
|
||||||
|
|
||||||
dumpfile = g_strdup_printf("%s/%s-%s", cfg->autoDumpPath, domname, timestr);
|
return g_strdup_printf("%s/%s-%s", cfg->autoDumpPath, domname, timestr);
|
||||||
|
|
||||||
return dumpfile;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -616,7 +616,6 @@ qemuFirmwareParse(const char *path)
|
|||||||
g_autofree char *cont = NULL;
|
g_autofree char *cont = NULL;
|
||||||
g_autoptr(virJSONValue) doc = NULL;
|
g_autoptr(virJSONValue) doc = NULL;
|
||||||
g_autoptr(qemuFirmware) fw = NULL;
|
g_autoptr(qemuFirmware) fw = NULL;
|
||||||
qemuFirmwarePtr ret = NULL;
|
|
||||||
|
|
||||||
if (virFileReadAll(path, DOCUMENT_SIZE, &cont) < 0)
|
if (virFileReadAll(path, DOCUMENT_SIZE, &cont) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -643,8 +642,7 @@ qemuFirmwareParse(const char *path)
|
|||||||
if (qemuFirmwareFeatureParse(path, doc, fw) < 0)
|
if (qemuFirmwareFeatureParse(path, doc, fw) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ret = g_steal_pointer(&fw);
|
return g_steal_pointer(&fw);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -9325,7 +9325,6 @@ qemuMonitorJSONGetJobInfoOne(virJSONValuePtr data)
|
|||||||
const char *errmsg = virJSONValueObjectGetString(data, "error");
|
const char *errmsg = virJSONValueObjectGetString(data, "error");
|
||||||
int tmp;
|
int tmp;
|
||||||
g_autoptr(qemuMonitorJobInfo) job = NULL;
|
g_autoptr(qemuMonitorJobInfo) job = NULL;
|
||||||
qemuMonitorJobInfoPtr ret = NULL;
|
|
||||||
|
|
||||||
if (VIR_ALLOC(job) < 0)
|
if (VIR_ALLOC(job) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -9343,8 +9342,7 @@ qemuMonitorJSONGetJobInfoOne(virJSONValuePtr data)
|
|||||||
job->id = g_strdup(id);
|
job->id = g_strdup(id);
|
||||||
job->error = g_strdup(errmsg);
|
job->error = g_strdup(errmsg);
|
||||||
|
|
||||||
ret = g_steal_pointer(&job);
|
return g_steal_pointer(&job);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7304,8 +7304,6 @@ qemuProcessCreatePretendCmd(virQEMUDriverPtr driver,
|
|||||||
int
|
int
|
||||||
qemuProcessKill(virDomainObjPtr vm, unsigned int flags)
|
qemuProcessKill(virDomainObjPtr vm, unsigned int flags)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
|
|
||||||
VIR_DEBUG("vm=%p name=%s pid=%lld flags=0x%x",
|
VIR_DEBUG("vm=%p name=%s pid=%lld flags=0x%x",
|
||||||
vm, vm->def->name,
|
vm, vm->def->name,
|
||||||
(long long)vm->pid, flags);
|
(long long)vm->pid, flags);
|
||||||
@ -7326,11 +7324,9 @@ qemuProcessKill(virDomainObjPtr vm, unsigned int flags)
|
|||||||
|
|
||||||
/* Request an extra delay of two seconds per current nhostdevs
|
/* Request an extra delay of two seconds per current nhostdevs
|
||||||
* to be safe against stalls by the kernel freeing up the resources */
|
* to be safe against stalls by the kernel freeing up the resources */
|
||||||
ret = virProcessKillPainfullyDelay(vm->pid,
|
return virProcessKillPainfullyDelay(vm->pid,
|
||||||
!!(flags & VIR_QEMU_PROCESS_KILL_FORCE),
|
!!(flags & VIR_QEMU_PROCESS_KILL_FORCE),
|
||||||
vm->def->nhostdevs * 2);
|
vm->def->nhostdevs * 2);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -7752,11 +7748,9 @@ int qemuProcessAutoDestroyAdd(virQEMUDriverPtr driver,
|
|||||||
int qemuProcessAutoDestroyRemove(virQEMUDriverPtr driver,
|
int qemuProcessAutoDestroyRemove(virQEMUDriverPtr driver,
|
||||||
virDomainObjPtr vm)
|
virDomainObjPtr vm)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
VIR_DEBUG("vm=%s", vm->def->name);
|
VIR_DEBUG("vm=%s", vm->def->name);
|
||||||
ret = virCloseCallbacksUnset(driver->closeCallbacks, vm,
|
return virCloseCallbacksUnset(driver->closeCallbacks, vm,
|
||||||
qemuProcessAutoDestroy);
|
qemuProcessAutoDestroy);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool qemuProcessAutoDestroyActive(virQEMUDriverPtr driver,
|
bool qemuProcessAutoDestroyActive(virQEMUDriverPtr driver,
|
||||||
|
@ -184,7 +184,6 @@ qemuVhostUserParse(const char *path)
|
|||||||
g_autofree char *cont = NULL;
|
g_autofree char *cont = NULL;
|
||||||
g_autoptr(virJSONValue) doc = NULL;
|
g_autoptr(virJSONValue) doc = NULL;
|
||||||
g_autoptr(qemuVhostUser) vu = NULL;
|
g_autoptr(qemuVhostUser) vu = NULL;
|
||||||
qemuVhostUserPtr ret = NULL;
|
|
||||||
|
|
||||||
if (virFileReadAll(path, DOCUMENT_SIZE, &cont) < 0)
|
if (virFileReadAll(path, DOCUMENT_SIZE, &cont) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -205,8 +204,7 @@ qemuVhostUserParse(const char *path)
|
|||||||
if (qemuVhostUserBinaryParse(path, doc, vu) < 0)
|
if (qemuVhostUserBinaryParse(path, doc, vu) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ret = g_steal_pointer(&vu);
|
return g_steal_pointer(&vu);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7492,10 +7492,7 @@ get_nonnull_storage_pool(virConnectPtr conn, remote_nonnull_storage_pool pool)
|
|||||||
static virStorageVolPtr
|
static virStorageVolPtr
|
||||||
get_nonnull_storage_vol(virConnectPtr conn, remote_nonnull_storage_vol vol)
|
get_nonnull_storage_vol(virConnectPtr conn, remote_nonnull_storage_vol vol)
|
||||||
{
|
{
|
||||||
virStorageVolPtr ret;
|
return virGetStorageVol(conn, vol.pool, vol.name, vol.key, NULL, NULL);
|
||||||
ret = virGetStorageVol(conn, vol.pool, vol.name, vol.key,
|
|
||||||
NULL, NULL);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static virSecretPtr
|
static virSecretPtr
|
||||||
|
@ -227,7 +227,6 @@ virStorageBackendISCSICheckPool(virStoragePoolObjPtr pool,
|
|||||||
bool *isActive)
|
bool *isActive)
|
||||||
{
|
{
|
||||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
||||||
int ret = -1;
|
|
||||||
g_autofree char *session = NULL;
|
g_autofree char *session = NULL;
|
||||||
|
|
||||||
*isActive = false;
|
*isActive = false;
|
||||||
@ -253,9 +252,7 @@ virStorageBackendISCSICheckPool(virStoragePoolObjPtr pool,
|
|||||||
|
|
||||||
if ((session = virStorageBackendISCSISession(pool, true)))
|
if ((session = virStorageBackendISCSISession(pool, true)))
|
||||||
*isActive = true;
|
*isActive = true;
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4880,14 +4880,10 @@ testDomainGetPerfEvents(virDomainPtr dom,
|
|||||||
static char *testDomainGetSchedulerType(virDomainPtr domain G_GNUC_UNUSED,
|
static char *testDomainGetSchedulerType(virDomainPtr domain G_GNUC_UNUSED,
|
||||||
int *nparams)
|
int *nparams)
|
||||||
{
|
{
|
||||||
char *type = NULL;
|
|
||||||
|
|
||||||
if (nparams)
|
if (nparams)
|
||||||
*nparams = 1;
|
*nparams = 1;
|
||||||
|
|
||||||
type = g_strdup("fair");
|
return g_strdup("fair");
|
||||||
|
|
||||||
return type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -5264,11 +5260,8 @@ static int
|
|||||||
testConnectNumOfNetworks(virConnectPtr conn)
|
testConnectNumOfNetworks(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
testDriverPtr privconn = conn->privateData;
|
testDriverPtr privconn = conn->privateData;
|
||||||
int numActive;
|
return virNetworkObjListNumOfNetworks(privconn->networks, true, NULL,
|
||||||
|
conn);
|
||||||
numActive = virNetworkObjListNumOfNetworks(privconn->networks,
|
|
||||||
true, NULL, conn);
|
|
||||||
return numActive;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5278,11 +5271,8 @@ testConnectListNetworks(virConnectPtr conn,
|
|||||||
int maxnames)
|
int maxnames)
|
||||||
{
|
{
|
||||||
testDriverPtr privconn = conn->privateData;
|
testDriverPtr privconn = conn->privateData;
|
||||||
int n;
|
return virNetworkObjListGetNames(privconn->networks, true, names,
|
||||||
|
maxnames, NULL, conn);
|
||||||
n = virNetworkObjListGetNames(privconn->networks,
|
|
||||||
true, names, maxnames, NULL, conn);
|
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5290,11 +5280,8 @@ static int
|
|||||||
testConnectNumOfDefinedNetworks(virConnectPtr conn)
|
testConnectNumOfDefinedNetworks(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
testDriverPtr privconn = conn->privateData;
|
testDriverPtr privconn = conn->privateData;
|
||||||
int numInactive;
|
return virNetworkObjListNumOfNetworks(privconn->networks, false, NULL,
|
||||||
|
conn);
|
||||||
numInactive = virNetworkObjListNumOfNetworks(privconn->networks,
|
|
||||||
false, NULL, conn);
|
|
||||||
return numInactive;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5304,11 +5291,8 @@ testConnectListDefinedNetworks(virConnectPtr conn,
|
|||||||
int maxnames)
|
int maxnames)
|
||||||
{
|
{
|
||||||
testDriverPtr privconn = conn->privateData;
|
testDriverPtr privconn = conn->privateData;
|
||||||
int n;
|
return virNetworkObjListGetNames(privconn->networks, false, names,
|
||||||
|
maxnames, NULL, conn);
|
||||||
n = virNetworkObjListGetNames(privconn->networks,
|
|
||||||
false, names, maxnames, NULL, conn);
|
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -401,11 +401,7 @@ virCgroupV1ValidatePlacement(virCgroupPtr group,
|
|||||||
static char *
|
static char *
|
||||||
virCgroupV1StealPlacement(virCgroupPtr group)
|
virCgroupV1StealPlacement(virCgroupPtr group)
|
||||||
{
|
{
|
||||||
char *ret = NULL;
|
return g_steal_pointer(&group->legacy[VIR_CGROUP_CONTROLLER_SYSTEMD].placement);
|
||||||
|
|
||||||
ret = g_steal_pointer(&group->legacy[VIR_CGROUP_CONTROLLER_SYSTEMD].placement);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -243,11 +243,7 @@ virCgroupV2ValidatePlacement(virCgroupPtr group,
|
|||||||
static char *
|
static char *
|
||||||
virCgroupV2StealPlacement(virCgroupPtr group)
|
virCgroupV2StealPlacement(virCgroupPtr group)
|
||||||
{
|
{
|
||||||
char *ret;
|
return g_steal_pointer(&group->unified.placement);
|
||||||
|
|
||||||
ret = g_steal_pointer(&group->unified.placement);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1177,15 +1177,12 @@ virDBusMessageEncodeArgs(DBusMessage* msg,
|
|||||||
va_list args)
|
va_list args)
|
||||||
{
|
{
|
||||||
DBusMessageIter iter;
|
DBusMessageIter iter;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
memset(&iter, 0, sizeof(iter));
|
memset(&iter, 0, sizeof(iter));
|
||||||
|
|
||||||
dbus_message_iter_init_append(msg, &iter);
|
dbus_message_iter_init_append(msg, &iter);
|
||||||
|
|
||||||
ret = virDBusMessageIterEncode(&iter, types, args);
|
return virDBusMessageIterEncode(&iter, types, args);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2138,7 +2138,6 @@ virJSONValuePtr
|
|||||||
virJSONValueObjectDeflatten(virJSONValuePtr json)
|
virJSONValueObjectDeflatten(virJSONValuePtr json)
|
||||||
{
|
{
|
||||||
g_autoptr(virJSONValue) deflattened = NULL;
|
g_autoptr(virJSONValue) deflattened = NULL;
|
||||||
virJSONValuePtr ret = NULL;
|
|
||||||
|
|
||||||
if (!(deflattened = virJSONValueNewObject()))
|
if (!(deflattened = virJSONValueNewObject()))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2148,7 +2147,5 @@ virJSONValueObjectDeflatten(virJSONValuePtr json)
|
|||||||
deflattened) < 0)
|
deflattened) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ret = g_steal_pointer(&deflattened);
|
return g_steal_pointer(&deflattened);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,6 @@ virMediatedDeviceCheckModel(virMediatedDevicePtr dev,
|
|||||||
virMediatedDevicePtr
|
virMediatedDevicePtr
|
||||||
virMediatedDeviceNew(const char *uuidstr, virMediatedDeviceModelType model)
|
virMediatedDeviceNew(const char *uuidstr, virMediatedDeviceModelType model)
|
||||||
{
|
{
|
||||||
virMediatedDevicePtr ret = NULL;
|
|
||||||
g_autoptr(virMediatedDevice) dev = NULL;
|
g_autoptr(virMediatedDevice) dev = NULL;
|
||||||
g_autofree char *sysfspath = NULL;
|
g_autofree char *sysfspath = NULL;
|
||||||
|
|
||||||
@ -165,9 +164,7 @@ virMediatedDeviceNew(const char *uuidstr, virMediatedDeviceModelType model)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dev->model = model;
|
dev->model = model;
|
||||||
ret = g_steal_pointer(&dev);
|
return g_steal_pointer(&dev);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -184,7 +184,6 @@ virSCSIDeviceNew(const char *sysfs_prefix,
|
|||||||
bool shareable)
|
bool shareable)
|
||||||
{
|
{
|
||||||
g_autoptr(virSCSIDevice) dev = NULL;
|
g_autoptr(virSCSIDevice) dev = NULL;
|
||||||
virSCSIDevicePtr ret = NULL;
|
|
||||||
g_autofree char *sg = NULL;
|
g_autofree char *sg = NULL;
|
||||||
g_autofree char *vendor_path = NULL;
|
g_autofree char *vendor_path = NULL;
|
||||||
g_autofree char *model_path = NULL;
|
g_autofree char *model_path = NULL;
|
||||||
@ -238,8 +237,7 @@ virSCSIDeviceNew(const char *sysfs_prefix,
|
|||||||
if (virAsprintf(&dev->id, "%s:%s", vendor, model) < 0)
|
if (virAsprintf(&dev->id, "%s:%s", vendor, model) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ret = g_steal_pointer(&dev);
|
return g_steal_pointer(&dev);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -249,7 +249,6 @@ virSCSIVHostDevicePtr
|
|||||||
virSCSIVHostDeviceNew(const char *name)
|
virSCSIVHostDeviceNew(const char *name)
|
||||||
{
|
{
|
||||||
g_autoptr(virSCSIVHostDevice) dev = NULL;
|
g_autoptr(virSCSIVHostDevice) dev = NULL;
|
||||||
virSCSIVHostDevicePtr ret = NULL;
|
|
||||||
|
|
||||||
if (VIR_ALLOC(dev) < 0)
|
if (VIR_ALLOC(dev) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -262,9 +261,7 @@ virSCSIVHostDeviceNew(const char *name)
|
|||||||
|
|
||||||
VIR_DEBUG("%s: initialized", dev->name);
|
VIR_DEBUG("%s: initialized", dev->name);
|
||||||
|
|
||||||
ret = g_steal_pointer(&dev);
|
return g_steal_pointer(&dev);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1128,7 +1128,6 @@ virStorageFileMetadataNew(const char *path,
|
|||||||
int format)
|
int format)
|
||||||
{
|
{
|
||||||
g_autoptr(virStorageSource) def = NULL;
|
g_autoptr(virStorageSource) def = NULL;
|
||||||
virStorageSourcePtr ret = NULL;
|
|
||||||
|
|
||||||
if (!(def = virStorageSourceNew()))
|
if (!(def = virStorageSourceNew()))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1138,8 +1137,7 @@ virStorageFileMetadataNew(const char *path,
|
|||||||
|
|
||||||
def->path = g_strdup(path);
|
def->path = g_strdup(path);
|
||||||
|
|
||||||
ret = g_steal_pointer(&def);
|
return g_steal_pointer(&def);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1211,7 +1209,6 @@ virStorageFileGetMetadataFromFD(const char *path,
|
|||||||
int *backingFormat)
|
int *backingFormat)
|
||||||
|
|
||||||
{
|
{
|
||||||
virStorageSourcePtr ret = NULL;
|
|
||||||
ssize_t len = VIR_STORAGE_MAX_HEADER;
|
ssize_t len = VIR_STORAGE_MAX_HEADER;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
int dummy;
|
int dummy;
|
||||||
@ -1237,8 +1234,7 @@ virStorageFileGetMetadataFromFD(const char *path,
|
|||||||
* update the metadata.*/
|
* update the metadata.*/
|
||||||
meta->type = VIR_STORAGE_TYPE_DIR;
|
meta->type = VIR_STORAGE_TYPE_DIR;
|
||||||
meta->format = VIR_STORAGE_FILE_DIR;
|
meta->format = VIR_STORAGE_FILE_DIR;
|
||||||
ret = g_steal_pointer(&meta);
|
return g_steal_pointer(&meta);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lseek(fd, 0, SEEK_SET) == (off_t)-1) {
|
if (lseek(fd, 0, SEEK_SET) == (off_t)-1) {
|
||||||
@ -1259,8 +1255,7 @@ virStorageFileGetMetadataFromFD(const char *path,
|
|||||||
else if (S_ISBLK(sb.st_mode))
|
else if (S_ISBLK(sb.st_mode))
|
||||||
meta->type = VIR_STORAGE_TYPE_BLOCK;
|
meta->type = VIR_STORAGE_TYPE_BLOCK;
|
||||||
|
|
||||||
ret = g_steal_pointer(&meta);
|
return g_steal_pointer(&meta);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1843,7 +1838,6 @@ virStorageAuthDefFree(virStorageAuthDefPtr authdef)
|
|||||||
virStorageAuthDefPtr
|
virStorageAuthDefPtr
|
||||||
virStorageAuthDefCopy(const virStorageAuthDef *src)
|
virStorageAuthDefCopy(const virStorageAuthDef *src)
|
||||||
{
|
{
|
||||||
virStorageAuthDefPtr ret = NULL;
|
|
||||||
g_autoptr(virStorageAuthDef) authdef = NULL;
|
g_autoptr(virStorageAuthDef) authdef = NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(authdef) < 0)
|
if (VIR_ALLOC(authdef) < 0)
|
||||||
@ -1857,8 +1851,7 @@ virStorageAuthDefCopy(const virStorageAuthDef *src)
|
|||||||
if (virSecretLookupDefCopy(&authdef->seclookupdef, &src->seclookupdef) < 0)
|
if (virSecretLookupDefCopy(&authdef->seclookupdef, &src->seclookupdef) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ret = g_steal_pointer(&authdef);
|
return g_steal_pointer(&authdef);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2228,7 +2221,6 @@ virStorageSourcePtr
|
|||||||
virStorageSourceCopy(const virStorageSource *src,
|
virStorageSourceCopy(const virStorageSource *src,
|
||||||
bool backingChain)
|
bool backingChain)
|
||||||
{
|
{
|
||||||
virStorageSourcePtr ret = NULL;
|
|
||||||
g_autoptr(virStorageSource) def = NULL;
|
g_autoptr(virStorageSource) def = NULL;
|
||||||
|
|
||||||
if (!(def = virStorageSourceNew()))
|
if (!(def = virStorageSourceNew()))
|
||||||
@ -2323,8 +2315,7 @@ virStorageSourceCopy(const virStorageSource *src,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&def);
|
return g_steal_pointer(&def);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2604,7 +2595,6 @@ static virStorageSourcePtr
|
|||||||
virStorageSourceNewFromBackingRelative(virStorageSourcePtr parent,
|
virStorageSourceNewFromBackingRelative(virStorageSourcePtr parent,
|
||||||
const char *rel)
|
const char *rel)
|
||||||
{
|
{
|
||||||
virStorageSourcePtr ret = NULL;
|
|
||||||
g_autofree char *dirname = NULL;
|
g_autofree char *dirname = NULL;
|
||||||
g_autoptr(virStorageSource) def = NULL;
|
g_autoptr(virStorageSource) def = NULL;
|
||||||
|
|
||||||
@ -2646,8 +2636,7 @@ virStorageSourceNewFromBackingRelative(virStorageSourcePtr parent,
|
|||||||
def->type = VIR_STORAGE_TYPE_FILE;
|
def->type = VIR_STORAGE_TYPE_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&def);
|
return g_steal_pointer(&def);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,10 +91,9 @@ static int vboxStoragePoolNumOfVolumes(virStoragePoolPtr pool)
|
|||||||
PRUint32 hardDiskAccessible = 0;
|
PRUint32 hardDiskAccessible = 0;
|
||||||
nsresult rc;
|
nsresult rc;
|
||||||
size_t i;
|
size_t i;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
if (!data->vboxObj)
|
if (!data->vboxObj)
|
||||||
return ret;
|
return -1;
|
||||||
|
|
||||||
rc = gVBoxAPI.UArray.vboxArrayGet(&hardDisks, data->vboxObj,
|
rc = gVBoxAPI.UArray.vboxArrayGet(&hardDisks, data->vboxObj,
|
||||||
gVBoxAPI.UArray.handleGetHardDisks(data->vboxObj));
|
gVBoxAPI.UArray.handleGetHardDisks(data->vboxObj));
|
||||||
@ -102,7 +101,7 @@ static int vboxStoragePoolNumOfVolumes(virStoragePoolPtr pool)
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("could not get number of volumes in the pool: %s, rc=%08x"),
|
_("could not get number of volumes in the pool: %s, rc=%08x"),
|
||||||
pool->name, (unsigned)rc);
|
pool->name, (unsigned)rc);
|
||||||
return ret;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < hardDisks.count; ++i) {
|
for (i = 0; i < hardDisks.count; ++i) {
|
||||||
@ -119,9 +118,7 @@ static int vboxStoragePoolNumOfVolumes(virStoragePoolPtr pool)
|
|||||||
|
|
||||||
gVBoxAPI.UArray.vboxArrayRelease(&hardDisks);
|
gVBoxAPI.UArray.vboxArrayRelease(&hardDisks);
|
||||||
|
|
||||||
ret = hardDiskAccessible;
|
return hardDiskAccessible;
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -132,10 +129,9 @@ vboxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names, int nname
|
|||||||
PRUint32 numActive = 0;
|
PRUint32 numActive = 0;
|
||||||
nsresult rc;
|
nsresult rc;
|
||||||
size_t i;
|
size_t i;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
if (!data->vboxObj)
|
if (!data->vboxObj)
|
||||||
return ret;
|
return -1;
|
||||||
|
|
||||||
rc = gVBoxAPI.UArray.vboxArrayGet(&hardDisks, data->vboxObj,
|
rc = gVBoxAPI.UArray.vboxArrayGet(&hardDisks, data->vboxObj,
|
||||||
gVBoxAPI.UArray.handleGetHardDisks(data->vboxObj));
|
gVBoxAPI.UArray.handleGetHardDisks(data->vboxObj));
|
||||||
@ -143,7 +139,7 @@ vboxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names, int nname
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("could not get the volume list in the pool: %s, rc=%08x"),
|
_("could not get the volume list in the pool: %s, rc=%08x"),
|
||||||
pool->name, (unsigned)rc);
|
pool->name, (unsigned)rc);
|
||||||
return ret;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < hardDisks.count && numActive < nnames; ++i) {
|
for (i = 0; i < hardDisks.count && numActive < nnames; ++i) {
|
||||||
@ -175,9 +171,7 @@ vboxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names, int nname
|
|||||||
}
|
}
|
||||||
|
|
||||||
gVBoxAPI.UArray.vboxArrayRelease(&hardDisks);
|
gVBoxAPI.UArray.vboxArrayRelease(&hardDisks);
|
||||||
ret = numActive;
|
return numActive;
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static virStorageVolPtr
|
static virStorageVolPtr
|
||||||
|
@ -210,13 +210,11 @@ static char *
|
|||||||
vzConnectGetCapabilities(virConnectPtr conn)
|
vzConnectGetCapabilities(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
vzConnPtr privconn = conn->privateData;
|
vzConnPtr privconn = conn->privateData;
|
||||||
char *xml;
|
|
||||||
|
|
||||||
if (virConnectGetCapabilitiesEnsureACL(conn) < 0)
|
if (virConnectGetCapabilitiesEnsureACL(conn) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
xml = virCapabilitiesFormatXML(privconn->driver->caps);
|
return virCapabilitiesFormatXML(privconn->driver->caps);
|
||||||
return xml;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -470,63 +468,53 @@ static int
|
|||||||
vzConnectListDomains(virConnectPtr conn, int *ids, int maxids)
|
vzConnectListDomains(virConnectPtr conn, int *ids, int maxids)
|
||||||
{
|
{
|
||||||
vzConnPtr privconn = conn->privateData;
|
vzConnPtr privconn = conn->privateData;
|
||||||
int n;
|
|
||||||
|
|
||||||
if (virConnectListDomainsEnsureACL(conn) < 0)
|
if (virConnectListDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
n = virDomainObjListGetActiveIDs(privconn->driver->domains, ids, maxids,
|
return virDomainObjListGetActiveIDs(privconn->driver->domains, ids,
|
||||||
virConnectListDomainsCheckACL, conn);
|
maxids, virConnectListDomainsCheckACL,
|
||||||
|
conn);
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vzConnectNumOfDomains(virConnectPtr conn)
|
vzConnectNumOfDomains(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
vzConnPtr privconn = conn->privateData;
|
vzConnPtr privconn = conn->privateData;
|
||||||
int count;
|
|
||||||
|
|
||||||
if (virConnectNumOfDomainsEnsureACL(conn) < 0)
|
if (virConnectNumOfDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
count = virDomainObjListNumOfDomains(privconn->driver->domains, true,
|
return virDomainObjListNumOfDomains(privconn->driver->domains, true,
|
||||||
virConnectNumOfDomainsCheckACL, conn);
|
virConnectNumOfDomainsCheckACL, conn);
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vzConnectListDefinedDomains(virConnectPtr conn, char **const names, int maxnames)
|
vzConnectListDefinedDomains(virConnectPtr conn, char **const names, int maxnames)
|
||||||
{
|
{
|
||||||
vzConnPtr privconn = conn->privateData;
|
vzConnPtr privconn = conn->privateData;
|
||||||
int n;
|
|
||||||
|
|
||||||
if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
|
if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memset(names, 0, sizeof(*names) * maxnames);
|
memset(names, 0, sizeof(*names) * maxnames);
|
||||||
n = virDomainObjListGetInactiveNames(privconn->driver->domains, names,
|
return virDomainObjListGetInactiveNames(privconn->driver->domains, names,
|
||||||
maxnames,
|
maxnames,
|
||||||
virConnectListDefinedDomainsCheckACL,
|
virConnectListDefinedDomainsCheckACL,
|
||||||
conn);
|
conn);
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vzConnectNumOfDefinedDomains(virConnectPtr conn)
|
vzConnectNumOfDefinedDomains(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
vzConnPtr privconn = conn->privateData;
|
vzConnPtr privconn = conn->privateData;
|
||||||
int count;
|
|
||||||
|
|
||||||
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
|
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
count = virDomainObjListNumOfDomains(privconn->driver->domains, false,
|
return virDomainObjListNumOfDomains(privconn->driver->domains, false,
|
||||||
virConnectNumOfDefinedDomainsCheckACL,
|
virConnectNumOfDefinedDomainsCheckACL,
|
||||||
conn);
|
conn);
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -535,17 +523,14 @@ vzConnectListAllDomains(virConnectPtr conn,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
vzConnPtr privconn = conn->privateData;
|
vzConnPtr privconn = conn->privateData;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
|
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
|
||||||
|
|
||||||
if (virConnectListAllDomainsEnsureACL(conn) < 0)
|
if (virConnectListAllDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ret = virDomainObjListExport(privconn->driver->domains, conn, domains,
|
return virDomainObjListExport(privconn->driver->domains, conn, domains,
|
||||||
virConnectListAllDomainsCheckACL, flags);
|
virConnectListAllDomainsCheckACL, flags);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static virDomainPtr
|
static virDomainPtr
|
||||||
|
@ -198,10 +198,7 @@ virNetDevRunEthernetScript(const char *ifname G_GNUC_UNUSED,
|
|||||||
char *
|
char *
|
||||||
virHostGetDRMRenderNode(void)
|
virHostGetDRMRenderNode(void)
|
||||||
{
|
{
|
||||||
char *dst = NULL;
|
return g_strdup("/dev/dri/foo");
|
||||||
|
|
||||||
dst = g_strdup("/dev/dri/foo");
|
|
||||||
return dst;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void (*real_virCommandPassFD)(virCommandPtr cmd, int fd, unsigned int flags);
|
static void (*real_virCommandPassFD)(virCommandPtr cmd, int fd, unsigned int flags);
|
||||||
|
@ -85,7 +85,6 @@ testStorageFileGetMetadata(const char *path,
|
|||||||
uid_t uid, gid_t gid)
|
uid_t uid, gid_t gid)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
virStorageSourcePtr ret = NULL;
|
|
||||||
g_autoptr(virStorageSource) def = NULL;
|
g_autoptr(virStorageSource) def = NULL;
|
||||||
|
|
||||||
if (!(def = virStorageSourceNew()))
|
if (!(def = virStorageSourceNew()))
|
||||||
@ -107,8 +106,7 @@ testStorageFileGetMetadata(const char *path,
|
|||||||
if (virStorageFileGetMetadata(def, uid, gid, false) < 0)
|
if (virStorageFileGetMetadata(def, uid, gid, false) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ret = g_steal_pointer(&def);
|
return g_steal_pointer(&def);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -87,7 +87,6 @@ virshDomainInterfaceCompleter(vshControl *ctl,
|
|||||||
g_autofree xmlNodePtr *interfaces = NULL;
|
g_autofree xmlNodePtr *interfaces = NULL;
|
||||||
size_t i;
|
size_t i;
|
||||||
unsigned int domainXMLFlags = 0;
|
unsigned int domainXMLFlags = 0;
|
||||||
char **ret = NULL;
|
|
||||||
VIR_AUTOSTRINGLIST tmp = NULL;
|
VIR_AUTOSTRINGLIST tmp = NULL;
|
||||||
|
|
||||||
virCheckFlags(VIRSH_DOMAIN_INTERFACE_COMPLETER_MAC, NULL);
|
virCheckFlags(VIRSH_DOMAIN_INTERFACE_COMPLETER_MAC, NULL);
|
||||||
@ -121,8 +120,7 @@ virshDomainInterfaceCompleter(vshControl *ctl,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
return g_steal_pointer(&tmp);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -138,7 +136,6 @@ virshDomainDiskTargetCompleter(vshControl *ctl,
|
|||||||
int ndisks;
|
int ndisks;
|
||||||
size_t i;
|
size_t i;
|
||||||
VIR_AUTOSTRINGLIST tmp = NULL;
|
VIR_AUTOSTRINGLIST tmp = NULL;
|
||||||
char **ret = NULL;
|
|
||||||
|
|
||||||
virCheckFlags(0, NULL);
|
virCheckFlags(0, NULL);
|
||||||
|
|
||||||
@ -161,8 +158,7 @@ virshDomainDiskTargetCompleter(vshControl *ctl,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
return g_steal_pointer(&tmp);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -172,7 +168,6 @@ virshDomainEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
char **ret = NULL;
|
|
||||||
VIR_AUTOSTRINGLIST tmp = NULL;
|
VIR_AUTOSTRINGLIST tmp = NULL;
|
||||||
|
|
||||||
virCheckFlags(0, NULL);
|
virCheckFlags(0, NULL);
|
||||||
@ -183,8 +178,7 @@ virshDomainEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
|
|||||||
for (i = 0; i < VIR_DOMAIN_EVENT_ID_LAST; i++)
|
for (i = 0; i < VIR_DOMAIN_EVENT_ID_LAST; i++)
|
||||||
tmp[i] = g_strdup(virshDomainEventCallbacks[i].name);
|
tmp[i] = g_strdup(virshDomainEventCallbacks[i].name);
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
return g_steal_pointer(&tmp);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -195,7 +189,6 @@ virshDomainInterfaceStateCompleter(vshControl *ctl,
|
|||||||
{
|
{
|
||||||
virshControlPtr priv = ctl->privData;
|
virshControlPtr priv = ctl->privData;
|
||||||
const char *iface = NULL;
|
const char *iface = NULL;
|
||||||
char **ret = NULL;
|
|
||||||
g_autoptr(xmlDoc) xml = NULL;
|
g_autoptr(xmlDoc) xml = NULL;
|
||||||
g_autoptr(xmlXPathContext) ctxt = NULL;
|
g_autoptr(xmlXPathContext) ctxt = NULL;
|
||||||
virMacAddr macaddr;
|
virMacAddr macaddr;
|
||||||
@ -244,8 +237,7 @@ virshDomainInterfaceStateCompleter(vshControl *ctl,
|
|||||||
tmp[0] = g_strdup("down");
|
tmp[0] = g_strdup("down");
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
return g_steal_pointer(&tmp);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -261,7 +253,6 @@ virshDomainDeviceAliasCompleter(vshControl *ctl,
|
|||||||
g_autofree xmlNodePtr *aliases = NULL;
|
g_autofree xmlNodePtr *aliases = NULL;
|
||||||
size_t i;
|
size_t i;
|
||||||
unsigned int domainXMLFlags = 0;
|
unsigned int domainXMLFlags = 0;
|
||||||
char **ret = NULL;
|
|
||||||
VIR_AUTOSTRINGLIST tmp = NULL;
|
VIR_AUTOSTRINGLIST tmp = NULL;
|
||||||
|
|
||||||
virCheckFlags(0, NULL);
|
virCheckFlags(0, NULL);
|
||||||
@ -287,8 +278,7 @@ virshDomainDeviceAliasCompleter(vshControl *ctl,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
return g_steal_pointer(&tmp);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,7 +64,6 @@ virshAllocpagesPagesizeCompleter(vshControl *ctl,
|
|||||||
bool cellno = vshCommandOptBool(cmd, "cellno");
|
bool cellno = vshCommandOptBool(cmd, "cellno");
|
||||||
g_autofree char *path = NULL;
|
g_autofree char *path = NULL;
|
||||||
g_autofree char *cap_xml = NULL;
|
g_autofree char *cap_xml = NULL;
|
||||||
char **ret = NULL;
|
|
||||||
VIR_AUTOSTRINGLIST tmp = NULL;
|
VIR_AUTOSTRINGLIST tmp = NULL;
|
||||||
|
|
||||||
virCheckFlags(0, NULL);
|
virCheckFlags(0, NULL);
|
||||||
@ -100,8 +99,7 @@ virshAllocpagesPagesizeCompleter(vshControl *ctl,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
return g_steal_pointer(&tmp);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -117,7 +115,6 @@ virshCellnoCompleter(vshControl *ctl,
|
|||||||
g_autoptr(xmlDoc) doc = NULL;
|
g_autoptr(xmlDoc) doc = NULL;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
g_autofree char *cap_xml = NULL;
|
g_autofree char *cap_xml = NULL;
|
||||||
char **ret = NULL;
|
|
||||||
VIR_AUTOSTRINGLIST tmp = NULL;
|
VIR_AUTOSTRINGLIST tmp = NULL;
|
||||||
|
|
||||||
virCheckFlags(0, NULL);
|
virCheckFlags(0, NULL);
|
||||||
@ -143,6 +140,5 @@ virshCellnoCompleter(vshControl *ctl,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
return g_steal_pointer(&tmp);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,6 @@ virshNodeDeviceEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
char **ret = NULL;
|
|
||||||
VIR_AUTOSTRINGLIST tmp = NULL;
|
VIR_AUTOSTRINGLIST tmp = NULL;
|
||||||
|
|
||||||
virCheckFlags(0, NULL);
|
virCheckFlags(0, NULL);
|
||||||
@ -83,8 +82,7 @@ virshNodeDeviceEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
|
|||||||
for (i = 0; i < VIR_NODE_DEVICE_EVENT_ID_LAST; i++)
|
for (i = 0; i < VIR_NODE_DEVICE_EVENT_ID_LAST; i++)
|
||||||
tmp[i] = g_strdup(virshNodeDeviceEventCallbacks[i].name);
|
tmp[i] = g_strdup(virshNodeDeviceEventCallbacks[i].name);
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
return g_steal_pointer(&tmp);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,7 +75,6 @@ virshPoolEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
char **ret = NULL;
|
|
||||||
VIR_AUTOSTRINGLIST tmp = NULL;
|
VIR_AUTOSTRINGLIST tmp = NULL;
|
||||||
|
|
||||||
virCheckFlags(0, NULL);
|
virCheckFlags(0, NULL);
|
||||||
@ -86,8 +85,7 @@ virshPoolEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
|
|||||||
for (i = 0; i < VIR_STORAGE_POOL_EVENT_ID_LAST; i++)
|
for (i = 0; i < VIR_STORAGE_POOL_EVENT_ID_LAST; i++)
|
||||||
tmp[i] = g_strdup(virshPoolEventCallbacks[i].name);
|
tmp[i] = g_strdup(virshPoolEventCallbacks[i].name);
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
return g_steal_pointer(&tmp);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,7 +73,6 @@ virshSecretEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
char **ret = NULL;
|
|
||||||
VIR_AUTOSTRINGLIST tmp = NULL;
|
VIR_AUTOSTRINGLIST tmp = NULL;
|
||||||
|
|
||||||
virCheckFlags(0, NULL);
|
virCheckFlags(0, NULL);
|
||||||
@ -84,6 +83,5 @@ virshSecretEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
|
|||||||
for (i = 0; i < VIR_SECRET_EVENT_ID_LAST; i++)
|
for (i = 0; i < VIR_SECRET_EVENT_ID_LAST; i++)
|
||||||
tmp[i] = g_strdup(virshSecretEventCallbacks[i].name);
|
tmp[i] = g_strdup(virshSecretEventCallbacks[i].name);
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
return g_steal_pointer(&tmp);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
@ -1384,8 +1384,6 @@ static const vshCmdOptDef opts_network_dhcp_leases[] = {
|
|||||||
static int
|
static int
|
||||||
virshNetworkDHCPLeaseSorter(const void *a, const void *b)
|
virshNetworkDHCPLeaseSorter(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
int rv = -1;
|
|
||||||
|
|
||||||
virNetworkDHCPLeasePtr *lease1 = (virNetworkDHCPLeasePtr *) a;
|
virNetworkDHCPLeasePtr *lease1 = (virNetworkDHCPLeasePtr *) a;
|
||||||
virNetworkDHCPLeasePtr *lease2 = (virNetworkDHCPLeasePtr *) b;
|
virNetworkDHCPLeasePtr *lease2 = (virNetworkDHCPLeasePtr *) b;
|
||||||
|
|
||||||
@ -1395,8 +1393,7 @@ virshNetworkDHCPLeaseSorter(const void *a, const void *b)
|
|||||||
if (!*lease1)
|
if (!*lease1)
|
||||||
return *lease2 != NULL;
|
return *lease2 != NULL;
|
||||||
|
|
||||||
rv = vshStrcasecmp((*lease1)->mac, (*lease2)->mac);
|
return vshStrcasecmp((*lease1)->mac, (*lease2)->mac);
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
@ -2898,10 +2898,7 @@ vshReadlineCompletion(const char *text,
|
|||||||
int start G_GNUC_UNUSED,
|
int start G_GNUC_UNUSED,
|
||||||
int end G_GNUC_UNUSED)
|
int end G_GNUC_UNUSED)
|
||||||
{
|
{
|
||||||
char **matches = (char **) NULL;
|
return rl_completion_matches(text, vshReadlineParse);
|
||||||
|
|
||||||
matches = rl_completion_matches(text, vshReadlineParse);
|
|
||||||
return matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user