[Libvirt-cim] [PATCH 2 of 2] Add lookup of domain to make sure it exists as part of the check

Heidi Eckhart heidieck at linux.vnet.ibm.com
Wed Mar 12 10:20:01 UTC 2008


Dan Smith wrote:
> @@ -281,6 +282,14 @@ static CMPIStatus vs_migratable(const CM
>          s = check_hver(conn, dconn);
>          if (s.rc != CMPI_RC_OK)
>                  goto out;
> +
> +        dom = virDomainLookupByName(conn, domain);
> +        if (dom == NULL) {
> +                cu_statusf(_BROKER, &s,
> +                           CMPI_RC_ERR_NOT_FOUND,
> +                           "No such domain");
> +                goto out;
> +        }
>   
Sorry, I know my comment comes a bit late, as the patch is already 
checked in.
I think this check is not enough. To check if a certain 
Xen/KVM_ComputerSystem or the Xen/KVM_HostSystem object path is correct 
specified by the client, you should use the corresponding (new ;)) 
interfaces (get_domain_by_ref, get_host), as they check the complete 
object path for correctness. It raises the number of cycles a bit, but 
makes the behavior of all providers consistent. Thanks.

-- 
Regards

Heidi Eckhart
Software Engineer
IBM Linux Technology Center - Open Hypervisor




More information about the Libvirt-cim mailing list