[libvirt] [PATCH] Correct include-password option for domdisplay

Martin Kletzander mkletzan at redhat.com
Wed Nov 21 15:46:09 UTC 2012


On 11/21/2012 04:39 PM, Daniel P. Berrange wrote:
> On Wed, Nov 21, 2012 at 04:37:35PM +0100, Martin Kletzander wrote:
>> The 'virsh domdisplay' command is able to display the password
>> configured for spice, but it was missing for vnc type graphics.
>> This is just a simple patch for that to work properly.
>> ---
>>  tools/virsh-domain.c | 17 +++++++++++++++++
>>  1 file changed, 17 insertions(+)
>>
>> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
>> index cc47383..18aa869 100644
>> --- a/tools/virsh-domain.c
>> +++ b/tools/virsh-domain.c
>> @@ -7073,6 +7073,23 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
>>          if (STREQ(scheme[iter], "vnc")) {
>>              /* VNC protocol handlers take their port number as 'port' - 5900 */
>>              port -= 5900;
>> +
>> +            if (vshCommandOptBool(cmd, "include-password")) {
>> +                /* Create our XPATH lookup for the SPICE password */
> 
> s/spice/vnc/
> 
> 
>> +                virAsprintf(&xpath,
>> +                            "string(/domain/devices/graphics"
>> +                            "[@type='%s']/@passwd)",
>> +                            scheme[iter]);
>> +                if (!xpath) {
>> +                    virReportOOMError();
>> +                    goto cleanup;
>> +                }
>> +
>> +                /* Attempt to get the SPICE password */
> 
> s/spice/vnc/
> 
>> +                passwd = virXPathString(xpath, ctxt);
>> +                VIR_FREE(xpath);
>> +            }
>> +
> 
> Daniel
> 

Oh, right, dumb me.  I tested the functionality, but left the copy-paste
errors in the comments.  Does that mean I can push with those fixes?

Martin




More information about the libvir-list mailing list