On 07/20/2011 05:36 PM, Chip Vincent wrote:
One question below...
On 07/20/2011 04:20 PM, Eduardo Lima (Etrunko) wrote:
> # HG changeset patch
> # User Eduardo Lima (Etrunko)<eblima(a)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(a)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?
In practical terms, they are not different at all. If you edit the XML
for a domain adding an empty password attribute for vnc you will get the
exact same behavior as when that attribute is not there.
You will only get prompted for a password when it's lenght is > 0. And
that was the reason for this extra check.
Best regards,
--
Eduardo de Barros Lima
Software Engineer, Open Virtualization
Linux Technology Center - IBM/Brazil
eblima(a)br.ibm.com