[libvirt] [PATCH] qemu: Allow serving VNC over a unix domain socket

Cole Robinson crobinso at redhat.com
Mon Jan 10 18:14:03 UTC 2011


On 01/10/2011 12:40 PM, Eric Blake wrote:
> On 01/10/2011 10:15 AM, Cole Robinson wrote:
>> QEMU supports serving VNC over a unix domain socket rather than traditional
>> TCP host/port. This is specified with:
>>
>> <graphics type='vnc' socket='/foo/bar/baz'/>
>>
>> Currently not hooked up with the security driver, I'll wait for Dan's
>> big reorg. I also have a virtinst/virt-manager patch queued locally to
>> handle this change.
>>
>> +++ b/docs/schemas/domain.rng
>> @@ -1116,6 +1116,11 @@
>>              </attribute>
>>            </optional>
>>            <optional>
>> +            <attribute name="socket">
>> +              <ref name="absFilePath"/>
>> +            </attribute>
>> +          </optional>
>> +          <optional>
> 
> Do we want to use a <choice> block, so that you either specify a <group>
> of port/autoport/listen or the single attribute of socket?  That is, it
> doesn't make sense to mix the two connection styles, and the relaxNG
> validation can be tweaked to detect an improper mix.
> 

Good point, I'll fix that.

>> +++ b/src/qemu/qemu_command.c
>> @@ -3511,7 +3511,11 @@ qemuBuildCommandLine(virConnectPtr conn,
>>          def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
>>          virBuffer opt = VIR_BUFFER_INITIALIZER;
>>  
>> -        if (qemuCmdFlags & QEMUD_CMD_FLAG_VNC_COLON) {
>> +        if (def->graphics[0]->data.vnc.socket) {
>> +            virBufferVSprintf(&opt, "unix:%s",
>> +                              def->graphics[0]->data.vnc.socket);
> 
> Do we need a qemu_capability flag bit for this?  I'm assuming that -vnc
> unix:xxx is a relatively new feature.
> 

Actually it's been around since 0.9.0 which is about 4 years, so not a
big deal IMO. We could reuse the VNC_COLON flag, but all it would let us
do is report a nicer error which probably isn't worth the effort of
translating :)

Thanks,
Cole




More information about the libvir-list mailing list