[Libvirt-cim] [PATCH] (#3) For pause, reboot, and enable add support for guests in the NOSTATE state

Dan Smith danms at us.ibm.com
Thu Aug 7 18:48:57 UTC 2008


KR>  static CMPIStatus state_change_pause(virDomainPtr dom, virDomainInfoPtr info)
KR>  {
KR>          CMPIStatus s = {CMPI_RC_OK, NULL};
KR> +        virConnectPtr conn;
KR> +        unsigned char state; 
KR>          int ret = 0;

KR> -        switch (info->state) {
KR> +        state = info->state;
KR> +        conn = virDomainGetConnect(dom);
KR> +
KR> +        if ((STREQC(virConnectGetType(conn), "Xen")) && 
KR> +           (state == VIR_DOMAIN_NOSTATE)) {
KR> +           state = VIR_DOMAIN_RUNNING;
KR> +        }
KR> +
KR> +        switch (state) {

I can't help but notice that you do this exact same thing in several
other places.

Perhaps a unified adjust_state_xen() function that would coalesce
NO_STATE and RUNNING would be useful here.  You could use it to
pre-adjust the state before getting the CIM equivalent in the earlier
code, and then use it in these state change functions to avoid these
special cases?

-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms at us.ibm.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20080807/ad86d876/attachment.sig>


More information about the Libvirt-cim mailing list