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

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Thu Aug 7 18:45:15 UTC 2008


>  static CMPIStatus state_change_reset(virDomainPtr dom, virDomainInfoPtr info)
>  {
>          CMPIStatus s = {CMPI_RC_OK, NULL};
> +        virConnectPtr conn;
> +        unsigned char state; 
>          int ret = 0;
> 
> -        switch (info->state) {
> +        state = info->state;
> +        conn = virDomainGetConnect(dom);
> +
> +        if ((STREQC(virConnectGetType(conn), "Xen")) && 
> +           (state == VIR_DOMAIN_NOSTATE)) {
> +           state = VIR_DOMAIN_RUNNING;
> +        }

Instead of having this redundant bit of code, it could be replaced by:

state_lv_to_cim()
adjust_state_if_nostate_xen()

And then the switch can be done using CIM states instead of libvirt 
states.  But using libvirt states for this determination seems more 
flexible.

> +
> +        switch (state) {
>          case VIR_DOMAIN_RUNNING:
>          case VIR_DOMAIN_BLOCKED:
> +        case VIR_DOMAIN_PAUSED:
>                  CU_DEBUG("Reset domain");
>                  ret = domain_reset(dom);
>                  break;
> 


-- 
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list