KR> # HG changeset patch
KR> # User Kaitlin Rupert <karupert(a)us.ibm.com>
KR> # Date 1214850941 25200
KR> # Node ID 98e6e7b6160be701c4124cb04eef9c893fdfaa1d
KR> # Parent b123b6b1fb08c3ab956f1c33801e743e082192b9
KR> Add state transition poll to DestroySystem() call.
Sorry for the delay here...
KR> +#define STATE_TRANSITION_TIMEOUT 120
First off, 120 seconds is sure to be longer than the CIM timeout, so
if the call really lasts this long, the client will get a timeout. I
think it's probably reasonable to expect that after a destroy(), the
undefine() would happen before the domain could really be pulled
offline. However, 120 seconds should be considered "something is
wrong and the domain isn't going away" IMHO.
If you think that 120 seconds is necessary (and reasonable), then we
need to check for online-ness, and start a job to do this in that case.
KR> + for (i = 0; i < STATE_TRANSITION_TIMEOUT; i++) {
KR> + if ((i % 30) == 0) {
KR> + CU_DEBUG("Polling for destroy completion...");
KR> + }
KR> +
KR> + dom = virDomainLookupByName(conn, dom_name);
KR> + if (dom == NULL) {
KR> + CU_DEBUG("Domain successfully destroyed");
KR> + rc = IM_RC_OK;
KR> + trigger_indication(context,
KR> +
"ComputerSystemDeletedIndication",
KR> + NAMESPACE(reference));
KR> + goto error;
KR> + }
KR> +
KR> + if (virDomainGetInfo(dom, &info) != 0) {
KR> + CU_DEBUG("Unable to get domain current state");
KR> + rc = IM_RC_SYS_NOT_FOUND;
KR> + goto error;
KR> + }
KR> +
KR> + if (info.state == VIR_DOMAIN_SHUTOFF)
KR> + break;
KR> +
We have domain_online() which does (effectively) the same thing (but
more concisely) and is considered to be the test for online-ness of a
domain elsewhere. Any reason not to use that here?
--
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms(a)us.ibm.com