2015-07-17 09:11:23 +00:00
|
|
|
/*
|
|
|
|
* virdomainobjlist.h: domain objects list utilities
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006-2015 Red Hat, Inc.
|
|
|
|
* Copyright (C) 2006-2008 Daniel P. Berrange
|
|
|
|
* Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2019-06-07 20:20:21 +00:00
|
|
|
#pragma once
|
2015-07-17 09:11:23 +00:00
|
|
|
|
2019-06-07 20:20:21 +00:00
|
|
|
#include "domain_conf.h"
|
2015-07-17 09:11:23 +00:00
|
|
|
|
|
|
|
typedef struct _virDomainObjList virDomainObjList;
|
|
|
|
|
2022-08-04 13:25:08 +00:00
|
|
|
virDomainObjList *
|
|
|
|
virDomainObjListNew(void);
|
|
|
|
|
|
|
|
virDomainObj *
|
|
|
|
virDomainObjListFindByID(virDomainObjList *doms,
|
|
|
|
int id);
|
|
|
|
virDomainObj *
|
|
|
|
virDomainObjListFindByUUID(virDomainObjList *doms,
|
|
|
|
const unsigned char *uuid);
|
|
|
|
virDomainObj *
|
|
|
|
virDomainObjListFindByName(virDomainObjList *doms,
|
|
|
|
const char *name);
|
2015-07-17 09:11:23 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
VIR_DOMAIN_OBJ_LIST_ADD_LIVE = (1 << 0),
|
|
|
|
VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE = (1 << 1),
|
|
|
|
};
|
2022-08-04 13:25:08 +00:00
|
|
|
virDomainObj *
|
|
|
|
virDomainObjListAdd(virDomainObjList *doms,
|
|
|
|
virDomainDef **def,
|
|
|
|
virDomainXMLOption *xmlopt,
|
|
|
|
unsigned int flags,
|
|
|
|
virDomainDef **oldDef);
|
2015-07-17 09:11:23 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
typedef int (*virDomainObjListRenameCallback)(virDomainObj *dom,
|
2016-02-01 09:33:45 +00:00
|
|
|
const char *new_name,
|
|
|
|
unsigned int flags,
|
|
|
|
void *opaque);
|
2022-08-04 13:25:08 +00:00
|
|
|
int
|
|
|
|
virDomainObjListRename(virDomainObjList *doms,
|
|
|
|
virDomainObj *dom,
|
|
|
|
const char *new_name,
|
|
|
|
unsigned int flags,
|
|
|
|
virDomainObjListRenameCallback callback,
|
|
|
|
void *opaque);
|
|
|
|
|
|
|
|
void
|
|
|
|
virDomainObjListRemove(virDomainObjList *doms,
|
|
|
|
virDomainObj *dom);
|
|
|
|
void
|
|
|
|
virDomainObjListRemoveLocked(virDomainObjList *doms,
|
|
|
|
virDomainObj *dom);
|
|
|
|
|
|
|
|
int
|
|
|
|
virDomainObjListLoadAllConfigs(virDomainObjList *doms,
|
|
|
|
const char *configDir,
|
|
|
|
const char *autostartDir,
|
|
|
|
bool liveStatus,
|
|
|
|
virDomainXMLOption *xmlopt,
|
|
|
|
virDomainLoadConfigNotify notify,
|
|
|
|
void *opaque);
|
|
|
|
|
|
|
|
int
|
|
|
|
virDomainObjListNumOfDomains(virDomainObjList *doms,
|
|
|
|
bool active,
|
|
|
|
virDomainObjListACLFilter filter,
|
|
|
|
virConnectPtr conn);
|
|
|
|
|
|
|
|
int
|
|
|
|
virDomainObjListGetActiveIDs(virDomainObjList *doms,
|
|
|
|
int *ids,
|
|
|
|
int maxids,
|
|
|
|
virDomainObjListACLFilter filter,
|
|
|
|
virConnectPtr conn);
|
|
|
|
int
|
|
|
|
virDomainObjListGetInactiveNames(virDomainObjList *doms,
|
|
|
|
char **const names,
|
|
|
|
int maxnames,
|
2015-07-17 09:11:23 +00:00
|
|
|
virDomainObjListACLFilter filter,
|
|
|
|
virConnectPtr conn);
|
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
typedef int (*virDomainObjListIterator)(virDomainObj *dom,
|
2015-07-17 09:11:23 +00:00
|
|
|
void *opaque);
|
|
|
|
|
2022-08-04 13:25:08 +00:00
|
|
|
int
|
|
|
|
virDomainObjListForEach(virDomainObjList *doms,
|
|
|
|
bool modify,
|
|
|
|
virDomainObjListIterator callback,
|
|
|
|
void *opaque);
|
2015-07-17 09:11:23 +00:00
|
|
|
|
2019-06-07 20:20:21 +00:00
|
|
|
#define VIR_CONNECT_LIST_DOMAINS_FILTERS_ACTIVE \
|
2015-07-17 09:11:23 +00:00
|
|
|
(VIR_CONNECT_LIST_DOMAINS_ACTIVE | \
|
|
|
|
VIR_CONNECT_LIST_DOMAINS_INACTIVE)
|
|
|
|
|
2019-06-07 20:20:21 +00:00
|
|
|
#define VIR_CONNECT_LIST_DOMAINS_FILTERS_PERSISTENT \
|
2015-07-17 09:11:23 +00:00
|
|
|
(VIR_CONNECT_LIST_DOMAINS_PERSISTENT | \
|
|
|
|
VIR_CONNECT_LIST_DOMAINS_TRANSIENT)
|
|
|
|
|
2019-06-07 20:20:21 +00:00
|
|
|
#define VIR_CONNECT_LIST_DOMAINS_FILTERS_STATE \
|
2015-07-17 09:11:23 +00:00
|
|
|
(VIR_CONNECT_LIST_DOMAINS_RUNNING | \
|
|
|
|
VIR_CONNECT_LIST_DOMAINS_PAUSED | \
|
|
|
|
VIR_CONNECT_LIST_DOMAINS_SHUTOFF | \
|
|
|
|
VIR_CONNECT_LIST_DOMAINS_OTHER)
|
|
|
|
|
2019-06-07 20:20:21 +00:00
|
|
|
#define VIR_CONNECT_LIST_DOMAINS_FILTERS_MANAGEDSAVE \
|
2015-07-17 09:11:23 +00:00
|
|
|
(VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE | \
|
|
|
|
VIR_CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE)
|
|
|
|
|
2019-06-07 20:20:21 +00:00
|
|
|
#define VIR_CONNECT_LIST_DOMAINS_FILTERS_AUTOSTART \
|
2015-07-17 09:11:23 +00:00
|
|
|
(VIR_CONNECT_LIST_DOMAINS_AUTOSTART | \
|
|
|
|
VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART)
|
|
|
|
|
2019-06-07 20:20:21 +00:00
|
|
|
#define VIR_CONNECT_LIST_DOMAINS_FILTERS_SNAPSHOT \
|
2015-07-17 09:11:23 +00:00
|
|
|
(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT | \
|
|
|
|
VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT)
|
|
|
|
|
2019-07-26 19:28:44 +00:00
|
|
|
#define VIR_CONNECT_LIST_DOMAINS_FILTERS_CHECKPOINT \
|
|
|
|
(VIR_CONNECT_LIST_DOMAINS_HAS_CHECKPOINT | \
|
|
|
|
VIR_CONNECT_LIST_DOMAINS_NO_CHECKPOINT)
|
|
|
|
|
2019-06-07 20:20:21 +00:00
|
|
|
#define VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL \
|
2015-07-17 09:11:23 +00:00
|
|
|
(VIR_CONNECT_LIST_DOMAINS_FILTERS_ACTIVE | \
|
|
|
|
VIR_CONNECT_LIST_DOMAINS_FILTERS_PERSISTENT | \
|
|
|
|
VIR_CONNECT_LIST_DOMAINS_FILTERS_STATE | \
|
|
|
|
VIR_CONNECT_LIST_DOMAINS_FILTERS_MANAGEDSAVE | \
|
|
|
|
VIR_CONNECT_LIST_DOMAINS_FILTERS_AUTOSTART | \
|
2019-07-26 19:28:44 +00:00
|
|
|
VIR_CONNECT_LIST_DOMAINS_FILTERS_SNAPSHOT | \
|
|
|
|
VIR_CONNECT_LIST_DOMAINS_FILTERS_CHECKPOINT)
|
2015-07-17 09:11:23 +00:00
|
|
|
|
2022-07-13 13:18:56 +00:00
|
|
|
void
|
|
|
|
virDomainObjListCollectAll(virDomainObjList *domlist,
|
|
|
|
virDomainObj ***vms,
|
|
|
|
size_t *nvms);
|
2022-08-04 13:29:53 +00:00
|
|
|
void
|
2022-08-04 13:25:08 +00:00
|
|
|
virDomainObjListCollect(virDomainObjList *doms,
|
|
|
|
virConnectPtr conn,
|
|
|
|
virDomainObj ***vms,
|
|
|
|
size_t *nvms,
|
|
|
|
virDomainObjListACLFilter filter,
|
|
|
|
unsigned int flags);
|
|
|
|
int
|
|
|
|
virDomainObjListExport(virDomainObjList *doms,
|
|
|
|
virConnectPtr conn,
|
|
|
|
virDomainPtr **domains,
|
|
|
|
virDomainObjListACLFilter filter,
|
|
|
|
unsigned int flags);
|
|
|
|
int
|
|
|
|
virDomainObjListConvert(virDomainObjList *domlist,
|
|
|
|
virConnectPtr conn,
|
|
|
|
virDomainPtr *doms,
|
|
|
|
size_t ndoms,
|
|
|
|
virDomainObj ***vms,
|
|
|
|
size_t *nvms,
|
|
|
|
virDomainObjListACLFilter filter,
|
|
|
|
unsigned int flags,
|
|
|
|
bool skip_missing);
|