<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    hi Osier:<br>
    于 2011年09月22日 15:08, Osier Yang 写道:
    <blockquote cite="mid:4E7ADEE5.1060101@redhat.com" type="cite">于
      2011年09月22日 14:31, Eli 写道:
      <br>
      <blockquote type="cite">hi Osier :
        <br>
        于 2011年09月21日 17:07, Osier Yang 写道:
        <br>
        <blockquote type="cite">* src/storage/storage_backend_logical.c:
          <br>
          <br>
          If a logical vol is created with multiple stripes. (e.g.
          --stripes 3),
          <br>
          the "device" field of lvs output will have multiple fileds
          which are
          <br>
          seperated by comma. It means the RE we write in the codes will
          not
          <br>
          work well anymore. E.g. (lvs output for a stripped vol, uses
          "#" as
          <br>
          seperator here):
          <br>
          <br>
          test_stripes##fSLSZH-zAS2-yAIb-n4mV-Al9u-HA3V-oo9K1B#\
          <br>
          /dev/sdc1(10240),/dev/sdd1(0)#42949672960#4194304
          <br>
          <br>
          The RE we uses:
          <br>
          <br>
               const char *regexes[] = {
          <br>
                  
          "^\\s*(\\S+),(\\S*),(\\S+),(\\S+)\\((\\S+)\\),(\\S+),([0-9]+),?\\s*$"
          <br>
               };
          <br>
          <br>
          This patch changes the seperator into "#" to fix the problem.
          <br>
          <br>
          Related RHBZ:
          <a class="moz-txt-link-freetext" href="https://bugzilla.redhat.com/show_bug.cgi?id=727474">https://bugzilla.redhat.com/show_bug.cgi?id=727474</a>
          <br>
          ---
          <br>
            src/storage/storage_backend_logical.c |    7 ++++---
          <br>
            1 files changed, 4 insertions(+), 3 deletions(-)
          <br>
          <br>
          diff --git a/src/storage/storage_backend_logical.c
          b/src/storage/storage_backend_logical.c
          <br>
          index 4f42047..45f77ad 100644
          <br>
          --- a/src/storage/storage_backend_logical.c
          <br>
          +++ b/src/storage/storage_backend_logical.c
          <br>
          @@ -187,19 +187,20 @@
          virStorageBackendLogicalFindLVs(virStoragePoolObjPtr pool,
          <br>
                 *
          <br>
                 * NB can be multiple rows per volume if they have many
          extents
          <br>
                 *
          <br>
          -     * NB lvs from some distros (e.g. SLES10 SP2) outputs
          trailing "," on each line
          <br>
          +     * NB lvs from some distros (e.g. SLES10 SP2) outputs
          trailing
          <br>
          +     * @separator on each line
          <br>
                 *
          <br>
                 * NB Encrypted logical volumes can print ':' in their
          name, so it is
          <br>
                 *    not a suitable separator (rhbz 470693).
          <br>
                 */
          <br>
                const char *regexes[] = {
          <br>
          -       
          "^\\s*(\\S+),(\\S*),(\\S+),(\\S+)\\((\\S+)\\),(\\S+),([0-9]+),?\\s*$"
          <br>
          +       
          "^\\s*(\\S+)#(\\S*)#(\\S+)#(\\S+)\\((\\S+)\\)#(\\S+)#([0-9]+)#?\\s*$"
          <br>
                };
          <br>
                int vars[] = {
          <br>
                    7
          <br>
                };
          <br>
                const char *prog[] = {
          <br>
          -        LVS, "--separator", ",", "--noheadings", "--units",
          "b",
          <br>
          +        LVS, "--separator", "#", "--noheadings", "--units",
          "b",
          <br>
                    "--unbuffered", "--nosuffix", "--options",
          <br>
                   
          "lv_name,origin,uuid,devices,seg_size,vg_extent_size",
          <br>
                    pool->def->source.name, NULL
          <br>
        </blockquote>
        <br>
        I reproduced the bug :
        <br>
        <br>
        [root@localhost bin]# ./virsh -d 5 pool-create-as vg_ssd logical
        --target /dev/vg_ssd
        <br>
        error: Failed to create pool vg_ssd
        <br>
        error: cannot open volume '/dev/vg_ssd/test_stripes,': No such
        file or directory
        <br>
        <br>
        and then I tested this patch , it seems work well.
        <br>
        <br>
        [root@localhost bin]# ./virsh -d 5 pool-create-as vg_ssd logical
        --target /dev/vg_ssd
        <br>
        Pool vg_ssd created
        <br>
        <br>
        [root@localhost bin]# ./virsh pool-info vg_ssd
        <br>
        Name: vg_ssd
        <br>
        UUID: c45cc84e-7879-cc15-ee78-2d2dda6b531d
        <br>
        State: running
        <br>
        Persistent: no
        <br>
        Autostart: no
        <br>
        Capacity: 200.00 MB
        <br>
        Allocation: 152.00 MB
        <br>
        Available: 48.00 MB
        <br>
        <br>
      </blockquote>
      <br>
      Thanks for the testing, Eli,
      <br>
      <br>
      Could you also check what's the vol XML?  I want to confirm if the
      <br>
      "<extents>" in
      "<source><device></device></source>"displays
      well,
      <br>
      though it looks to me there is no "<path>" element defined
      for "<extents>"
      <br>
      in the storage vol schema yet.
      <br>
      <br>
    </blockquote>
    1. my vol XML is like this:<br>
    <br>
     
    virsh # vol-dumpxml test_stripes --pool vg_ssd<br>
    <volume><br>
      <name>test_stripes</name><br>
      <key>1pc6Gf-1hn2-WGnw-ASKt-uX6w-xUed-qERq50</key><br>
    <b>  <source><br>
          <device path='/dev/sdb(0),/dev/sdc'><br>
            <extent start='0' end='159383552'/><br>
          </device><br>
        </source></b><br>
      <capacity>159383552</capacity><br>
      <allocation>159383552</allocation><br>
      <target><br>
        <path>/dev/vg_ssd/test_stripes</path><br>
        <permissions><br>
          <mode>0660</mode><br>
          <owner>0</owner><br>
          <group>6</group><br>
         
    <label>system_u:object_r:fixed_disk_device_t:s0</label><br>
        </permissions><br>
      </target><br>
    </volume><br>
    <br>
    2. look at the docs/schemas/storagevol.rng<br>
    <br>
    you can see that:<br>
    <br>
      <define name='source'><br>
        <element name='source'><br>
          <zeroOrMore><br>
            <ref name='sourcedev'/><br>
          </zeroOrMore><br>
        </element><br>
      </define><br>
    <br>
      <b><define name='sourcedev'></b><br>
        <element name='device'><br>
          <attribute name='path'><br>
            <ref name='path'/><br>
          </attribute><br>
          <choice><br>
            <empty/><br>
            <b><ref name='devextents'/></b><br>
          </choice><br>
        </element><br>
      </define><br>
    <br>
      <b><define name='devextents'></b><br>
        <oneOrMore><br>
          <element name='extent'><br>
            <attribute name='start'><br>
              <ref name='uint'/><br>
            </attribute><br>
            <attribute name='end'><br>
              <ref name='uint'/><br>
            </attribute><br>
          </element><br>
        </oneOrMore><br>
      </define><br>
    //////////////////<br>
    so the xml should like this<br>
    <br>
    <source><br>
        <device path=xxx><br>
            <extent start= end=/><br>
        </device><br>
    </source><br>
    <br>
    ps: the xml just shows the 'element name' not 'define name' that
    defined in the schema file.<br>
    <blockquote cite="mid:4E7ADEE5.1060101@redhat.com" type="cite">Regards,
      <br>
      Osier
      <br>
    </blockquote>
    best regards<br>
    eli<br>
    <br>
  </body>
</html>