<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Nov 20, 2020 at 3:22 PM Laine Stump <<a href="mailto:laine@redhat.com">laine@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
    <div>On 11/20/20 1:07 PM, Dustan B Helm
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div dir="ltr">On Fri, Nov 20, 2020 at 5:33 AM Peter Krempa <<a href="mailto:pkrempa@redhat.com" target="_blank">pkrempa@redhat.com</a>>
          wrote:<br>
        </div>
        <div class="gmail_quote">
          <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Fri, Nov 20, 2020 at
            09:41:44 +0000, Daniel Berrange wrote:<br>
            > On Thu, Nov 19, 2020 at 03:48:48PM -0600, Dustan B Helm
            wrote:<br>
            > > [image: Dustan Helm] <<a href="https://gitlab.com/dustan.helm" rel="noreferrer" target="_blank">https://gitlab.com/dustan.helm</a>><br>
            > > Dustan Helm <<a href="https://gitlab.com/dustan.helm" rel="noreferrer" target="_blank">https://gitlab.com/dustan.helm</a>>
            @dustan.helm<br>
            > > <<a href="https://gitlab.com/dustan.helm" rel="noreferrer" target="_blank">https://gitlab.com/dustan.helm</a>>
            · just now<br>
            > > <<a href="https://gitlab.com/libvirt/libvirt/-/issues/90#note_451306432" rel="noreferrer" target="_blank">https://gitlab.com/libvirt/libvirt/-/issues/90#note_451306432</a>><br>
            > > <<a href="https://gitlab.com/libvirt/libvirt/-/issues/90#" rel="noreferrer" target="_blank">https://gitlab.com/libvirt/libvirt/-/issues/90#</a>><br>
            > > <br>
            > > Before we start making changes and solidifying our
            XML parameter choices,<br>
            > > we have a few clarifying questions about the issue
            we'd like to get out of<br>
            > > the way.<br>
            > > <br>
            > >    1.<br>
            > > <br>
            > >    In src/qemu/qemu_capabilities.h, we found the
            string "/* -drive<br>
            > >    file.driver=vxhs via query-qmp-schema */" after
            the QEMU_CAPS_VXHS<br>
            > >    declaration. What is the purpose of these
            strings, and how do we modify<br>
            > >    them to make sense for nfs? Would we simply
            mirror what is done for VXHS,<br>
            > >    adding nfs as the protocol instead?<br>
            > <br>
            > These comments are just a hint/reminder to readers
            about what QEMU command<br>
            > line option(s), the capability check is tracking the
            availability of. That<br>
            > particular example might be a bit misleading, since in
            the qemu_capabilities.c<br>
            > file, we're actually looking for the
            blockdev-arg/arg-type/+vxhs feature,<br>
            > not -drive.  QEMU has 2 ways of configuring disks,
            -drive is the historical<br>
            > main way, and -blockdev is the modern way that libvirt
            introduced support<br>
            > for relatively recently. We actually end up having to
            support both approachs<br>
            > in libvirt currrently, as we try to make libvirt work
            with both old and new<br>
            > QEMU versions.<br>
            <br>
            For new features though I strongly prefer if we no longer
            update the old<br>
            code. Implement the new protocol only for -blockdev.<br>
            <br>
            > Peter can probably offer better suggestions than me
            about what specific<br>
            > thing to probe for 'nfs'.<br>
            <br>
            The simplest way to probe for nfs protocol support is to use
            the<br>
            following query string in virQEMUCapsQMPSchemaQueries[]:<br>
            <br>
            "blockdev-add/arg-type/+nfs"<br>
            <br>
            Looking at the @BlockdevOptionsNfs struct in<br>
            qemu.git/qapi/block-core.json it seems that all properties
            were<br>
            introduced at same time, so the check doesn't need to be
            more specific.<br>
            <br>
            I can provide more insight on how
            virQEMUCapsQMPSchemaQueries[] works if<br>
            you are interested, but the above will work.<br>
            <br>
            > >    2.<br>
            > > <br>
            > >    Where is domain XML parsed and formatted? Is
            that what is referred to by<br>
            > >    the schema formats in domaincommon.rng?<br>
            > <br>
            > The domaincommon.rng file provides the RelaxNG schema,
            which is used for<br>
            > (optionally) validating XML files before parsing.<br>
            > <br>
            > The actual parser lives in src/conf/domain_conf.{c,h}
            files.<br>
            > <br>
            > There are also docs for users about the schema in
            docs/formatdomain.rst<br>
            > <br>
            <br>
            Adding the NFS protocol itself is rather trivial because we
            use enum<br>
            to string convertors which cause a compilation failure if
            you don't<br>
            populate the strings, so adding the protocol type will be
            enough to<br>
            figure out where.<br>
            <br>
            If you want to implement other properties of the nfs
            protocol driver<br>
            such as @user or @group. I suggest you first send a RFC mail
            with your<br>
            proposed XML addition for review before diving into the rng
            schema and<br>
            XML/formatter parser.<br>
            <br>
            Looking at the options in @BlockdevOptionsNfs @user and
            @group seem a<br>
            bit interesting. I'd not worry with the rest probably.<br>
            <br>
            > >    3.<br>
            > > <br>
            > >    In src/qemu/qemu_block.c, the json object
            arguments currently present in<br>
            > >    qemuBlockStorageSourceGetVxHSProps(...) are not
            the same ones listed in the<br>
            > >    example commit. What is the reason for this
            change, and how should we take<br>
            > >    it into account when implementing a new
            protocol type?<br>
            > <br>
            > I'll leave thi question to Peter too.<br>
            <br>
            I'm not going to outline why we've changed the old commit.
            You are<br>
            implementing new code. You'll need to add a handler to<br>
            qemuBlockStorageSourceGetBackendProps which converts the
            appropriate<br>
            fields of virStorageSource to a virJSONValue object which
            maps to the<br>
            qemu properties according to the @BlockdevOptionsNfs qemu
            struct.<br>
            <br>
            To verify that it's correct you can add a TEST_DISK_TO_JSON
            case to<br>
            tests/qemublocktest.c (input files are in<br>
            libvirt/tests/qemublocktestdata/xml2json/ ) where you
            provide a disk XML<br>
            snippet and the output is what we'd use with qemu.<br>
            <br>
            Note that the 'onlytarget' boolean formats a string which is
            written<br>
            into the qcow2 header file if you create an overlay/external
            snapshot,<br>
            so it must not include any transient or authentication data.<br>
            <br>
            All of the above is QMP-schema validated so you'll be
            notified if it<br>
            doesn't conform to qemu's monitor schema.<br>
            <br>
            You'll also need to implement a backing store string parser
            (that is<br>
            the string which qemu writes to the overlay as noted above).
            The parser<br>
            entry point is virStorageSourceParseBackingJSON and the
            backends for it<br>
            are registered in virStorageSourceJSONDriverParser struct.<br>
            <br>
            The tests for the above are in tests/virstoragetest.c as<br>
            TEST_BACKING_PARSE.<br>
            <br>
            Then depending on whether you actually want to add support
            for image<br>
            creation (e.g. to support creating snapshots backed by the
            NFS storage<br>
            directly) you then need to implement hanling in<br>
            qemuBlockStorageSourceCreateGetStorageProps.<br>
            <br>
            You'll definitely see all the places that might need
            implementing once<br>
            you add the new protocol entry to enum virStorageNetProtocol
            as we in<br>
            many cases use switch statements with proper type where the
            compiler<br>
            reminds you that you need to add the handling for the new
            value in the<br>
            given patch.<br>
            <br>
            Since implementation of the qemu bits should be in a
            separate commit<br>
            from the one adding the parser bits and thus the new enum,
            it's okay to<br>
            just add the enum value to the swithc case and implement it
            later.<br>
            <br>
          </blockquote>
          <div> <span style="background-color:transparent;color:rgb(0,0,0);font-family:Arial;white-space:pre-wrap">We weren't exactly sure what you meant by submitting our proposed XML additions if we are to avoid diving into the schemas. Our idea is to have the NFS generate XML based on issue 90, where you have a network disk, a source protocol, a host, and a new NFS tag which has a user attribute and a group attribute (both required). In terms of the rng schema, we would make it look similar to the VxHS schema (diskSourceNetworkProtocolVxHS) except that below the diskSourceNetworkHost we would also interweave a diskSourceNFS reference, which would require both user and group.</span></div>
        </div>
      </div>
    </blockquote>
    <p><br>
    </p>
    <p>(since it's already quite late in the day on a Friday where Peter
      is located, I'll make an attempt to answer for him :-)</p>
    <p><br>
    </p>
    <p>I believe what he's asking for is just an email that says
      something like (names and organizations completely fabricated on
      the spot for sake of example):</p>
    <p><br>
    </p>
    <p>"Our idea is to implement this new feature by adding a new value
      "blorg" to the <bipple> element "blox", and an optional
      <bumble> subelement of <bipple) that contains
      blahblahbobloblaw details, like this:</p>
    <p><br>
    </p>
    <p>      <device something='xyzzy'></p>
    <p>         <bipple blox='blorg'></p>
    <p>           <blorg
      blahblah='bobloblaw'>lawblog</blorg></p>
    <p>         </bipple></p>
    <p>         ...</p>
    <p>So, what do you think?"</p>
    <p><br>
    </p>
    <p>or whatever. i.e., not a vague description or a formal RNG
      representation of the changes you want to make, but short and
      specific description along with an example of what those changes
      will look like in an actual XML config document - something like
      the descriptions and example XML bits in
      <a href="https://www.libvirt.org/formatdomain.html" target="_blank">https://www.libvirt.org/formatdomain.html</a>. This is *much* quicker
      to parse and discuss than an RNG grammar :-)<br></p></div></blockquote><div><span style="background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-size:12pt;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap">We plan to support NFS protocol according to the example XML from </span><a href="http://gitlab.com/libvirt/libvirt/-/issues/90" style="text-decoration-line:none"><span style="font-size:12pt;font-family:Arial;background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;text-decoration-line:underline;vertical-align:baseline;white-space:pre-wrap">Issue 90</span></a><span style="background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-size:12pt;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap">. Since there is already support for network disks of different protocol types and host information, we think that the only new XML information we will add is an <nfs> element which will be a subelement of <source>, with attributes “user” and “group” (both strings). This element will only be generated if the source protocol is “nfs” and we assume that both “user” and “group” will be required.</span></div><span id="gmail-docs-internal-guid-8385152c-7fff-9054-ad9a-d6e7d84f6404"><p dir="ltr" style="line-height:1.8;margin-top:12pt;margin-bottom:12pt"><span style="font-size:12pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap">Here is the XML example given in the issue for reference:</span></p><p dir="ltr" style="line-height:1.8;margin-top:12pt;margin-bottom:12pt"><span style="font-size:12pt;font-family:"Courier New";color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap"><disk type='network' device='disk'></span></p><p dir="ltr" style="line-height:1.8;margin-top:12pt;margin-bottom:12pt"><span style="font-size:12pt;font-family:"Courier New";color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap">  <driver name='qemu' type='raw'/></span></p><p dir="ltr" style="line-height:1.8;margin-top:12pt;margin-bottom:12pt"><span style="font-size:12pt;font-family:"Courier New";color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap">  <source protocol='nfs' name='PATH'></span></p><p dir="ltr" style="line-height:1.8;margin-top:12pt;margin-bottom:12pt"><span style="font-size:12pt;font-family:"Courier New";color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap">    <host name='<a href="http://example.com">example.com</a>' port='2049'/    </span></p><p dir="ltr" style="line-height:1.8;margin-top:12pt;margin-bottom:12pt"><span style="font-size:12pt;font-family:"Courier New";color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap">    <nfs user='USER' group='GROUP'/></span></p><p dir="ltr" style="line-height:1.8;margin-top:12pt;margin-bottom:12pt"><span style="font-size:12pt;font-family:"Courier New";color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap">  </source></span></p><p dir="ltr" style="line-height:1.8;margin-top:12pt;margin-bottom:12pt"><span style="font-size:12pt;font-family:"Courier New";color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap">  <target dev='vda' bus='virtio'/></span></p><p dir="ltr" style="line-height:1.8;margin-top:12pt;margin-bottom:12pt"><span style="font-size:12pt;font-family:"Courier New";color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap"></disk></span></p><p style="line-height:1.8;margin-top:12pt;margin-bottom:12pt">What do you think of these proposed changes? Should either of the <nfs> tag's string attributes be optional?</p></span></div></div>