[Libvirt-cim] [PATCH 2 of 2] (#3) Have get_console_sap_by_name() use Name attribute to determine session

Deepti B Kalakeri deeptik at linux.vnet.ibm.com
Wed Nov 19 14:54:31 UTC 2008



Kaitlin Rupert wrote:
> # HG changeset patch
> # User kaitlin at elm3b43.beaverton.ibm.com
> # Date 1224552270 25200
> # Node ID 739113a661c7a342e67bd7f19ce8c744e283bbff
> # Parent  5a55c724920bbe6c3df77c9465a150ac6423f946
> (#3) Have get_console_sap_by_name() use Name attribute to determine session
>
> Updates from 2 to 3:
>   -Check malloc() and strdup() returns
>   -Remove unneeded NULL initialization
>
> Updates from 1 to 2:
>  -Removed function that parses the Name attribute
>
> Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>
>
> diff -r 5a55c724920b -r 739113a661c7 src/Virt_KVMRedirectionSAP.c
> --- a/src/Virt_KVMRedirectionSAP.c	Mon Oct 20 18:24:30 2008 -0700
> +++ b/src/Virt_KVMRedirectionSAP.c	Mon Oct 20 18:24:30 2008 -0700
> @@ -350,7 +350,7 @@
>
>  CMPIStatus get_console_sap_by_name(const CMPIBroker *broker,
>                                     const CMPIObjectPath *ref,
> -                                   const char *name,
> +                                   const char *sys,
>                                     CMPIInstance **_inst)
>  {
>          virConnectPtr conn;
> @@ -358,6 +358,10 @@
>          CMPIStatus s = {CMPI_RC_OK, NULL};
>          CMPIInstance *inst = NULL;
>          struct domain *dominfo = NULL;
> +        struct vnc_port *port = NULL;
> +        const char *name = NULL;
> +        int lport;
> +        int rport;
>
>          conn = connect_by_classname(broker, CLASSNAME(ref), &s);
>          if (conn == NULL) {
> @@ -367,12 +371,12 @@
>                  goto out;
>          }
>
> -        dom = virDomainLookupByName(conn, name);
> +        dom = virDomainLookupByName(conn, sys);
>          if (dom == NULL) {
>                  cu_statusf(broker, &s,
>                             CMPI_RC_ERR_NOT_FOUND,
>                             "No such instance (%s)",
> -                           name);
> +                           sys);
>                  goto out;
>          }
>
> @@ -380,9 +384,43 @@
>                  cu_statusf(broker, &s,
>                             CMPI_RC_ERR_FAILED,
>                             "No console device for this guest");
> +                goto out;
>          }
>
> -        inst = get_console_sap(_BROKER, ref, conn, dominfo, &s);
> +        if (cu_get_str_path(ref, "Name", &name) != CMPI_RC_OK) {
> +                cu_statusf(broker, &s,
> +                           CMPI_RC_ERR_NOT_FOUND,
> +                           "No such instance (System)");
>   
Sorry for being late, just wondering if this error message has to be

"No such instance (Name)"

Thanks and Regards,
Deepti.





More information about the Libvirt-cim mailing list