[libvirt] [PATCH] Parallels: Add VNC hostname setup

Add missing VNC setup via Parallels SDK. Parallels Cloud Server starts one VNC server per domain, so we could process only one VNC server definition. Network-based listening currently is unimplemented. Signed-off-by: Alexander Burluka <aburluka@parallels.com> --- src/parallels/parallels_sdk.c | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 deletions(-) diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index 83a28b7..8394646 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -1929,7 +1929,7 @@ static int prlsdkCheckGraphicsUnsupportedParams(virDomainDefPtr def) if (def->ngraphics == 0) return 0; - if (def->ngraphics >1) { + if (def->ngraphics > 1) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Parallels Cloud Server supports only " "one VNC per domain.")); @@ -1988,6 +1988,20 @@ static int prlsdkCheckGraphicsUnsupportedParams(virDomainDefPtr def) return -1; } + if (gr->nListens > 1) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Parallels driver doesn't support more than " + "one listening VNC server per domain")); + return -1; + } + + if (gr->nListens == 1 && + virDomainGraphicsListenGetType(gr, 0) != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Parallels driver supports only address-based VNC listening")); + return -1; + } + return 0; } @@ -2286,6 +2300,7 @@ static int prlsdkApplyGraphicsParams(PRL_HANDLE sdkdom, virDomainDefPtr def) virDomainGraphicsDefPtr gr; PRL_RESULT pret; int ret = -1; + const char *listenAddr = NULL; if (prlsdkCheckGraphicsUnsupportedParams(def)) return -1; @@ -2306,6 +2321,14 @@ static int prlsdkApplyGraphicsParams(PRL_HANDLE sdkdom, virDomainDefPtr def) prlsdkCheckRetGoto(pret, cleanup); } + if (gr->nListens == 1) { + listenAddr = virDomainGraphicsListenGetAddress(gr, 0); + if (!listenAddr) + goto cleanup; + pret = PrlVmCfg_SetVNCHostName(sdkdom, listenAddr); + prlsdkCheckRetGoto(pret, cleanup); + } + ret = 0; cleanup: return ret; -- 1.7.1

On Friday 19 December 2014 16:41:03 Alexander Burluka wrote:
Add missing VNC setup via Parallels SDK. Parallels Cloud Server starts one VNC server per domain, so we could process only one VNC server definition. Network-based listening currently is unimplemented.
Seems good to me, ACK.
Signed-off-by: Alexander Burluka <aburluka@parallels.com> --- src/parallels/parallels_sdk.c | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index 83a28b7..8394646 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -1929,7 +1929,7 @@ static int prlsdkCheckGraphicsUnsupportedParams(virDomainDefPtr def) if (def->ngraphics == 0) return 0;
- if (def->ngraphics >1) { + if (def->ngraphics > 1) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Parallels Cloud Server supports only " "one VNC per domain.")); @@ -1988,6 +1988,20 @@ static int prlsdkCheckGraphicsUnsupportedParams(virDomainDefPtr def) return -1; }
+ if (gr->nListens > 1) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Parallels driver doesn't support more than " + "one listening VNC server per domain")); + return -1; + } + + if (gr->nListens == 1 && + virDomainGraphicsListenGetType(gr, 0) != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Parallels driver supports only address-based VNC listening")); + return -1; + } + return 0; }
@@ -2286,6 +2300,7 @@ static int prlsdkApplyGraphicsParams(PRL_HANDLE sdkdom, virDomainDefPtr def) virDomainGraphicsDefPtr gr; PRL_RESULT pret; int ret = -1; + const char *listenAddr = NULL;
if (prlsdkCheckGraphicsUnsupportedParams(def)) return -1; @@ -2306,6 +2321,14 @@ static int prlsdkApplyGraphicsParams(PRL_HANDLE sdkdom, virDomainDefPtr def) prlsdkCheckRetGoto(pret, cleanup); }
+ if (gr->nListens == 1) { + listenAddr = virDomainGraphicsListenGetAddress(gr, 0); + if (!listenAddr) + goto cleanup; + pret = PrlVmCfg_SetVNCHostName(sdkdom, listenAddr); + prlsdkCheckRetGoto(pret, cleanup); + } + ret = 0; cleanup: return ret;
-- Dmitry Guryanov

On 19.12.2014 14:41, Alexander Burluka wrote:
Add missing VNC setup via Parallels SDK. Parallels Cloud Server starts one VNC server per domain, so we could process only one VNC server definition. Network-based listening currently is unimplemented.
Signed-off-by: Alexander Burluka <aburluka@parallels.com> --- src/parallels/parallels_sdk.c | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index 83a28b7..8394646 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -1929,7 +1929,7 @@ static int prlsdkCheckGraphicsUnsupportedParams(virDomainDefPtr def) if (def->ngraphics == 0) return 0;
- if (def->ngraphics >1) { + if (def->ngraphics > 1) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Parallels Cloud Server supports only " "one VNC per domain.")); @@ -1988,6 +1988,20 @@ static int prlsdkCheckGraphicsUnsupportedParams(virDomainDefPtr def) return -1; }
+ if (gr->nListens > 1) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Parallels driver doesn't support more than " + "one listening VNC server per domain")); + return -1; + } + + if (gr->nListens == 1 && + virDomainGraphicsListenGetType(gr, 0) != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) {
Indentation's off.
+ virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Parallels driver supports only address-based VNC listening"));
s, , ,
+ return -1; + } + return 0; }
@@ -2286,6 +2300,7 @@ static int prlsdkApplyGraphicsParams(PRL_HANDLE sdkdom, virDomainDefPtr def) virDomainGraphicsDefPtr gr; PRL_RESULT pret; int ret = -1; + const char *listenAddr = NULL;
if (prlsdkCheckGraphicsUnsupportedParams(def)) return -1; @@ -2306,6 +2321,14 @@ static int prlsdkApplyGraphicsParams(PRL_HANDLE sdkdom, virDomainDefPtr def) prlsdkCheckRetGoto(pret, cleanup); }
+ if (gr->nListens == 1) { + listenAddr = virDomainGraphicsListenGetAddress(gr, 0); + if (!listenAddr) + goto cleanup; + pret = PrlVmCfg_SetVNCHostName(sdkdom, listenAddr); + prlsdkCheckRetGoto(pret, cleanup); + } + ret = 0; cleanup: return ret;
Fixed, ACKed and pushed now. Sorry it took so long, but I was on holiday (as everybody I guess). Michal
participants (3)
-
Alexander Burluka
-
Dmitry Guryanov
-
Michal Privoznik