<html><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"><style>body { line-height: 1.5; }body { font-size: 10.5pt; font-family: 'Microsoft YaHei UI'; color: rgb(0, 0, 0); line-height: 1.5; }</style></head><body>
<div><span style="font-family: "" microsoft="" yahei="" ui'";="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgba(0,="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'="">Hi, guys </span></div><div><span style="font-family: "" microsoft="" yahei="" ui'";="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgba(0,="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'=""><br></span></div><div><span style="font-family: "" microsoft="" yahei="" ui'";="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgba(0,="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'="">I find that nova define </span><span style="font-family: ''; font-size: 10.5pt; line-height: 1.5; background-color: window;">VIR_DOMAIN_SHUTDOWN and VIR_DOMAIN_SHUTOFF as equal. </span></div><div>And the comment in source code writes </div><div>'</div><div><span style="font-family: "" microsoft="" yahei="" ui'";="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgba(0,="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'=""><i> # The libvirt API doc says that DOMAIN_SHUTDOWN means the domain <br> # is being shut down. So technically the domain is still <br> # running. SHUTOFF is the real powered off state. But we will map <br> # both to SHUTDOWN anyway.</i></span></div><div><i>'</i></div><div>This design cause some problems. For example, in <span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">_clean_shutdown function, </span></div><div>the author assume the VM is really shutdown if its power state in SHUTDOWN<span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">.</span></div><div><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">But in fact, </span><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">SHUTDOWN state could either be </span><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">VIR_DOMAIN_SHUTDOWN</span><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"> or </span></div><div>VIR_DOMAIN_SHUTOFF. So this assumption is not right and may cause other </div><div>problems like <span style="font-family: ''; font-size: 10.5pt; line-height: 1.5; background-color: window;">https://bugs.launchpad.net/nova/+bug/1642689 </span></div><div><br></div>
<div><span style="font-family: "" microsoft="" yahei="" ui'";="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgba(0,="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'=""><i> def _clean_shutdown(self, instance, timeout, retry_interval):<br> """Attempt to shutdown the instance gracefully.<br> :param instance: The instance to be shutdown<br> :param timeout: How long to wait in seconds for the instance to<br> shutdown<br> :param retry_interval: How often in seconds to signal the instance<br> to shutdown while waiting<br> :returns: True if the shutdown succeeded<br> """<br><br> # List of states that represent a shutdown instance<br> SHUTDOWN_STATES = [power_state.SHUTDOWN,<br> power_state.CRASHED]<br><br> try:<br> guest = self._host.get_guest(instance)<br> except exception.InstanceNotFound:<br> # If the instance has gone then we don't need to<br> # wait for it to shutdown<br> return True<br><br> state = guest.get_power_state(self._host)<br> if state in SHUTDOWN_STATES:<br> LOG.info(_LI("Instance already shutdown."),<br> instance=instance)<br> return True</i><br></span></div><div><span style="font-family: "" microsoft="" yahei="" ui'";="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgba(0,="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'=""><i><br></i></span></div><div><span style="font-family: '';" microsoft="" yahei="" ui'";="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgba(0,="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'="">So I wonder why the original design let </span><span style="font-family: ''; font-size: 10.5pt; line-height: 1.5; background-color: window;">VIR_DOMAIN_SHUTDOWN </span></div><div><span style="font-family: ''; font-size: 10.5pt; line-height: 1.5; background-color: window;">equals VIR_DOMAIN_SHUTOFF? Is there anyone knows?</span></div><hr style="width: 210px; height: 1px;" color="#b5c4df" size="1" align="left">
<div><span><div style="MARGIN: 10px; FONT-FAMILY: verdana; FONT-SIZE: 10pt"><div>luogangyi@chinamobile.com</div></div></span></div>
</body></html>