mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-07 14:55:46 +00:00
7762c5a233
This patch introduces a new 'vzDriver' lockable object and provides helper functions to allocate/destroy it and we pass it to prlsdkXxx functions instead of virConnectPtr. Now we store domain related objects such as domain list, capabitilies etc. within a single vz_driver vzDriver structure, which is shared by all driver connections. It is allocated during daemon initialization or in a lazy manner when a new connection to 'vz' driver is established. When a connection to vz daemon drops, vzDestroyConnection is called, which in turn relays disconnect event to all connection to 'vz' driver. Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
85 lines
3.1 KiB
C
85 lines
3.1 KiB
C
/*
|
|
* vz_sdk.h: core driver functions for managing
|
|
* Parallels Cloud Server hosts
|
|
*
|
|
* Copyright (C) 2014 Parallels, Inc.
|
|
*
|
|
* 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/>.
|
|
*
|
|
*/
|
|
|
|
#include <Parallels.h>
|
|
|
|
#include "vz_utils.h"
|
|
|
|
int prlsdkInit(void);
|
|
void prlsdkDeinit(void);
|
|
int prlsdkConnect(vzDriverPtr driver);
|
|
void prlsdkDisconnect(vzDriverPtr driver);
|
|
int
|
|
prlsdkLoadDomains(vzDriverPtr driver);
|
|
int prlsdkUpdateDomain(vzDriverPtr driver, virDomainObjPtr dom);
|
|
int
|
|
prlsdkLoadDomain(vzDriverPtr driver,
|
|
virDomainObjPtr dom);
|
|
int prlsdkSubscribeToPCSEvents(vzDriverPtr driver);
|
|
void prlsdkUnsubscribeFromPCSEvents(vzDriverPtr driver);
|
|
PRL_RESULT prlsdkStart(PRL_HANDLE sdkdom);
|
|
PRL_RESULT prlsdkKill(PRL_HANDLE sdkdom);
|
|
PRL_RESULT prlsdkStop(PRL_HANDLE sdkdom);
|
|
PRL_RESULT prlsdkPause(PRL_HANDLE sdkdom);
|
|
PRL_RESULT prlsdkResume(PRL_HANDLE sdkdom);
|
|
PRL_RESULT prlsdkSuspend(PRL_HANDLE sdkdom);
|
|
PRL_RESULT prlsdkRestart(PRL_HANDLE sdkdom);
|
|
|
|
typedef PRL_RESULT (*prlsdkChangeStateFunc)(PRL_HANDLE sdkdom);
|
|
int
|
|
prlsdkDomainChangeState(virDomainPtr domain,
|
|
prlsdkChangeStateFunc chstate);
|
|
int
|
|
prlsdkDomainChangeStateLocked(vzDriverPtr driver,
|
|
virDomainObjPtr dom,
|
|
prlsdkChangeStateFunc chstate);
|
|
int
|
|
prlsdkApplyConfig(vzDriverPtr driver,
|
|
virDomainObjPtr dom,
|
|
virDomainDefPtr new);
|
|
int prlsdkCreateVm(vzDriverPtr driver, virDomainDefPtr def);
|
|
int prlsdkCreateCt(vzDriverPtr driver, virDomainDefPtr def);
|
|
int
|
|
prlsdkUnregisterDomain(vzDriverPtr driver, virDomainObjPtr dom, unsigned int flags);
|
|
int
|
|
prlsdkDomainManagedSaveRemove(virDomainObjPtr dom);
|
|
int
|
|
prlsdkAttachVolume(vzDriverPtr driver, virDomainObjPtr dom, virDomainDiskDefPtr disk);
|
|
int
|
|
prlsdkDetachVolume(virDomainObjPtr dom, virDomainDiskDefPtr disk);
|
|
int
|
|
prlsdkGetBlockStats(virDomainObjPtr dom, virDomainDiskDefPtr disk, virDomainBlockStatsPtr stats);
|
|
int
|
|
prlsdkAttachNet(vzDriverPtr driver, virDomainObjPtr dom, virDomainNetDefPtr net);
|
|
int
|
|
prlsdkDetachNet(vzDriverPtr driver, virDomainObjPtr dom, virDomainNetDefPtr net);
|
|
int
|
|
prlsdkGetNetStats(virDomainObjPtr dom, const char *path, virDomainInterfaceStatsPtr stats);
|
|
int
|
|
prlsdkGetVcpuStats(virDomainObjPtr dom, int idx, unsigned long long *time);
|
|
int
|
|
prlsdkGetMemoryStats(virDomainObjPtr dom, virDomainMemoryStatPtr stats, unsigned int nr_stats);
|
|
void
|
|
prlsdkDomObjFreePrivate(void *p);
|
|
/* memsize is in MiB */
|
|
int prlsdkSetMemsize(virDomainObjPtr dom, unsigned int memsize);
|