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(a)us.ibm.com