<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=Windows-1252">
<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;
        font-size:12.0pt;
        font-family:SimSun;
        color:black;}
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;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML \9884\8BBE\683C\5F0F Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:SimSun;
        color:black;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.HTMLChar
        {mso-style-name:"HTML \9884\8BBE\683C\5F0F Char";
        mso-style-priority:99;
        mso-style-link:"HTML \9884\8BBE\683C\5F0F";
        font-family:SimSun;
        color:black;}
.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;}
--></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">
<pre><span lang="EN-US">Hello, I got a question here. When we create consistent active external snapshots with flag “VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE” , the qemuDomainSnapshotFSFreeze will be called firstly to freeze all filesystems in vm, and then create snapshots. For windows vm, freezing filesystems used by vss service. If IO pressure in vm is too big or internal error happened in vss , freezing filesytems will failed , and qemuDomainSnapshotFSFreeze returns 0 which meaning that no filesystems are frozen. In the function qemuDomainSnapshotCreateActiveExternal, libvirt creates external snapshots all the same in such a situation that qemuDomainSnapshotFSFreeze returns 0, but the created snapshots are not consistent snapshots in such a situation . So shouldn't we abandon creating snapshots and goto cleanup in the situation that qemuDomainSnapshotFSFreeze returns 0?<o:p></o:p></span></pre>
<p class="MsoNormal"><span lang="EN-US"><br>
The code below:<br>
<br>
<br>
static int<br>
qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,<br>
                    virQEMUDriverPtr driver,<br>
                   virDomainObjPtr vm,<br>
                    virDomainSnapshotObjPtr snap,<br>
                    unsigned int flags)<br>
{<br>
    virObjectEventPtr event;<br>
    bool resume = false;<br>
    int ret = -1;<br>
    qemuDomainObjPrivatePtr priv = vm->privateData;<br>
    char *xml = NULL;<br>
    bool memory = snap->def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL;<br>
    bool memory_unlink = false;<br>
    bool atomic = !!(flags & VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC);<br>
    bool transaction = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION);<br>
    int thaw = 0; /* 1 if freeze succeeded, -1 if freeze failed */<br>
    bool pmsuspended = false;<br>
    virQEMUDriverConfigPtr cfg = NULL;<br>
    int compressed;<br>
    char *compressedpath = NULL;<br>
<br>
    /* If quiesce was requested, then issue a freeze command, and a<br>
     * counterpart thaw command when it is actually sent to agent.<br>
     * The command will fail if the guest is paused or the guest agent<br>
     * is not running, or is already quiesced.  */<br>
</span><span lang="EN-US" style="color:red">    if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE) {<br>
        int freeze = qemuDomainSnapshotFSFreeze(driver, vm, NULL, 0);<br>
        if (freeze < 0) {<br>
            /* the helper reported the error */<br>
            if (freeze == -2)<br>
                thaw = -1; /* the command is sent but agent failed */<br>
            goto cleanup;<br>
        }<br>
        thaw = 1;<br>
    }</span><span lang="EN-US"><br>
    <br>
    ......<br>
    ...... <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:windowtext"><o:p> </o:p></span></p>
</div>
</body>
</html>