[Libvirt-cim] [PATCH] Remove has_vnc_passwd key from infostore

Chip Vincent cvincent at linux.vnet.ibm.com
Wed Jul 20 20:36:52 UTC 2011


One question below...

On 07/20/2011 04:20 PM, Eduardo Lima (Etrunko) wrote:
> # HG changeset patch
> # User Eduardo Lima (Etrunko)<eblima at br.ibm.com>
> # Date 1311192727 10800
> # Node ID 9746544f39f508bb08b0c7ea71153dbbceda8dd9
> # Parent  6056961c3c5347d3b8375039767d7bc78fa97eb5
> Remove has_vnc_passwd key from infostore
>
> The logic is not necessary anymore since we return the vnc password
> in every call to retrieve a domain XML. Also fix some other places
> where this field was not handled properly.
>
> Signed-off-by: Eduardo Lima (Etrunko)<eblima at br.ibm.com>
>
> diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c
> --- a/libxkutil/device_parsing.c
> +++ b/libxkutil/device_parsing.c
> @@ -809,6 +809,7 @@
>                   DUP_FIELD(dev, _dev, dev.graphics.port);
>                   DUP_FIELD(dev, _dev, dev.graphics.host);
>                   DUP_FIELD(dev, _dev, dev.graphics.keymap);
> +                DUP_FIELD(dev, _dev, dev.graphics.passwd);
>           } else if (dev->type == CIM_RES_TYPE_INPUT) {
>                   DUP_FIELD(dev, _dev, dev.input.type);
>                   DUP_FIELD(dev, _dev, dev.input.bus);
> @@ -889,7 +890,7 @@
>           char *xml;
>           int ret;
>
> -        xml = virDomainGetXMLDesc(dom, 0);
> +        xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE);
>           if (xml == NULL)
>                   return 0;
>
> diff --git a/src/Virt_ComputerSystem.c b/src/Virt_ComputerSystem.c
> --- a/src/Virt_ComputerSystem.c
> +++ b/src/Virt_ComputerSystem.c
> @@ -920,7 +920,7 @@
>                   return s;
>           }
>
> -        xml = virDomainGetXMLDesc(dom, 0);
> +        xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE);
>           if (xml == NULL) {
>                   CU_DEBUG("Unable to retrieve domain XML");
>                   virt_set_status(_BROKER,&s,
> diff --git a/src/Virt_ComputerSystemIndication.c b/src/Virt_ComputerSystemIndication.c
> --- a/src/Virt_ComputerSystemIndication.c
> +++ b/src/Virt_ComputerSystemIndication.c
> @@ -151,7 +151,7 @@
>                   }
>
>                   (*dom_xml_list)[i].xml = virDomainGetXMLDesc(dom_ptr_list[i],
> -                                                             0);
> +                                                             VIR_DOMAIN_XML_SECURE);
>                   if ((*dom_xml_list)[i].xml == NULL) {
>                           cu_statusf(_BROKER,&s,
>                                      CMPI_RC_ERR_FAILED,
> diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c
> --- a/src/Virt_RASD.c
> +++ b/src/Virt_RASD.c
> @@ -420,8 +420,6 @@
>           CMPIStatus s = {CMPI_RC_OK, NULL};
>           virConnectPtr conn = NULL;
>           virDomainPtr dom = NULL;
> -        struct infostore_ctx *infostore = NULL;
> -        bool has_passwd = false;
>
>           CMSetProperty(inst, "ResourceSubType",
>                          (CMPIValue *)dev->dev.graphics.type, CMPI_chars);
> @@ -460,19 +458,12 @@
>                           goto out;
>                   }
>
> -                infostore = infostore_open(dom);
> -                if (infostore != NULL)
> -                        has_passwd = infostore_get_bool(infostore,
> -                                "has_vnc_passwd");
> -
> -                if (has_passwd) {
> +                if (dev->dev.graphics.passwd&&  strlen(dev->dev.graphics.passwd)) {

Is a NULL password different than a zero-length password? This check 
assumes that's possible, but one would expect '****' to be present in 
the instance for non-NULL, zero-length strings. Right?

>                           CU_DEBUG("has password");
>                           CMSetProperty(inst, "Password",
>                                         (CMPIValue *)"********", CMPI_chars);
>                   }
>
> -                infostore_close(infostore);
> -
>                   /* FIXME: Populate the IsIPv6Only */
>           }
>
> diff --git a/src/Virt_VSMigrationService.c b/src/Virt_VSMigrationService.c
> --- a/src/Virt_VSMigrationService.c
> +++ b/src/Virt_VSMigrationService.c
> @@ -1060,7 +1060,7 @@
>   {
>           CMPIStatus s = {CMPI_RC_OK, NULL};
>
> -        *xml = virDomainGetXMLDesc(dom, 0);
> +        *xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE);
>           if (*xml == NULL) {
>
>                   virt_set_status(_BROKER,&s,
> diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c
> --- a/src/Virt_VirtualSystemManagementService.c
> +++ b/src/Virt_VirtualSystemManagementService.c
> @@ -373,6 +373,7 @@
>           domain->dev_graphics->dev.graphics.port = strdup("-1");
>           domain->dev_graphics->dev.graphics.host = strdup("127.0.0.1");
>           domain->dev_graphics->dev.graphics.keymap = strdup("en-us");
> +        domain->dev_graphics->dev.graphics.passwd = NULL;
>           domain->dev_graphics_ct = 1;
>
>           return true;
> @@ -1543,14 +1544,6 @@
>           infostore_set_u64(ctx, "weight", dev->dev.vcpu.weight);
>           infostore_set_u64(ctx, "limit", dev->dev.vcpu.limit);
>
> -        dev = dominfo->dev_graphics;
> -        if(dev != NULL){
> -                if (dev->dev.graphics.passwd != NULL)
> -                        infostore_set_bool(ctx, "has_vnc_passwd", true);
> -                else
> -                        infostore_set_bool(ctx, "has_vnc_passwd", false);
> -        }
> -
>    out:
>           infostore_close(ctx);
>
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim

-- 
Chip Vincent
Open Virtualization
IBM Linux Technology Center
cvincent at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list