vz_sdk.h 3.4 KB
Newer Older
1
/*
2
 * vz_sdk.h: core driver functions for managing
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 * 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>

25
#include "vz_utils.h"
26

27
int prlsdkInit(void);
28
void prlsdkDeinit(void);
29 30
int prlsdkConnect(vzDriverPtr driver);
void prlsdkDisconnect(vzDriverPtr driver);
31
int
32 33
prlsdkLoadDomains(vzDriverPtr driver);
int prlsdkUpdateDomain(vzDriverPtr driver, virDomainObjPtr dom);
34
int
35
prlsdkLoadDomain(vzDriverPtr driver,
36
                 virDomainObjPtr dom);
37 38
int prlsdkSubscribeToPCSEvents(vzDriverPtr driver);
void prlsdkUnsubscribeFromPCSEvents(vzDriverPtr driver);
39 40 41 42 43 44
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);
45
PRL_RESULT prlsdkRestart(PRL_HANDLE sdkdom);
46

47
typedef PRL_RESULT (*prlsdkChangeStateFunc)(PRL_HANDLE sdkdom);
48 49 50
int
prlsdkDomainChangeState(virDomainPtr domain,
                        prlsdkChangeStateFunc chstate);
51
int
52
prlsdkDomainChangeStateLocked(vzDriverPtr driver,
53 54 55
                              virDomainObjPtr dom,
                              prlsdkChangeStateFunc chstate);
int
56
prlsdkApplyConfig(vzDriverPtr driver,
57 58
                  virDomainObjPtr dom,
                  virDomainDefPtr new);
59 60
int prlsdkCreateVm(vzDriverPtr driver, virDomainDefPtr def);
int prlsdkCreateCt(vzDriverPtr driver, virDomainDefPtr def);
61
int
62
prlsdkUnregisterDomain(vzDriverPtr driver, virDomainObjPtr dom, unsigned int flags);
63
int
64
prlsdkDomainManagedSaveRemove(virDomainObjPtr dom);
65
int
66
prlsdkAttachVolume(vzDriverPtr driver, virDomainObjPtr dom, virDomainDiskDefPtr disk);
67 68
int
prlsdkDetachVolume(virDomainObjPtr dom, virDomainDiskDefPtr disk);
69 70
int
prlsdkGetBlockStats(virDomainObjPtr dom, virDomainDiskDefPtr disk, virDomainBlockStatsPtr stats);
71
int
72
prlsdkAttachNet(vzDriverPtr driver, virDomainObjPtr dom, virDomainNetDefPtr net);
73
int
74
prlsdkDetachNet(vzDriverPtr driver, virDomainObjPtr dom, virDomainNetDefPtr net);
75 76
int
prlsdkGetNetStats(virDomainObjPtr dom, const char *path, virDomainInterfaceStatsPtr stats);
N
Nikolay Shirokovskiy 已提交
77 78
int
prlsdkGetVcpuStats(virDomainObjPtr dom, int idx, unsigned long long *time);
N
Nikolay Shirokovskiy 已提交
79 80
int
prlsdkGetMemoryStats(virDomainObjPtr dom, virDomainMemoryStatPtr stats, unsigned int nr_stats);
81 82
void
prlsdkDomObjFreePrivate(void *p);
83 84
/* memsize is in MiB */
int prlsdkSetMemsize(virDomainObjPtr dom, unsigned int memsize);
85 86 87 88 89

virDomainSnapshotObjListPtr prlsdkLoadSnapshots(virDomainObjPtr dom);
int prlsdkCreateSnapshot(virDomainObjPtr dom, const char *description);
int prlsdkDeleteSnapshot(virDomainObjPtr dom, const char *uuid, bool children);
int prlsdkSwitchToSnapshot(virDomainObjPtr dom, const char *uuid, bool paused);