<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
font-size:10.5pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
text-indent:21.0pt;
font-size:10.5pt;
font-family:"Calibri","sans-serif";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
/* Page Definitions */
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:9377862;
mso-list-type:hybrid;
mso-list-template-ids:-1956710282 -97083406 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:37.2pt;
text-indent:-18.0pt;}
@list l1
{mso-list-id:215119884;
mso-list-type:hybrid;
mso-list-template-ids:1656506586 -578266038 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l1:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:42.0pt;
text-indent:-21.0pt;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="ZH-CN" link="blue" vlink="purple" style="text-justify-trim:punctuation">
<div class="WordSection1">
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black">Hello,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-indent:19.2pt;text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black">when do steps as follows:<o:p></o:p></span></p>
<p class="MsoListParagraph" align="left" style="margin-left:37.2pt;text-align:left;text-indent:-18.0pt;mso-list:l0 level1 lfo1;text-autospace:none">
<![if !supportLists]><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black"><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black">start a vm<o:p></o:p></span></p>
<p class="MsoListParagraph" align="left" style="margin-left:37.2pt;text-align:left;text-indent:-18.0pt;mso-list:l0 level1 lfo1;text-autospace:none">
<![if !supportLists]><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black"><span style="mso-list:Ignore">2.<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black">restart libvirtd service<o:p></o:p></span></p>
<p class="MsoListParagraph" align="left" style="margin-left:37.2pt;text-align:left;text-indent:-18.0pt;mso-list:l0 level1 lfo1;text-autospace:none">
<![if !supportLists]><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black"><span style="mso-list:Ignore">3.<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black">shutdown the vm<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="margin-left:19.2pt;text-align:left;text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black">I found the pidfile associated with the vm has not been removed.<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black"> Analyzing related piece of code, I found when libvirtd service restarted, the vm's _virDomainObj structure(named
dom here) in libvirtd will be re-established according to the vm's state-file or config-file, but its member of privateData.pidfile will not be reassigned value. By the way, qemudriver is used in my libvirt.<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black">
<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-indent:19.2pt;text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black">So when the vm is shutdown, its pidfile will not be removed, because the member of privateData.pidfile is NULL.
<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-indent:19.2pt;text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-indent:19.2pt;text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black">My questions are :<o:p></o:p></span></p>
<p class="MsoListParagraph" align="left" style="margin-left:42.0pt;text-align:left;text-indent:-21.0pt;mso-list:l1 level1 lfo2;text-autospace:none">
<![if !supportLists]><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black"><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black">Do you think it is a problem when a vm has been shutdown, but its pidfile has not been removed ?<o:p></o:p></span></p>
<p class="MsoListParagraph" align="left" style="margin-left:42.0pt;text-align:left;text-indent:-21.0pt;mso-list:l1 level1 lfo2;text-autospace:none">
<![if !supportLists]><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black"><span style="mso-list:Ignore">2.<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black">Do you think it is expected that the member of privateData.pidfile's value missed after libvirtd restart?
<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black"> If it</span><span lang="EN-US" style="font-size:10.0pt;color:black">’</span><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black">s
a bug then I</span><span lang="EN-US" style="font-size:10.0pt;color:black">’</span><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black">ll submit the patch to fix it.<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black"> Also list the related piece of code about removing the vm's pidfile in libvirt for your information:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black"> if (priv->pidfile &&<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black"> unlink(priv->pidfile) < 0 &&<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black"> errno != ENOENT)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black"> VIR_WARN("Failed to remove PID file for %s: %s",<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black"> vm->def->name, virStrerror(errno, ebuf, sizeof(ebuf)));</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left"><span lang="EN-US">Best Regards,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left"><span lang="EN-US">-WangYufei<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
</body>
</html>