On Thu, Apr 30, 2009 at 11:28:31AM +0200, Pritesh Kothari wrote: > Hi All, > > I have added support for multiple graphics devices, the patches are as below. > I have checked them against current cvs head and works fine ACK, also looks fine. > diff --git a/src/qemu_conf.c b/src/qemu_conf.c > index 64415ec..07c7c44 100644 > --- a/src/qemu_conf.c > +++ b/src/qemu_conf.c > @@ -1348,21 +1348,21 @@ int qemudBuildCommandLine(virConnectPtr conn, > } > } > > - if (def->graphics && > - def->graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) { > + if ((def->ngraphics == 1) && > + def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) { > virBuffer opt = VIR_BUFFER_INITIALIZER; > char *optstr; > > if (qemuCmdFlags & QEMUD_CMD_FLAG_VNC_COLON) { > - if (def->graphics->data.vnc.listenAddr) > - virBufferAdd(&opt, def->graphics->data.vnc.listenAddr, -1); > + if (def->graphics[0]->data.vnc.listenAddr) > + virBufferAdd(&opt, def->graphics[0]->data.vnc.listenAddr, -1); > else if (driver->vncListen) > virBufferAdd(&opt, driver->vncListen, -1); > > virBufferVSprintf(&opt, ":%d", > - def->graphics->data.vnc.port - 5900); > + def->graphics[0]->data.vnc.port - 5900); > > - if (def->graphics->data.vnc.passwd || > + if (def->graphics[0]->data.vnc.passwd || > driver->vncPassword) > virBufferAddLit(&opt, ",password"); > > @@ -1387,7 +1387,7 @@ int qemudBuildCommandLine(virConnectPtr conn, > } > } else { > virBufferVSprintf(&opt, "%d", > - def->graphics->data.vnc.port - 5900); > + def->graphics[0]->data.vnc.port - 5900); > } > if (virBufferError(&opt)) > goto no_memory; > @@ -1396,22 +1396,22 @@ int qemudBuildCommandLine(virConnectPtr conn, > > ADD_ARG_LIT("-vnc"); > ADD_ARG(optstr); > - if (def->graphics->data.vnc.keymap) { > + if (def->graphics[0]->data.vnc.keymap) { > ADD_ARG_LIT("-k"); > - ADD_ARG_LIT(def->graphics->data.vnc.keymap); > + ADD_ARG_LIT(def->graphics[0]->data.vnc.keymap); > } > - } else if (def->graphics && > - def->graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) { > + } else if ((def->ngraphics == 1) && > + def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) { > char *xauth = NULL; > char *display = NULL; > > - if (def->graphics->data.sdl.xauth && > + if (def->graphics[0]->data.sdl.xauth && > virAsprintf(&xauth, "XAUTHORITY=%s", > - def->graphics->data.sdl.xauth) < 0) > + def->graphics[0]->data.sdl.xauth) < 0) > goto no_memory; > - if (def->graphics->data.sdl.display && > + if (def->graphics[0]->data.sdl.display && > virAsprintf(&display, "DISPLAY=%s", > - def->graphics->data.sdl.display) < 0) { > + def->graphics[0]->data.sdl.display) < 0) { > VIR_FREE(xauth); > goto no_memory; > } > @@ -1420,7 +1420,7 @@ int qemudBuildCommandLine(virConnectPtr conn, > ADD_ENV(xauth); > if (display) > ADD_ENV(display); > - if (def->graphics->data.sdl.fullscreen) > + if (def->graphics[0]->data.sdl.fullscreen) > ADD_ARG_LIT("-full-screen"); > } > > diff --git a/src/qemu_driver.c b/src/qemu_driver.c > index f9fe2ba..1da4a61 100644 > --- a/src/qemu_driver.c > +++ b/src/qemu_driver.c > @@ -1140,13 +1140,13 @@ qemudInitPasswords(virConnectPtr conn, > * for that yet... > */ > > - if (vm->def->graphics && > - vm->def->graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC && > - (vm->def->graphics->data.vnc.passwd || driver->vncPassword)) { > + if ((vm->def->ngraphics == 1) && > + vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC && > + (vm->def->graphics[0]->data.vnc.passwd || driver->vncPassword)) { > > if (qemudMonitorCommandExtra(vm, "change vnc password", > - vm->def->graphics->data.vnc.passwd ? > - vm->def->graphics->data.vnc.passwd : > + vm->def->graphics[0]->data.vnc.passwd ? > + vm->def->graphics[0]->data.vnc.passwd : > driver->vncPassword, > QEMU_PASSWD_PROMPT, > &info) < 0) { > @@ -1338,16 +1338,16 @@ static int qemudStartVMDaemon(virConnectPtr conn, > driver->securityDriver->domainGenSecurityLabel(conn, vm) < 0) > return -1; > > - if (vm->def->graphics && > - vm->def->graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC && > - vm->def->graphics->data.vnc.autoport) { > + if ((vm->def->ngraphics == 1) && > + vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC && > + vm->def->graphics[0]->data.vnc.autoport) { > int port = qemudNextFreeVNCPort(driver); > if (port < 0) { > qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, > "%s", _("Unable to find an unused VNC port")); > goto cleanup; > } > - vm->def->graphics->data.vnc.port = port; > + vm->def->graphics[0]->data.vnc.port = port; > } > > if (virFileMakePath(driver->logDir) < 0) { > @@ -1504,10 +1504,10 @@ cleanup: > VIR_FREE(vm->def->seclabel.label); > VIR_FREE(vm->def->seclabel.imagelabel); > } > - if (vm->def->graphics && > - vm->def->graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC && > - vm->def->graphics->data.vnc.autoport) > - vm->def->graphics->data.vnc.port = -1; > + if ((vm->def->ngraphics == 1) && > + vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC && > + vm->def->graphics[0]->data.vnc.autoport) > + vm->def->graphics[0]->data.vnc.port = -1; > if (vm->logfile != -1) { > close(vm->logfile); > vm->logfile = -1; > -- > Libvir-list mailing list > Libvir-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/libvir-list -- |: 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