2012-07-31 18:56:07 +00:00
|
|
|
/*
|
|
|
|
* parallels_utils.h: core driver functions for managing
|
|
|
|
* Parallels Cloud Server hosts
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 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/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PARALLELS_UTILS_H
|
|
|
|
# define PARALLELS_UTILS_H
|
|
|
|
|
2014-09-11 16:24:03 +00:00
|
|
|
# include <Parallels.h>
|
|
|
|
|
2012-08-01 03:46:22 +00:00
|
|
|
# include "driver.h"
|
|
|
|
# include "conf/domain_conf.h"
|
|
|
|
# include "conf/storage_conf.h"
|
|
|
|
# include "conf/domain_event.h"
|
2012-12-11 10:59:45 +00:00
|
|
|
# include "conf/network_conf.h"
|
2012-12-13 15:49:48 +00:00
|
|
|
# include "virthread.h"
|
2012-12-12 17:53:50 +00:00
|
|
|
# include "virjson.h"
|
2012-08-01 03:46:22 +00:00
|
|
|
|
2012-12-11 10:59:44 +00:00
|
|
|
# define parallelsParseError() \
|
|
|
|
virReportErrorHelper(VIR_FROM_TEST, VIR_ERR_OPERATION_FAILED, __FILE__, \
|
|
|
|
__FUNCTION__, __LINE__, _("Can't parse prlctl output"))
|
|
|
|
|
2015-04-17 00:11:06 +00:00
|
|
|
# define IS_CT(def) (def->os.type == VIR_DOMAIN_OSTYPE_HVM)
|
2014-12-01 15:38:47 +00:00
|
|
|
|
2014-12-01 15:38:49 +00:00
|
|
|
# define parallelsDomNotFoundError(domain) \
|
|
|
|
do { \
|
|
|
|
char uuidstr[VIR_UUID_STRING_BUFLEN]; \
|
|
|
|
virUUIDFormat(domain->uuid, uuidstr); \
|
|
|
|
virReportError(VIR_ERR_NO_DOMAIN, \
|
|
|
|
_("no domain with matching uuid '%s'"), uuidstr); \
|
|
|
|
} while (0)
|
|
|
|
|
2015-03-18 08:33:51 +00:00
|
|
|
# define PARALLELS_DOMAIN_ROUTED_NETWORK_NAME "Routed"
|
|
|
|
# define PARALLELS_DOMAIN_BRIDGED_NETWORK_NAME "Bridged"
|
|
|
|
|
|
|
|
# define PARALLELS_REQUIRED_HOSTONLY_NETWORK "Host-Only"
|
|
|
|
# define PARALLELS_HOSTONLY_NETWORK_TYPE "host-only"
|
|
|
|
# define PARALLELS_REQUIRED_BRIDGED_NETWORK "Bridged"
|
|
|
|
# define PARALLELS_BRIDGED_NETWORK_TYPE "bridged"
|
2012-12-11 10:59:48 +00:00
|
|
|
|
2012-08-01 03:46:22 +00:00
|
|
|
struct _parallelsConn {
|
|
|
|
virMutex lock;
|
2013-01-11 16:04:47 +00:00
|
|
|
virDomainObjListPtr domains;
|
2014-09-11 16:24:03 +00:00
|
|
|
PRL_HANDLE server;
|
|
|
|
PRL_UINT32 jobTimeout;
|
2012-08-01 03:46:22 +00:00
|
|
|
virStoragePoolObjList pools;
|
2015-02-23 14:55:24 +00:00
|
|
|
virNetworkObjListPtr networks;
|
2012-08-01 03:46:22 +00:00
|
|
|
virCapsPtr caps;
|
2013-03-31 18:03:42 +00:00
|
|
|
virDomainXMLOptionPtr xmlopt;
|
2013-11-21 10:43:10 +00:00
|
|
|
virObjectEventStatePtr domainEventState;
|
2014-10-23 13:33:11 +00:00
|
|
|
virStorageDriverStatePtr storageState;
|
2012-08-01 03:46:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _parallelsConn parallelsConn;
|
|
|
|
typedef struct _parallelsConn *parallelsConnPtr;
|
|
|
|
|
|
|
|
struct parallelsDomObj {
|
|
|
|
int id;
|
|
|
|
char *uuid;
|
2012-12-04 13:43:05 +00:00
|
|
|
char *home;
|
2014-12-01 15:38:48 +00:00
|
|
|
PRL_HANDLE sdkdom;
|
2012-08-01 03:46:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct parallelsDomObj *parallelsDomObjPtr;
|
|
|
|
|
2015-01-20 16:16:26 +00:00
|
|
|
virDrvOpenStatus parallelsStorageOpen(virConnectPtr conn, unsigned int flags);
|
|
|
|
int parallelsStorageClose(virConnectPtr conn);
|
|
|
|
extern virStorageDriver parallelsStorageDriver;
|
|
|
|
|
|
|
|
virDrvOpenStatus parallelsNetworkOpen(virConnectPtr conn, unsigned int flags);
|
|
|
|
int parallelsNetworkClose(virConnectPtr conn);
|
|
|
|
extern virNetworkDriver parallelsNetworkDriver;
|
2012-08-01 03:46:22 +00:00
|
|
|
|
2012-07-31 18:56:07 +00:00
|
|
|
virJSONValuePtr parallelsParseOutput(const char *binary, ...)
|
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
|
|
|
|
char * parallelsGetOutput(const char *binary, ...)
|
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
|
2012-07-31 18:56:08 +00:00
|
|
|
int parallelsCmdRun(const char *binary, ...)
|
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
|
2012-08-01 03:46:22 +00:00
|
|
|
char * parallelsAddFileExt(const char *path, const char *ext);
|
|
|
|
void parallelsDriverLock(parallelsConnPtr driver);
|
|
|
|
void parallelsDriverUnlock(parallelsConnPtr driver);
|
2013-04-23 12:50:18 +00:00
|
|
|
virStorageVolPtr parallelsStorageVolLookupByPathLocked(virConnectPtr conn,
|
|
|
|
const char *path);
|
|
|
|
int parallelsStorageVolDefRemove(virStoragePoolObjPtr privpool,
|
|
|
|
virStorageVolDefPtr privvol);
|
2012-07-31 18:56:07 +00:00
|
|
|
|
|
|
|
#endif
|