<div dir="ltr">Hi, <div><br></div><div>I am currently facing an issue with libvirt w.r.t  a guest's state and reason code. Precisely following are steps:</div><div><br></div><div>1. I have a running guest named <b>linux-test </b>on KVM</div><div>2. I do a </div><div><b>           $> virsh save linux-test linux-saved.dat</b></div><div>3. At this point </div><div><b>          $> virsh domstate --reason linux-test </b>shows  <b>shutoff(saved)</b></div><div>4. I restarted the libvirtd daemon  </div><div><b>         $>systemctl restart libvirtd</b></div><div>5. Now when I check for the domain state, </div><div><b>         $> virsh domstate --reason linux-test  </b>it reads <b>shutoff(unknown)</b></div><div><b><br></b></div><div><b><br></b></div><div>From what I understand:  </div><div><br></div><div>The reason code for a particular state is maintained in-memory (no persistence in libvirt). Now when libvirtd restarts it queries the qemu monitor for all the running qemu processes and reassigns the state and reason. But for guests which are in shutoff state, there’s exists no QEMU instance for it, hence it has no way to know what was the last reason (i..e the default value 0 or UNKNOWN), but the state remains as shutfoff!<br></div><div><br></div><div>Is there a patch for it? Or someway to retain the reason code across reboots and restart?</div><div><br></div><div>Regards, </div><div>Tanmoy Sinha</div></div>