ovirt-imageio/.editorconfig
Nir Soffer ade54ee622 imageio-go: Start the ovirt.org/imageio Go module
Create Go modules:

- ovirt.org/imageio - the imageio client library for 3rd party programs.
  This module depends only on Go packages, to make it useful for
  projects that cannot depend on external programs or libraries, like
  the ovirt go client library. This module licensed under LGPL2+.

- ovirt.org/ovirt-img - the ovirt-img program for uploading and
  downloading images. This module is licensed under GPL2+ as the rest of
  the project.

The nbd and http backends are not complete, but both support getting
image size and extents.

To test the imageio backend you need to start imageio server and install
a ticket using the ovirt-imageioctl command line.

Here is an example run using the new imageio http backend:

$ ./ovirt-img https://localhost:54322/images/nbd | head
start=0 length=69632 zero=false
start=69632 length=978944 zero=true
start=1048576 length=49152 zero=false
start=1097728 length=12288 zero=true
start=1110016 length=33366016 zero=false
start=34476032 length=16158720 zero=true
start=50634752 length=162045952 zero=false
start=212680704 length=56803328 zero=true
start=269484032 length=24576 zero=false
start=269508608 length=24576 zero=true

Comparing the nbd and http backends, the http backend is slower but
still much faster than "qemu-img map".

$ hyperfine "./ovirt-img nbd+unix:///?socket=/tmp/nbd.sock >/dev/null" \
            "./ovirt-img https://localhost:54322/images/nbd >/dev/null" \
            "qemu-img map --output json nbd+unix:///?socket=/tmp/nbd.sock >/dev/null"
Benchmark 1: ./ovirt-img nbd+unix:///?socket=/tmp/nbd.sock >/dev/null
  Time (mean ± σ):      23.8 ms ±   1.0 ms    [User: 7.4 ms, System: 5.7 ms]
  Range (min … max):    21.9 ms …  26.9 ms    114 runs

Benchmark 2: ./ovirt-img https://localhost:54322/images/nbd >/dev/null
  Time (mean ± σ):      62.5 ms ±   4.6 ms    [User: 14.5 ms, System: 6.6 ms]
  Range (min … max):    54.0 ms …  73.6 ms    47 runs

Benchmark 3: qemu-img map --output json nbd+unix:///?socket=/tmp/nbd.sock >/dev/null
  Time (mean ± σ):     140.3 ms ±   4.5 ms    [User: 50.9 ms, System: 44.9 ms]
  Range (min … max):   134.3 ms … 155.3 ms    19 runs

Summary
  './ovirt-img nbd+unix:///?socket=/tmp/nbd.sock >/dev/null' ran
    2.62 ± 0.23 times faster than './ovirt-img https://localhost:54322/images/nbd >/dev/null'
    5.89 ± 0.32 times faster than 'qemu-img map --output json nbd+unix:///?socket=/tmp/nbd.sock >/dev/null'

Change-Id: I32f416b8443b98e59abc16eaf4033406d516a5c3
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
2021-11-10 16:30:55 +02:00

19 lines
275 B
INI

# https://editorconfig.org/
root = true
[*]
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
[{*.go,go.mod,go.sum}]
# Match gofmt style
indent_style = tab
[Makefile]
# Make requires tabs.
indent_style = tab