On Thu, May 07, 2009 at 03:49:28PM +0200, Pritesh Kothari wrote: > Hi All, > > I have added support for vrdp/sdl/gui modes for VirtualBox driver in libvirt. > Tha patch's are as below: > > [PATCH 1/3]: contains support for vrdp/sdl/gui while defining a machine. > [PATCH 2/3]: contains support for vrdp/sdl/gui while dumping xml > [PATCH 3/3]: contains support for vrdp/sdl/gui while starting the machine > > Regards, > Pritesh > > diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c > index b25e93b..87db6ab 100644 > --- a/src/vbox/vbox_tmpl.c > +++ b/src/vbox/vbox_tmpl.c > @@ -3103,9 +3093,86 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) { > VRDPServer->vtbl->nsisupports.Release((nsISupports *)VRDPServer); > } > } > + > + if ((def->graphics[i]->type == VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP) && (guiPresent == 0)) { > + guiPresent = 1; > + guiDisplay = strdup(def->graphics[i]->data.desktop.display); > + } > + > + if ((def->graphics[i]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) && (sdlPresent == 0)) { > + sdlPresent = 1; > + sdlDisplay = strdup(def->graphics[i]->data.sdl.display); > + } > + } Need to check for OOM failure here. > + > + if ((vrdpPresent == 1) && (guiPresent == 0) && (sdlPresent == 0)) { > + /* store extradata key that frontend is set to vrdp */ > + PRUnichar *keyTypeUtf16 = NULL; > + PRUnichar *valueTypeUtf16 = NULL; > + > + data->pFuncs->pfnUtf8ToUtf16("FRONTEND/Type", &keyTypeUtf16); > + data->pFuncs->pfnUtf8ToUtf16("vrdp", &valueTypeUtf16); > + > + machine->vtbl->SetExtraData(machine, keyTypeUtf16, valueTypeUtf16); > + > + data->pFuncs->pfnUtf16Free(keyTypeUtf16); > + data->pFuncs->pfnUtf16Free(valueTypeUtf16); > + > + } else if ((guiPresent == 0) && (sdlPresent == 1)) { > + /* store extradata key that frontend is set to sdl */ > + PRUnichar *keyTypeUtf16 = NULL; > + PRUnichar *valueTypeUtf16 = NULL; > + PRUnichar *keyDislpayUtf16 = NULL; > + PRUnichar *valueDisplayUtf16 = NULL; > + > + data->pFuncs->pfnUtf8ToUtf16("FRONTEND/Type", &keyTypeUtf16); > + data->pFuncs->pfnUtf8ToUtf16("sdl", &valueTypeUtf16); > + > + machine->vtbl->SetExtraData(machine, keyTypeUtf16, valueTypeUtf16); > + > + data->pFuncs->pfnUtf16Free(keyTypeUtf16); > + data->pFuncs->pfnUtf16Free(valueTypeUtf16); > + > + if (sdlDisplay) { > + data->pFuncs->pfnUtf8ToUtf16("FRONTEND/Display", &keyDislpayUtf16); > + data->pFuncs->pfnUtf8ToUtf16(sdlDisplay, &valueDisplayUtf16); > + > + machine->vtbl->SetExtraData(machine, keyDislpayUtf16, valueDisplayUtf16); > + > + data->pFuncs->pfnUtf16Free(keyDislpayUtf16); > + data->pFuncs->pfnUtf16Free(valueDisplayUtf16); > + } > + > + } else { > + /* if all are set then default is gui, with vrdp turned on */ > + PRUnichar *keyTypeUtf16 = NULL; > + PRUnichar *valueTypeUtf16 = NULL; > + PRUnichar *keyDislpayUtf16 = NULL; > + PRUnichar *valueDisplayUtf16 = NULL; > + > + data->pFuncs->pfnUtf8ToUtf16("FRONTEND/Type", &keyTypeUtf16); > + data->pFuncs->pfnUtf8ToUtf16("gui", &valueTypeUtf16); > + > + machine->vtbl->SetExtraData(machine, keyTypeUtf16, valueTypeUtf16); > + > + data->pFuncs->pfnUtf16Free(keyTypeUtf16); > + data->pFuncs->pfnUtf16Free(valueTypeUtf16); > + > + if (guiDisplay) { > + data->pFuncs->pfnUtf8ToUtf16("FRONTEND/Display", &keyDislpayUtf16); > + data->pFuncs->pfnUtf8ToUtf16(guiDisplay, &valueDisplayUtf16); > + > + machine->vtbl->SetExtraData(machine, keyDislpayUtf16, valueDisplayUtf16); > + > + data->pFuncs->pfnUtf16Free(keyDislpayUtf16); > + data->pFuncs->pfnUtf16Free(valueDisplayUtf16); > + } > } > + > + VIR_FREE(guiDisplay); > + VIR_FREE(sdlDisplay); > + > } /* Finished:Block to attach the Remote Display to VM */ > -#endif > > { /* Started:Block to attach USB Devices to VM */ > if (def->nhostdevs > 0) { Generally, looks fine apart from the OOM check Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list