本文整理汇总了C++中parallelsDriverLock函数的典型用法代码示例。如果您正苦于以下问题:C++ parallelsDriverLock函数的具体用法?C++ parallelsDriverLock怎么用?C++ parallelsDriverLock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parallelsDriverLock函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: parallelsStoragePoolDestroy
static int
parallelsStoragePoolDestroy(virStoragePoolPtr pool)
{
parallelsConnPtr privconn = pool->conn->privateData;
virStoragePoolObjPtr privpool;
int ret = -1;
parallelsDriverLock(privconn);
privpool = virStoragePoolObjFindByName(&privconn->pools, pool->name);
if (privpool == NULL) {
parallelsPoolNotFoundError(pool->name);
goto cleanup;
}
if (!virStoragePoolObjIsActive(privpool)) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("storage pool '%s' is not active"), pool->name);
goto cleanup;
}
if (privpool->configFile == NULL) {
virStoragePoolObjRemove(&privconn->pools, privpool);
privpool = NULL;
}
ret = 0;
cleanup:
if (privpool)
virStoragePoolObjUnlock(privpool);
parallelsDriverUnlock(privconn);
return ret;
}
开发者ID:CLisa,项目名称:libvirt,代码行数:33,代码来源:parallels_storage.c
示例2: parallelsStorageVolLookupByKey
static virStorageVolPtr
parallelsStorageVolLookupByKey(virConnectPtr conn, const char *key)
{
parallelsConnPtr privconn = conn->privateData;
size_t i;
virStorageVolPtr ret = NULL;
parallelsDriverLock(privconn);
for (i = 0; i < privconn->pools.count; i++) {
virStoragePoolObjLock(privconn->pools.objs[i]);
if (virStoragePoolObjIsActive(privconn->pools.objs[i])) {
virStorageVolDefPtr privvol =
virStorageVolDefFindByKey(privconn->pools.objs[i], key);
if (privvol) {
ret = virGetStorageVol(conn,
privconn->pools.objs[i]->def->name,
privvol->name, privvol->key,
NULL, NULL);
virStoragePoolObjUnlock(privconn->pools.objs[i]);
break;
}
}
virStoragePoolObjUnlock(privconn->pools.objs[i]);
}
parallelsDriverUnlock(privconn);
if (!ret)
virReportError(VIR_ERR_NO_STORAGE_VOL,
_("no storage vol with matching key '%s'"), key);
return ret;
}
开发者ID:CLisa,项目名称:libvirt,代码行数:33,代码来源:parallels_storage.c
示例3: parallelsStoragePoolGetInfo
static int
parallelsStoragePoolGetInfo(virStoragePoolPtr pool, virStoragePoolInfoPtr info)
{
parallelsConnPtr privconn = pool->conn->privateData;
virStoragePoolObjPtr privpool;
int ret = -1;
parallelsDriverLock(privconn);
privpool = virStoragePoolObjFindByName(&privconn->pools, pool->name);
parallelsDriverUnlock(privconn);
if (privpool == NULL) {
parallelsPoolNotFoundError(pool->name);
goto cleanup;
}
memset(info, 0, sizeof(virStoragePoolInfo));
if (privpool->active)
info->state = VIR_STORAGE_POOL_RUNNING;
else
info->state = VIR_STORAGE_POOL_INACTIVE;
info->capacity = privpool->def->capacity;
info->allocation = privpool->def->allocation;
info->available = privpool->def->available;
ret = 0;
cleanup:
if (privpool)
virStoragePoolObjUnlock(privpool);
return ret;
}
开发者ID:CLisa,项目名称:libvirt,代码行数:31,代码来源:parallels_storage.c
示例4: parallelsStoragePoolRefresh
static int
parallelsStoragePoolRefresh(virStoragePoolPtr pool, unsigned int flags)
{
parallelsConnPtr privconn = pool->conn->privateData;
virStoragePoolObjPtr privpool;
int ret = -1;
virCheckFlags(0, -1);
parallelsDriverLock(privconn);
privpool = virStoragePoolObjFindByName(&privconn->pools, pool->name);
parallelsDriverUnlock(privconn);
if (privpool == NULL) {
parallelsPoolNotFoundError(pool->name);
goto cleanup;
}
if (!virStoragePoolObjIsActive(privpool)) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("storage pool '%s' is not active"), pool->name);
goto cleanup;
}
ret = 0;
cleanup:
if (privpool)
virStoragePoolObjUnlock(privpool);
return ret;
}
开发者ID:CLisa,项目名称:libvirt,代码行数:30,代码来源:parallels_storage.c
示例5: virCheckFlags
static char *parallelsNetworkGetXMLDesc(virNetworkPtr net,
unsigned int flags)
{
parallelsConnPtr privconn = net->conn->privateData;
virNetworkObjPtr network;
char *ret = NULL;
virCheckFlags(VIR_NETWORK_XML_INACTIVE, NULL);
parallelsDriverLock(privconn);
network = virNetworkFindByUUID(&privconn->networks, net->uuid);
parallelsDriverUnlock(privconn);
if (!network) {
virReportError(VIR_ERR_NO_NETWORK,
"%s", _("no network with matching uuid"));
goto cleanup;
}
ret = virNetworkDefFormat(network->def, flags);
cleanup:
if (network)
virNetworkObjUnlock(network);
return ret;
}
开发者ID:bigclouds,项目名称:libvirt,代码行数:26,代码来源:parallels_network.c
示例6: parallelsStoragePoolGetXMLDesc
static char *
parallelsStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
{
parallelsConnPtr privconn = pool->conn->privateData;
virStoragePoolObjPtr privpool;
char *ret = NULL;
virCheckFlags(0, NULL);
parallelsDriverLock(privconn);
privpool = virStoragePoolObjFindByName(&privconn->pools, pool->name);
parallelsDriverUnlock(privconn);
if (privpool == NULL) {
parallelsPoolNotFoundError(pool->name);
goto cleanup;
}
ret = virStoragePoolDefFormat(privpool->def);
cleanup:
if (privpool)
virStoragePoolObjUnlock(privpool);
return ret;
}
开发者ID:CLisa,项目名称:libvirt,代码行数:25,代码来源:parallels_storage.c
示例7: parallelsStoragePoolGetAutostart
static int
parallelsStoragePoolGetAutostart(virStoragePoolPtr pool, int *autostart)
{
parallelsConnPtr privconn = pool->conn->privateData;
virStoragePoolObjPtr privpool;
int ret = -1;
parallelsDriverLock(privconn);
privpool = virStoragePoolObjFindByName(&privconn->pools, pool->name);
parallelsDriverUnlock(privconn);
if (privpool == NULL) {
parallelsPoolNotFoundError(pool->name);
goto cleanup;
}
if (!privpool->configFile) {
*autostart = 0;
} else {
*autostart = privpool->autostart;
}
ret = 0;
cleanup:
if (privpool)
virStoragePoolObjUnlock(privpool);
return ret;
}
开发者ID:CLisa,项目名称:libvirt,代码行数:28,代码来源:parallels_storage.c
示例8: parallelsStoragePoolSetAutostart
static int
parallelsStoragePoolSetAutostart(virStoragePoolPtr pool, int autostart)
{
parallelsConnPtr privconn = pool->conn->privateData;
virStoragePoolObjPtr privpool;
int ret = -1;
parallelsDriverLock(privconn);
privpool = virStoragePoolObjFindByName(&privconn->pools, pool->name);
parallelsDriverUnlock(privconn);
if (privpool == NULL) {
parallelsPoolNotFoundError(pool->name);
goto cleanup;
}
if (!privpool->configFile) {
virReportError(VIR_ERR_INVALID_ARG, "%s", _("pool has no config file"));
goto cleanup;
}
privpool->autostart = (autostart != 0);
ret = 0;
cleanup:
if (privpool)
virStoragePoolObjUnlock(privpool);
return ret;
}
开发者ID:CLisa,项目名称:libvirt,代码行数:29,代码来源:parallels_storage.c
示例9: parallelsListDefinedNetworks
static int parallelsListDefinedNetworks(virConnectPtr conn,
char **const names,
int nnames)
{
parallelsConnPtr privconn = conn->privateData;
int got = 0, i;
parallelsDriverLock(privconn);
for (i = 0 ; i < privconn->networks.count && got < nnames ; i++) {
virNetworkObjLock(privconn->networks.objs[i]);
if (!virNetworkObjIsActive(privconn->networks.objs[i])) {
if (!(names[got] = strdup(privconn->networks.objs[i]->def->name))) {
virNetworkObjUnlock(privconn->networks.objs[i]);
virReportOOMError();
goto cleanup;
}
got++;
}
virNetworkObjUnlock(privconn->networks.objs[i]);
}
parallelsDriverUnlock(privconn);
return got;
cleanup:
parallelsDriverUnlock(privconn);
for (i = 0 ; i < got ; i++)
VIR_FREE(names[i]);
return -1;
}
开发者ID:bigclouds,项目名称:libvirt,代码行数:29,代码来源:parallels_network.c
示例10: parallelsConnectListDefinedStoragePools
static int
parallelsConnectListDefinedStoragePools(virConnectPtr conn,
char **const names, int nnames)
{
parallelsConnPtr privconn = conn->privateData;
int n = 0;
size_t i;
parallelsDriverLock(privconn);
memset(names, 0, sizeof(*names) * nnames);
for (i = 0; i < privconn->pools.count && n < nnames; i++) {
virStoragePoolObjLock(privconn->pools.objs[i]);
if (!virStoragePoolObjIsActive(privconn->pools.objs[i]) &&
VIR_STRDUP(names[n++], privconn->pools.objs[i]->def->name) < 0) {
virStoragePoolObjUnlock(privconn->pools.objs[i]);
goto error;
}
virStoragePoolObjUnlock(privconn->pools.objs[i]);
}
parallelsDriverUnlock(privconn);
return n;
error:
for (n = 0; n < nnames; n++)
VIR_FREE(names[n]);
parallelsDriverUnlock(privconn);
return -1;
}
开发者ID:CLisa,项目名称:libvirt,代码行数:29,代码来源:parallels_storage.c
示例11: parallelsCloseNetwork
static int parallelsCloseNetwork(virConnectPtr conn)
{
parallelsConnPtr privconn = conn->privateData;
parallelsDriverLock(privconn);
virNetworkObjListFree(&privconn->networks);
parallelsDriverUnlock(privconn);
return 0;
}
开发者ID:bigclouds,项目名称:libvirt,代码行数:8,代码来源:parallels_network.c
示例12: parallelsConnectGetCapabilities
static char *
parallelsConnectGetCapabilities(virConnectPtr conn)
{
parallelsConnPtr privconn = conn->privateData;
char *xml;
parallelsDriverLock(privconn);
xml = virCapabilitiesFormatXML(privconn->caps);
parallelsDriverUnlock(privconn);
return xml;
}
开发者ID:SvenDowideit,项目名称:clearlinux,代码行数:11,代码来源:parallels_driver.c
示例13: parallelsStoragePoolDefineXML
static virStoragePoolPtr
parallelsStoragePoolDefineXML(virConnectPtr conn,
const char *xml, unsigned int flags)
{
parallelsConnPtr privconn = conn->privateData;
virStoragePoolDefPtr def;
virStoragePoolObjPtr pool = NULL;
virStoragePoolPtr ret = NULL;
virCheckFlags(0, NULL);
parallelsDriverLock(privconn);
if (!(def = virStoragePoolDefParseString(xml)))
goto cleanup;
if (def->type != VIR_STORAGE_POOL_DIR) {
virReportError(VIR_ERR_NO_SUPPORT, "%s",
_("Only local directories are supported"));
goto cleanup;
}
if (virStoragePoolObjIsDuplicate(&privconn->pools, def, 0) < 0)
goto cleanup;
if (virStoragePoolSourceFindDuplicate(&privconn->pools, def) < 0)
goto cleanup;
if (parallelsStoragePoolGetAlloc(def))
goto cleanup;
if (!(pool = virStoragePoolObjAssignDef(&privconn->pools, def)))
goto cleanup;
if (virStoragePoolObjSaveDef(conn->storagePrivateData, pool, def) < 0) {
virStoragePoolObjRemove(&privconn->pools, pool);
def = NULL;
goto cleanup;
}
def = NULL;
if (VIR_STRDUP(pool->configFile, "\0") < 0)
goto cleanup;
ret = virGetStoragePool(conn, pool->def->name, pool->def->uuid,
NULL, NULL);
cleanup:
virStoragePoolDefFree(def);
if (pool)
virStoragePoolObjUnlock(pool);
parallelsDriverUnlock(privconn);
return ret;
}
开发者ID:CLisa,项目名称:libvirt,代码行数:53,代码来源:parallels_storage.c
示例14: parallelsStorageVolLookupByPath
static virStorageVolPtr
parallelsStorageVolLookupByPath(virConnectPtr conn, const char *path)
{
parallelsConnPtr privconn = conn->privateData;
virStorageVolPtr ret = NULL;
parallelsDriverLock(privconn);
ret = parallelsStorageVolLookupByPathLocked(conn, path);
parallelsDriverUnlock(privconn);
return ret;
}
开发者ID:CLisa,项目名称:libvirt,代码行数:12,代码来源:parallels_storage.c
示例15: parallelsListAllNetworks
static int parallelsListAllNetworks(virConnectPtr conn,
virNetworkPtr **nets,
unsigned int flags)
{
parallelsConnPtr privconn = conn->privateData;
int ret = -1;
virCheckFlags(VIR_CONNECT_LIST_NETWORKS_FILTERS_ALL, -1);
parallelsDriverLock(privconn);
ret = virNetworkList(conn, privconn->networks, nets, flags);
parallelsDriverUnlock(privconn);
return ret;
}
开发者ID:bigclouds,项目名称:libvirt,代码行数:15,代码来源:parallels_network.c
示例16: parallelsConnectNumOfStoragePools
static int
parallelsConnectNumOfStoragePools(virConnectPtr conn)
{
parallelsConnPtr privconn = conn->privateData;
int numActive = 0;
size_t i;
parallelsDriverLock(privconn);
for (i = 0; i < privconn->pools.count; i++)
if (virStoragePoolObjIsActive(privconn->pools.objs[i]))
numActive++;
parallelsDriverUnlock(privconn);
return numActive;
}
开发者ID:CLisa,项目名称:libvirt,代码行数:15,代码来源:parallels_storage.c
示例17: parallelsNumDefinedNetworks
static int parallelsNumDefinedNetworks(virConnectPtr conn)
{
int ninactive = 0, i;
parallelsConnPtr privconn = conn->privateData;
parallelsDriverLock(privconn);
for (i = 0 ; i < privconn->networks.count ; i++) {
virNetworkObjLock(privconn->networks.objs[i]);
if (!virNetworkObjIsActive(privconn->networks.objs[i]))
ninactive++;
virNetworkObjUnlock(privconn->networks.objs[i]);
}
parallelsDriverUnlock(privconn);
return ninactive;
}
开发者ID:bigclouds,项目名称:libvirt,代码行数:16,代码来源:parallels_network.c
示例18: parallelsStorageVolDelete
static int
parallelsStorageVolDelete(virStorageVolPtr vol, unsigned int flags)
{
parallelsConnPtr privconn = vol->conn->privateData;
virStoragePoolObjPtr privpool;
virStorageVolDefPtr privvol;
int ret = -1;
virCheckFlags(0, -1);
parallelsDriverLock(privconn);
privpool = virStoragePoolObjFindByName(&privconn->pools, vol->pool);
parallelsDriverUnlock(privconn);
if (privpool == NULL) {
parallelsPoolNotFoundError(vol->pool);
goto cleanup;
}
privvol = virStorageVolDefFindByName(privpool, vol->name);
if (privvol == NULL) {
virReportError(VIR_ERR_NO_STORAGE_VOL,
_("no storage vol with matching name '%s'"), vol->name);
goto cleanup;
}
if (!virStoragePoolObjIsActive(privpool)) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("storage pool '%s' is not active"), vol->pool);
goto cleanup;
}
if (parallelsStorageVolDefRemove(privpool, privvol))
goto cleanup;
ret = 0;
cleanup:
if (privpool)
virStoragePoolObjUnlock(privpool);
return ret;
}
开发者ID:CLisa,项目名称:libvirt,代码行数:45,代码来源:parallels_storage.c
示例19: parallelsStoragePoolListVolumes
static int
parallelsStoragePoolListVolumes(virStoragePoolPtr pool,
char **const names, int maxnames)
{
parallelsConnPtr privconn = pool->conn->privateData;
virStoragePoolObjPtr privpool;
int n = 0;
size_t i = 0;
memset(names, 0, maxnames * sizeof(*names));
parallelsDriverLock(privconn);
privpool = virStoragePoolObjFindByName(&privconn->pools, pool->name);
parallelsDriverUnlock(privconn);
if (privpool == NULL) {
parallelsPoolNotFoundError(pool->name);
goto error;
}
if (!virStoragePoolObjIsActive(privpool)) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("storage pool '%s' is not active"), pool->name);
goto error;
}
for (i = 0; i < privpool->volumes.count && n < maxnames; i++) {
if (VIR_STRDUP(names[n++], privpool->volumes.objs[i]->name) < 0)
goto error;
}
virStoragePoolObjUnlock(privpool);
return n;
error:
for (n = 0; n < maxnames; n++)
VIR_FREE(names[i]);
if (privpool)
virStoragePoolObjUnlock(privpool);
return -1;
}
开发者ID:CLisa,项目名称:libvirt,代码行数:43,代码来源:parallels_storage.c
示例20: parallelsStorageVolLookupByName
static virStorageVolPtr
parallelsStorageVolLookupByName(virStoragePoolPtr pool,
const char *name)
{
parallelsConnPtr privconn = pool->conn->privateData;
virStoragePoolObjPtr privpool;
virStorageVolDefPtr privvol;
virStorageVolPtr ret = NULL;
parallelsDriverLock(privconn);
privpool = virStoragePoolObjFindByName(&privconn->pools, pool->name);
parallelsDriverUnlock(privconn);
if (privpool == NULL) {
parallelsPoolNotFoundError(pool->name);
goto cleanup;
}
if (!virStoragePoolObjIsActive(privpool)) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("storage pool '%s' is not active"), pool->name);
goto cleanup;
}
privvol = virStorageVolDefFindByName(privpool, name);
if (!privvol) {
virReportError(VIR_ERR_NO_STORAGE_VOL,
_("no storage vol with matching name '%s'"), name);
goto cleanup;
}
ret = virGetStorageVol(pool->conn, privpool->def->name,
privvol->name, privvol->key,
NULL, NULL);
cleanup:
if (privpool)
virStoragePoolObjUnlock(privpool);
return ret;
}
开发者ID:CLisa,项目名称:libvirt,代码行数:42,代码来源:parallels_storage.c
注:本文中的parallelsDriverLock函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论