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 cc76243..814c781 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);
@@ -361,7 +361,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;
@@ -1683,7 +1683,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;
@@ -3456,7 +3456,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;
@@ -4178,7 +4178,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 8fcedf3..cef2dca 100644
--- a/src/vz/vz_utils.h
+++ b/src/vz/vz_utils.h
@@ -49,6 +49,8 @@
# define PARALLELS_DOMAIN_ROUTED_NETWORK_NAME "Routed"
# define PARALLELS_DOMAIN_BRIDGED_NETWORK_NAME "Bridged"
+# define VZ_UUID_STRING_BUFLEN (VIR_UUID_STRING_BUFLEN + 2)
+
struct _vzConn {
virMutex lock;
--
1.8.3.1