1. 21 2月, 2017 1 次提交
  2. 09 1月, 2017 1 次提交
  3. 06 12月, 2016 1 次提交
  4. 22 11月, 2016 1 次提交
  5. 01 11月, 2016 4 次提交
    • P
      block/gluster: fix port type in the QAPI options list · 53d9837f
      Prasanna Kumar Kalever 提交于
      After introduction of qapi schema in gluster block driver code, the port
      type is now string as per InetSocketAddress
      
      { 'struct': 'InetSocketAddress',
        'data': {
          'host': 'str',
          'port': 'str',
          '*to': 'uint16',
          '*ipv4': 'bool',
          '*ipv6': 'bool' } }
      
      but the current code still treats it as QEMU_OPT_NUMBER, hence fixing port
      to accept QEMU_OPT_STRING.
      Suggested-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      53d9837f
    • P
      block/gluster: improve defense over string to int conversion · c56ac33b
      Prasanna Kumar Kalever 提交于
      using atoi() for converting string to int may be error prone in case if
      string supplied in the argument is not a fold of numerical number,
      
      This is not a bug because in the existing code,
      
      static QemuOptsList runtime_tcp_opts = {
          .name = "gluster_tcp",
          .head = QTAILQ_HEAD_INITIALIZER(runtime_tcp_opts.head),
          .desc = {
              ...
              {
                  .name = GLUSTER_OPT_PORT,
                  .type = QEMU_OPT_NUMBER,
                  .help = "port number ...",
              },
      ...
      };
      
      port type is QEMU_OPT_NUMBER, before we actually reaches atoi() port is already
      defended by parse_option_number()
      
      However It is a good practice to use function like parse_uint_full()
      over atoi() to keep port self defended
      
      Note: As now the port string to int conversion has its defence code set,
      and also we understand that port argument is actually a string type,
      in the follow up patch let's move port type from QEMU_OPT_NUMBER to
      QEMU_OPT_STRING
      
      [Jeff Cody: removed spurious parenthesis]
      Signed-off-by: NPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      c56ac33b
    • P
      block/gluster: memory usage: use one glfs instance per volume · 6349c154
      Prasanna Kumar Kalever 提交于
      Currently, for every drive accessed via gfapi we create a new glfs
      instance (call glfs_new() followed by glfs_init()) which could consume
      memory in few 100 MB's, from the table below it looks like for each
      instance ~300 MB VSZ was consumed
      
      Before:
      -------
      Disks   VSZ     RSS
      1       1098728 187756
      2       1430808 198656
      3       1764932 199704
      4       2084728 202684
      
      This patch maintains a list of pre-opened glfs objects. On adding
      a new drive belonging to the same gluster volume, we just reuse the
      existing glfs object by updating its refcount.
      
      With this approch we shrink up the unwanted memory consumption and
      glfs_new/glfs_init calls for accessing a disk (file) if belongs to
      same volume.
      
      From below table notice that the memory usage after adding a disk
      (which will reuse the existing glfs object hence) is in negligible
      compared to before.
      
      After:
      ------
      Disks   VSZ     RSS
      1       1101964 185768
      2       1109604 194920
      3       1114012 196036
      4       1114496 199868
      
      Disks: number of -drive
      VSZ: virtual memory size of the process in KiB
      RSS: resident set size, the non-swapped physical memory (in kiloBytes)
      
      VSZ and RSS are analyzed using 'ps aux' utility.
      Signed-off-by: NPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Message-id: 1477581890-4811-1-git-send-email-prasanna.kalever@redhat.com
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      6349c154
    • J
      block: add gluster ifdef guard checks for SEEK_DATA/SEEK_HOLE support · d9b78974
      Jeff Cody 提交于
      Add checks to see if the system compiling QEMU has support for
      SEEK_HOLE/SEEK_DATA.  If the system does not, we will flag that seek
      data is unsupported in gluster.
      
      Note: this is not a check on whether the gluster server itself supports
      SEEK_DATA (that is already done during runtime), but rather if the
      compilation environment supports SEEK_DATA.
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Tested-by: NEric Blake <eblake@redhat.com>
      Message-id: 00370bce5c98140d6c56ad5145635ec6551265cc.1475876377.git.jcody@redhat.com
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      d9b78974
  6. 07 10月, 2016 1 次提交
  7. 13 9月, 2016 1 次提交
  8. 20 7月, 2016 6 次提交
    • E
      gluster: Switch .bdrv_co_discard() to byte-based · 1014170b
      Eric Blake 提交于
      Another step towards killing off sector-based block APIs.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 1468624988-423-12-git-send-email-eblake@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      1014170b
    • P
      block/gluster: add support for multiple gluster servers · 6c7189bb
      Prasanna Kumar Kalever 提交于
      This patch adds a way to specify multiple volfile servers to the gluster
      block backend of QEMU with tcp|rdma transport types and their port numbers.
      
      Problem:
      
      Currently VM Image on gluster volume is specified like this:
      
      file=gluster[+tcp]://host[:port]/testvol/a.img
      
      Say we have three hosts in a trusted pool with replica 3 volume in action.
      When the host mentioned in the command above goes down for some reason,
      the other two hosts are still available. But there's currently no way
      to tell QEMU about them.
      
      Solution:
      
      New way of specifying VM Image on gluster volume with volfile servers:
      (We still support old syntax to maintain backward compatibility)
      
      Basic command line syntax looks like:
      
      Pattern I:
       -drive driver=gluster,
              volume=testvol,path=/path/a.raw,[debug=N,]
              server.0.type=tcp,
              server.0.host=1.2.3.4,
              server.0.port=24007,
              server.1.type=unix,
              server.1.socket=/path/socketfile
      
      Pattern II:
       'json:{"driver":"qcow2","file":{"driver":"gluster",
             "volume":"testvol","path":"/path/a.qcow2",["debug":N,]
             "server":[{hostinfo_1}, ...{hostinfo_N}]}}'
      
         driver      => 'gluster' (protocol name)
         volume      => name of gluster volume where our VM image resides
         path        => absolute path of image in gluster volume
        [debug]      => libgfapi loglevel [(0 - 9) default 4 -> Error]
      
        {hostinfo}   => {{type:"tcp",host:"1.2.3.4"[,port=24007]},
                         {type:"unix",socket:"/path/sockfile"}}
      
         type        => transport type used to connect to gluster management daemon,
                        it can be tcp|unix
         host        => host address (hostname/ipv4/ipv6 addresses/socket path)
         port        => port number on which glusterd is listening.
         socket      => path to socket file
      
      Examples:
      1.
       -drive driver=qcow2,file.driver=gluster,
              file.volume=testvol,file.path=/path/a.qcow2,file.debug=9,
              file.server.0.type=tcp,
              file.server.0.host=1.2.3.4,
              file.server.0.port=24007,
              file.server.1.type=unix,
              file.server.1.socket=/var/run/glusterd.socket
      2.
        'json:{"driver":"qcow2","file":{"driver":"gluster","volume":"testvol",
               "path":"/path/a.qcow2","debug":9,"server":
               [{"type":"tcp","host":"1.2.3.4","port":"24007"},
                {"type":"unix","socket":"/var/run/glusterd.socket"}
               ]}}'
      
      This patch gives a mechanism to provide all the server addresses, which are in
      replica set, so in case host1 is down VM can still boot from any of the
      active hosts.
      
      This is equivalent to the backup-volfile-servers option supported by
      mount.glusterfs (FUSE way of mounting gluster volume)
      
      credits: sincere thanks to all the supporters
      Signed-off-by: NPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Message-id: 1468947453-5433-6-git-send-email-prasanna.kalever@redhat.com
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      6c7189bb
    • P
      block/gluster: using new qapi schema · 7edac2dd
      Prasanna Kumar Kalever 提交于
      this patch adds 'GlusterServer' related schema in qapi/block-core.json
      
      [Jeff: minor fix-ups of comments and formatting, per patch reviews]
      Signed-off-by: NPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-id: 1468947453-5433-5-git-send-email-prasanna.kalever@redhat.com
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      7edac2dd
    • P
      block/gluster: deprecate rdma support · 0552ff24
      Prasanna Kumar Kalever 提交于
      gluster volfile server fetch happens through unix and/or tcp, it doesn't
      support volfile fetch over rdma. The rdma code may actually mislead,
      so to make sure things do not break, for now we fallback to tcp when requested
      for rdma, with a warning.
      
      If you are wondering how this worked all these days, its the gluster libgfapi
      code which handles anything other than unix transport as socket/tcp, sad but
      true.
      
      Also gluster doesn't support ipv6 addresses, removing the ipv6 related
      comments/docs section
      
      [Jeff: Minor grammatical fixes in comments and commit message, per
      review comments]
      Signed-off-by: NPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Message-id: 1468947453-5433-4-git-send-email-prasanna.kalever@redhat.com
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      0552ff24
    • P
      block/gluster: code cleanup · f70c50c8
      Prasanna Kumar Kalever 提交于
      unified coding styles of multiline function arguments and other error functions
      moved random declarations of structures and other list variables
      Signed-off-by: NPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Message-id: 1468947453-5433-3-git-send-email-prasanna.kalever@redhat.com
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      f70c50c8
    • P
      block/gluster: rename [server, volname, image] -> [host, volume, path] · d5cf4079
      Prasanna Kumar Kalever 提交于
      A future patch will add support for multiple gluster servers. Existing
      terminology is a bit unusual in relation to what names are used by
      other networked devices, and doesn't map very well to the terminology
      we expect to use for multiple servers.  Therefore, rename the following
      options:
      'server'  -> 'host'
      'image'   -> 'path'
      'volname' -> 'volume'
      Signed-off-by: NPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Message-id: 1468947453-5433-2-git-send-email-prasanna.kalever@redhat.com
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      d5cf4079
  9. 13 7月, 2016 1 次提交
    • P
      coroutine: move entry argument to qemu_coroutine_create · 0b8b8753
      Paolo Bonzini 提交于
      In practice the entry argument is always known at creation time, and
      it is confusing that sometimes qemu_coroutine_enter is used with a
      non-NULL argument to re-enter a coroutine (this happens in
      block/sheepdog.c and tests/test-coroutine.c).  So pass the opaque value
      at creation time, for consistency with e.g. aio_bh_new.
      
      Mostly done with the following semantic patch:
      
      @ entry1 @
      expression entry, arg, co;
      @@
      - co = qemu_coroutine_create(entry);
      + co = qemu_coroutine_create(entry, arg);
        ...
      - qemu_coroutine_enter(co, arg);
      + qemu_coroutine_enter(co);
      
      @ entry2 @
      expression entry, arg;
      identifier co;
      @@
      - Coroutine *co = qemu_coroutine_create(entry);
      + Coroutine *co = qemu_coroutine_create(entry, arg);
        ...
      - qemu_coroutine_enter(co, arg);
      + qemu_coroutine_enter(co);
      
      @ entry3 @
      expression entry, arg;
      @@
      - qemu_coroutine_enter(qemu_coroutine_create(entry), arg);
      + qemu_coroutine_enter(qemu_coroutine_create(entry, arg));
      
      @ reentry @
      expression co;
      @@
      - qemu_coroutine_enter(co, NULL);
      + qemu_coroutine_enter(co);
      
      except for the aforementioned few places where the semantic patch
      stumbled (as expected) and for test_co_queue, which would otherwise
      produce an uninitialized variable warning.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      0b8b8753
  10. 29 6月, 2016 2 次提交
  11. 08 6月, 2016 1 次提交
  12. 20 4月, 2016 3 次提交
    • J
      block/gluster: prevent data loss after i/o error · d85fa9eb
      Jeff Cody 提交于
      Upon receiving an I/O error after an fsync, by default gluster will
      dump its cache.  However, QEMU will retry the fsync, which is especially
      useful when encountering errors such as ENOSPC when using the werror=stop
      option.  When using caching with gluster, however, the last written data
      will be lost upon encountering ENOSPC.  Using the write-behind-cache
      xlator option of 'resync-failed-syncs-after-fsync' should cause gluster
      to retain the cached data after a failed fsync, so that ENOSPC and other
      transient errors are recoverable.
      
      Unfortunately, we have no way of knowing if the
      'resync-failed-syncs-after-fsync' xlator option is supported, so for now
      close the fd and set the BDS driver to NULL upon fsync error.
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      d85fa9eb
    • J
      block/gluster: code movement of qemu_gluster_close() · 5d4343e6
      Jeff Cody 提交于
      Move qemu_gluster_close() further up in the file, in preparation
      for the next patch, to avoid a forward declaration.
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      5d4343e6
    • J
      block/gluster: return correct error value · a8827453
      Jeff Cody 提交于
      Upon error, gluster will call the aio callback function with a
      ret value of -1, with errno set to the proper error value.  If
      we set the acb->ret value to the return value in the callback,
      that results in every error being EPERM (i.e. 1).  Instead, set
      it to the proper error result.
      Reviewed-by: NNiels de Vos <ndevos@redhat.com>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      a8827453
  13. 23 3月, 2016 1 次提交
    • M
      include/qemu/osdep.h: Don't include qapi/error.h · da34e65c
      Markus Armbruster 提交于
      Commit 57cb38b3 included qapi/error.h into qemu/osdep.h to get the
      Error typedef.  Since then, we've moved to include qemu/osdep.h
      everywhere.  Its file comment explains: "To avoid getting into
      possible circular include dependencies, this file should not include
      any other QEMU headers, with the exceptions of config-host.h,
      compiler.h, os-posix.h and os-win32.h, all of which are doing a
      similar job to this file and are under similar constraints."
      qapi/error.h doesn't do a similar job, and it doesn't adhere to
      similar constraints: it includes qapi-types.h.  That's in excess of
      100KiB of crap most .c files don't actually need.
      
      Add the typedef to qemu/typedefs.h, and include that instead of
      qapi/error.h.  Include qapi/error.h in .c files that need it and don't
      get it now.  Include qapi-types.h in qom/object.h for uint16List.
      
      Update scripts/clean-includes accordingly.  Update it further to match
      reality: replace config.h by config-target.h, add sysemu/os-posix.h,
      sysemu/os-win32.h.  Update the list of includes in the qemu/osdep.h
      comment quoted above similarly.
      
      This reduces the number of objects depending on qapi/error.h from "all
      of them" to less than a third.  Unfortunately, the number depending on
      qapi-types.h shrinks only a little.  More work is needed for that one.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      [Fix compilation without the spice devel packages. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      da34e65c
  14. 20 1月, 2016 1 次提交
  15. 11 11月, 2015 1 次提交
  16. 12 9月, 2014 2 次提交
  17. 20 8月, 2014 1 次提交
    • M
      block: Use g_new() & friends where that makes obvious sense · 5839e53b
      Markus Armbruster 提交于
      g_new(T, n) is neater than g_malloc(sizeof(T) * n).  It's also safer,
      for two reasons.  One, it catches multiplication overflowing size_t.
      Two, it returns T * rather than void *, which lets the compiler catch
      more type errors.
      
      Patch created with Coccinelle, with two manual changes on top:
      
      * Add const to bdrv_iterate_format() to keep the types straight
      
      * Convert the allocation in bdrv_drop_intermediate(), which Coccinelle
        inexplicably misses
      
      Coccinelle semantic patch:
      
          @@
          type T;
          @@
          -g_malloc(sizeof(T))
          +g_new(T, 1)
          @@
          type T;
          @@
          -g_try_malloc(sizeof(T))
          +g_try_new(T, 1)
          @@
          type T;
          @@
          -g_malloc0(sizeof(T))
          +g_new0(T, 1)
          @@
          type T;
          @@
          -g_try_malloc0(sizeof(T))
          +g_try_new0(T, 1)
          @@
          type T;
          expression n;
          @@
          -g_malloc(sizeof(T) * (n))
          +g_new(T, n)
          @@
          type T;
          expression n;
          @@
          -g_try_malloc(sizeof(T) * (n))
          +g_try_new(T, n)
          @@
          type T;
          expression n;
          @@
          -g_malloc0(sizeof(T) * (n))
          +g_new0(T, n)
          @@
          type T;
          expression n;
          @@
          -g_try_malloc0(sizeof(T) * (n))
          +g_try_new0(T, n)
          @@
          type T;
          expression p, n;
          @@
          -g_realloc(p, sizeof(T) * (n))
          +g_renew(T, p, n)
          @@
          type T;
          expression p, n;
          @@
          -g_try_realloc(p, sizeof(T) * (n))
          +g_try_renew(T, p, n)
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      5839e53b
  18. 16 6月, 2014 2 次提交
  19. 04 6月, 2014 1 次提交
    • S
      gluster: use BlockDriverState's AioContext · 6ee50af2
      Stefan Hajnoczi 提交于
      Drop the assumption that we're using the main AioContext.  Use
      aio_bh_new() instead of qemu_bh_new().
      
      The .bdrv_detach_aio_context() and .bdrv_attach_aio_context() interfaces
      are not needed since no fd handlers, timers, or BHs stay registered when
      requests have been drained.
      
      Cc: Bharata B Rao <bharata@linux.vnet.ibm.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      6ee50af2
  20. 10 5月, 2014 1 次提交
    • P
      gluster: Correctly propagate errors when volume isn't accessible · 4557117d
      Peter Krempa 提交于
      The docs for glfs_init suggest that the function sets errno on every
      failure. In fact it doesn't. As other functions such as
      qemu_gluster_open() in the gluster block code report their errors based
      on this fact we need to make sure that errno is set on each failure.
      
      This fixes a crash of qemu-img/qemu when a gluster brick isn't
      accessible from given host while the server serving the volume
      description is.
      
      Thread 1 (Thread 0x7ffff7fba740 (LWP 203880)):
       #0  0x00007ffff77673f8 in glfs_lseek () from /usr/lib64/libgfapi.so.0
       #1  0x0000555555574a68 in qemu_gluster_getlength ()
       #2  0x0000555555565742 in refresh_total_sectors ()
       #3  0x000055555556914f in bdrv_open_common ()
       #4  0x000055555556e8e8 in bdrv_open ()
       #5  0x000055555556f02f in bdrv_open_image ()
       #6  0x000055555556e5f6 in bdrv_open ()
       #7  0x00005555555c5775 in bdrv_new_open ()
       #8  0x00005555555c5b91 in img_info ()
       #9  0x00007ffff62c9c05 in __libc_start_main () from /lib64/libc.so.6
       #10 0x00005555555648ad in _start ()
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      4557117d
  21. 25 3月, 2014 1 次提交
  22. 05 3月, 2014 3 次提交
  23. 01 3月, 2014 2 次提交
    • J
      block: gluster - add reopen support. · adccfbcd
      Jeff Cody 提交于
      Gluster does parse open flags in its .bdrv_open() implementation,
      and the .bdrv_reopen_* implementations need to do the same.
      
      A new gluster connection to the image file to be created is established
      in the .bdrv_reopen_prepare(), and the image file opened with the new
      flags.
      
      If this is successful, then the old image file is closed, and the
      old connection torn down. The relevant structure pointers in the gluster
      state structure are updated to the new connection.
      
      If it is not successful, then the new file handle and connection is
      abandoned (if it exists), while the old connection is not modified at
      all.
      
      With reopen supported, block-commit (and offline commit) is now also
      supported for image files whose base image uses the native gluster
      protocol driver.
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      adccfbcd
    • J
      block: gluster - code movements, state storage changes · 1b37b344
      Jeff Cody 提交于
      In preparation for supporting reopen on gluster, move flag
      parsing out to a function.  Also, add a NULL check in the
      gconf cleanup.
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      1b37b344
  24. 22 2月, 2014 1 次提交