vz puts uuids into curly braces. Simply introduce new contstant to reflect this
and get rid of magic +2 in code.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/vz/vz_sdk.c | 12 ++++++------
src/vz/vz_utils.h | 2 ++
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 9a2b5df..bafc6e4 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -236,7 +236,7 @@ prlsdkConnect(vzConnPtr privconn)
PRL_HANDLE job = PRL_INVALID_HANDLE;
PRL_HANDLE result = PRL_INVALID_HANDLE;
PRL_HANDLE response = PRL_INVALID_HANDLE;
- char session_uuid[VIR_UUID_STRING_BUFLEN + 2];
+ char session_uuid[VZ_UUID_STRING_BUFLEN];
PRL_UINT32 buflen = ARRAY_CARDINALITY(session_uuid);
pret = PrlSrv_Create(&privconn->server);
@@ -316,7 +316,7 @@ prlsdkUUIDFormat(const unsigned char *uuid, char *uuidstr)
static PRL_HANDLE
prlsdkSdkDomainLookupByUUID(vzConnPtr privconn, const unsigned char *uuid)
{
- char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
+ char uuidstr[VZ_UUID_STRING_BUFLEN];
PRL_HANDLE sdkdom = PRL_INVALID_HANDLE;
prlsdkUUIDFormat(uuid, uuidstr);
@@ -365,7 +365,7 @@ prlsdkGetDomainIds(PRL_HANDLE sdkdom,
char **name,
unsigned char *uuid)
{
- char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
+ char uuidstr[VZ_UUID_STRING_BUFLEN];
PRL_UINT32 len;
PRL_RESULT pret;
@@ -1722,7 +1722,7 @@ prlsdkEventsHandler(PRL_HANDLE prlEvent, PRL_VOID_PTR opaque)
vzConnPtr privconn = opaque;
PRL_RESULT pret = PRL_ERR_FAILURE;
PRL_HANDLE_TYPE handleType;
- char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
+ char uuidstr[VZ_UUID_STRING_BUFLEN];
unsigned char uuid[VIR_UUID_BUFLEN];
PRL_UINT32 bufsize = ARRAY_CARDINALITY(uuidstr);
PRL_EVENT_TYPE prlEventType;
@@ -3480,7 +3480,7 @@ prlsdkDoApplyConfig(virConnectPtr conn,
{
PRL_RESULT pret;
size_t i;
- char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
+ char uuidstr[VZ_UUID_STRING_BUFLEN];
bool needBoot = true;
char *mask = NULL;
@@ -4070,7 +4070,7 @@ int prlsdkMigrate(virDomainObjPtr dom, virURIPtr uri,
int ret = -1;
vzDomObjPtr privdom = dom->privateData;
PRL_HANDLE job = PRL_INVALID_HANDLE;
- char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
+ char uuidstr[VZ_UUID_STRING_BUFLEN];
PRL_UINT32 vzflags = PRLSDK_MIGRATION_FLAGS;
if (flags & VIR_MIGRATE_PAUSED)
diff --git a/src/vz/vz_utils.h b/src/vz/vz_utils.h
index fe54b25..2a59426 100644
--- a/src/vz/vz_utils.h
+++ b/src/vz/vz_utils.h
@@ -55,6 +55,8 @@
# define PARALLELS_REQUIRED_BRIDGED_NETWORK "Bridged"
# define PARALLELS_BRIDGED_NETWORK_TYPE "bridged"
+# define VZ_UUID_STRING_BUFLEN (VIR_UUID_STRING_BUFLEN + 2)
+
struct _vzConn {
virMutex lock;
--
1.7.1