2012-07-31 22:56:07 +04:00
|
|
|
/*
|
2015-06-10 10:50:00 +03:00
|
|
|
* vz_utils.h: core driver functions for managing
|
2012-07-31 22:56:07 +04:00
|
|
|
* 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 20:24:03 +04:00
|
|
|
# include <Parallels.h>
|
|
|
|
|
2012-08-01 11:46:22 +08:00
|
|
|
# include "driver.h"
|
|
|
|
# include "conf/domain_conf.h"
|
2016-05-02 12:33:07 +03:00
|
|
|
# include "conf/snapshot_conf.h"
|
2015-07-17 11:11:23 +02:00
|
|
|
# include "conf/virdomainobjlist.h"
|
2012-08-01 11:46:22 +08:00
|
|
|
# include "conf/domain_event.h"
|
2012-12-13 15:49:48 +00:00
|
|
|
# include "virthread.h"
|
2016-02-17 15:15:03 +03:00
|
|
|
# include "datatypes.h"
|
2012-08-01 11:46:22 +08:00
|
|
|
|
2015-06-10 10:50:00 +03:00
|
|
|
# define vzParseError() \
|
2012-12-11 14:59:44 +04:00
|
|
|
virReportErrorHelper(VIR_FROM_TEST, VIR_ERR_OPERATION_FAILED, __FILE__, \
|
2015-06-25 09:56:56 +02:00
|
|
|
__FUNCTION__, __LINE__, _("Can't parse prlctl output"))
|
2012-12-11 14:59:44 +04:00
|
|
|
|
2015-04-22 22:49:00 +03:00
|
|
|
# define IS_CT(def) (def->os.type == VIR_DOMAIN_OSTYPE_EXE)
|
2014-12-01 18:38:47 +03:00
|
|
|
|
2015-06-10 10:50:00 +03:00
|
|
|
# define vzDomNotFoundError(domain) \
|
2014-12-01 18:38:49 +03:00
|
|
|
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 11:33:51 +03:00
|
|
|
# define PARALLELS_DOMAIN_ROUTED_NETWORK_NAME "Routed"
|
|
|
|
# define PARALLELS_DOMAIN_BRIDGED_NETWORK_NAME "Bridged"
|
2016-03-15 10:47:47 +03:00
|
|
|
# define VIRTUOZZO_VER_7 ((unsigned long) 7000000)
|
|
|
|
|
|
|
|
struct _vzCapabilities {
|
|
|
|
virStorageFileFormat vmDiskFormat;
|
|
|
|
virStorageFileFormat ctDiskFormat;
|
|
|
|
virDomainDiskBus *diskBuses;
|
2016-03-15 10:47:50 +03:00
|
|
|
virDomainControllerType *controllerTypes;
|
|
|
|
virDomainControllerModelSCSI scsiControllerModel;
|
2016-03-15 10:47:47 +03:00
|
|
|
};
|
|
|
|
typedef struct _vzCapabilities vzCapabilities;
|
|
|
|
typedef struct _vzCapabilities *vzCapabilitiesPtr;
|
2015-03-18 11:33:51 +03:00
|
|
|
|
2016-05-18 11:11:08 +03:00
|
|
|
/* +2 to keep enclosing { and } */
|
|
|
|
# define VIR_UUID_STRING_BRACED_BUFLEN (VIR_UUID_STRING_BUFLEN + 2)
|
|
|
|
|
2016-03-28 22:11:30 +03:00
|
|
|
struct _vzDriver {
|
|
|
|
virObjectLockable parent;
|
2015-04-22 18:07:06 +02:00
|
|
|
|
|
|
|
/* Immutable pointer, self-locking APIs */
|
2013-01-11 16:04:47 +00:00
|
|
|
virDomainObjListPtr domains;
|
2016-05-18 11:11:04 +03:00
|
|
|
unsigned char session_uuid[VIR_UUID_BUFLEN];
|
2014-09-11 20:24:03 +04:00
|
|
|
PRL_HANDLE server;
|
2012-08-01 11:46:22 +08:00
|
|
|
virCapsPtr caps;
|
2013-03-31 20:03:42 +02:00
|
|
|
virDomainXMLOptionPtr xmlopt;
|
2013-11-21 11:43:10 +01:00
|
|
|
virObjectEventStatePtr domainEventState;
|
2016-04-07 21:52:43 +03:00
|
|
|
virSysinfoDefPtr hostsysinfo;
|
2016-03-15 10:47:46 +03:00
|
|
|
unsigned long vzVersion;
|
2016-03-15 10:47:47 +03:00
|
|
|
vzCapabilities vzCaps;
|
2012-08-01 11:46:22 +08:00
|
|
|
};
|
|
|
|
|
2016-03-28 22:11:30 +03:00
|
|
|
typedef struct _vzDriver vzDriver;
|
|
|
|
typedef struct _vzDriver *vzDriverPtr;
|
|
|
|
|
|
|
|
struct _vzConn {
|
|
|
|
struct _vzConn* next;
|
|
|
|
|
|
|
|
vzDriverPtr driver;
|
|
|
|
/* Immutable pointer, self-locking APIs */
|
|
|
|
virConnectCloseCallbackDataPtr closeCallback;
|
|
|
|
};
|
|
|
|
|
2015-06-10 10:50:00 +03:00
|
|
|
typedef struct _vzConn vzConn;
|
|
|
|
typedef struct _vzConn *vzConnPtr;
|
2012-08-01 11:46:22 +08:00
|
|
|
|
2016-03-28 22:11:30 +03:00
|
|
|
|
2015-06-10 10:50:00 +03:00
|
|
|
struct vzDomObj {
|
2012-08-01 11:46:22 +08:00
|
|
|
int id;
|
2014-12-01 18:38:48 +03:00
|
|
|
PRL_HANDLE sdkdom;
|
2016-06-03 10:11:44 +03:00
|
|
|
PRL_HANDLE stats;
|
2012-08-01 11:46:22 +08:00
|
|
|
};
|
|
|
|
|
2015-06-10 10:50:00 +03:00
|
|
|
typedef struct vzDomObj *vzDomObjPtr;
|
2012-08-01 11:46:22 +08:00
|
|
|
|
2015-06-10 10:50:00 +03:00
|
|
|
virDomainObjPtr vzDomObjFromDomain(virDomainPtr domain);
|
|
|
|
virDomainObjPtr vzDomObjFromDomainRef(virDomainPtr domain);
|
2015-04-22 18:10:50 +02:00
|
|
|
|
2015-06-10 10:50:00 +03:00
|
|
|
char * vzGetOutput(const char *binary, ...)
|
2012-07-31 22:56:07 +04:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
|
2016-03-28 22:11:30 +03:00
|
|
|
|
|
|
|
vzDriverPtr
|
|
|
|
vzGetDriverConnection(void);
|
|
|
|
|
|
|
|
void
|
|
|
|
vzDestroyDriverConnection(void);
|
|
|
|
|
2016-02-10 12:39:14 +03:00
|
|
|
virDomainObjPtr
|
2016-03-28 22:11:30 +03:00
|
|
|
vzNewDomain(vzDriverPtr driver,
|
2016-05-18 11:11:05 +03:00
|
|
|
const char *name,
|
2016-02-10 12:39:14 +03:00
|
|
|
const unsigned char *uuid);
|
2016-03-15 10:47:46 +03:00
|
|
|
int
|
2016-03-28 22:11:30 +03:00
|
|
|
vzInitVersion(vzDriverPtr driver);
|
2016-03-15 10:47:48 +03:00
|
|
|
int
|
2016-04-20 17:05:32 +03:00
|
|
|
vzCheckUnsupportedDisk(const virDomainDef *def,
|
|
|
|
virDomainDiskDefPtr disk,
|
|
|
|
vzCapabilitiesPtr vzCaps);
|
2016-03-15 10:47:50 +03:00
|
|
|
int
|
|
|
|
vzCheckUnsupportedControllers(virDomainDefPtr def,
|
|
|
|
vzCapabilitiesPtr vzCaps);
|
2016-03-15 10:47:51 +03:00
|
|
|
int
|
2016-03-28 22:11:30 +03:00
|
|
|
vzGetDefaultSCSIModel(vzDriverPtr driver,
|
2016-03-15 10:47:51 +03:00
|
|
|
PRL_CLUSTERED_DEVICE_SUBTYPE *scsiModel);
|
2012-07-31 22:56:07 +04:00
|
|
|
|
2016-04-20 17:05:42 +03:00
|
|
|
int vzCheckUnsupportedGraphics(virDomainGraphicsDefPtr gr);
|
|
|
|
|
2015-06-25 09:56:56 +02:00
|
|
|
# define PARALLELS_BLOCK_STATS_FOREACH(OP) \
|
|
|
|
OP(rd_req, VIR_DOMAIN_BLOCK_STATS_READ_REQ, "read_requests") \
|
|
|
|
OP(rd_bytes, VIR_DOMAIN_BLOCK_STATS_READ_BYTES, "read_total") \
|
|
|
|
OP(wr_req, VIR_DOMAIN_BLOCK_STATS_WRITE_REQ, "write_requests") \
|
|
|
|
OP(wr_bytes, VIR_DOMAIN_BLOCK_STATS_WRITE_BYTES, "write_total")
|
2015-06-09 10:35:53 +03:00
|
|
|
|
2012-07-31 22:56:07 +04:00
|
|
|
#endif
|