1. 11 9月, 2014 1 次提交
  2. 10 9月, 2014 19 次提交
  3. 09 9月, 2014 3 次提交
    • E
      virsh: additional scaled output units · 2ad38fdb
      Eric Blake 提交于
      The parser accepts P and E, so the formatter should too.
      
      * tools/virsh.c (vshPrettyCapacity): Handle larger units.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      2ad38fdb
    • M
    • E
      blockcopy: add a way to parse disk source · 37588b25
      Eric Blake 提交于
      The new blockcopy API wants to reuse only a subset of the disk
      hotplug parser - namely, we only care about the embedded
      virStorageSourcePtr inside a <disk> XML.  Strange as it may
      seem, it was easier to just parse an entire disk definition,
      then throw away everything but the embedded source, than it
      was to disentangle the source parsing code from the rest of
      the overall disk parsing function.  All that I needed was a
      couple of tweaks and a new internal flag that determines
      whether the normally-mandatory target element can be
      gracefully skipped, since everything else was already optional.
      
      * src/conf/domain_conf.h (virDomainDiskSourceParse): New
      prototype.
      * src/conf/domain_conf.c (VIR_DOMAIN_XML_INTERNAL_DISK_SOURCE):
      New flag.
      (virDomainDiskDefParseXML): Honor flag to make target optional.
      (virDomainDiskSourceParse): New function.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      37588b25
  4. 08 9月, 2014 8 次提交
  5. 07 9月, 2014 4 次提交
    • S
      selinux: Avoid label reservations for type = none · a48362cd
      Shivaprasad G Bhat 提交于
      For security type='none' libvirt according to the docs should not
      generate seclabel be it for selinux or any model. So, skip the
      reservation of labels when type is none.
      Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
      a48362cd
    • E
      blockcopy: remote implementation for new API · 1069e3b9
      Eric Blake 提交于
      Fairly straightforward - I got lucky that the generated functions
      worked out of the box :)
      
      * src/remote/remote_protocol.x (remote_domain_block_copy_args):
      New struct.
      (REMOTE_PROC_DOMAIN_BLOCK_COPY): New RPC.
      * src/remote/remote_driver.c (remote_driver): Wire it up.
      * src/remote_protocol-structs: Regenerate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1069e3b9
    • E
      blockcopy: expose new API in virsh · c1d75dee
      Eric Blake 提交于
      Expose the new power of virDomainBlockCopy through virsh (well,
      all but the finer-grained bandwidth, as that is its own can of
      worms for a later patch).  Continue to use the older API where
      possible, for maximum compatibility.
      
      The command now requires either --dest (with optional --format
      and --blockdev), to directly describe the file destination, or
      --xml, to name a file that contains an XML description such as:
      
      <disk type='network'>
        <driver type='raw'/>
        <source protocol='gluster' name='vol1/img'>
          <host name='red'/>
        </source>
      </disk>
      
      [well, it may be a while before the qemu driver is actually patched
      to act on that particular xml beyond just parsing it, but the virsh
      interface won't need changing at that time]
      
      Non-zero option parameters are converted into virTypedParameters,
      and if anything requires the new API, the command can synthesize
      appropriate XML even if the --dest option was used instead of --xml.
      
      The existing --raw flag remains for back-compat, but the preferred
      spelling is now --format=raw, since the new API now allows us
      to specify all formats rather than just a boolean raw to suppress
      probing.
      
      I hope I did justice in describing the effects of granularity and
      buf-size on how they get passed through to qemu.
      
      * tools/virsh-domain.c (cmdBlockCopy): Add new options --xml,
      --granularity, --buf-size, --format. Make --raw an alias for
      --format=raw. Call new API if new parameters are in use.
      * tools/virsh.pod (blockcopy): Document new options.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c1d75dee
    • E
      maint: update to latest gnulib · 0e8bed81
      Eric Blake 提交于
      The usual portability fixes; and this includes a fix that adds
      a new syntax check for double semicolons (commit 28de556d fixed
      some, but gnulib found a better check).
      
      * .gnulib: Update to latest.
      * src/xenconfig/xen_common.c (xenFormatConfigCommon): Fix offender.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      0e8bed81
  6. 06 9月, 2014 5 次提交
    • E
      blockcopy: split out virsh implementation · 0eaad0a3
      Eric Blake 提交于
      I'm about to extend the capabilities of blockcopy.  Hiding a few
      common lines of implementation gets in the way of the new required
      logic, and putting the new logic in the common implementation won't
      benefit any of the other blockjob operations.  Therefore, it is
      simpler to just do the work inline.  There should be no semantic
      change in this patch.
      
      * tools/virsh-domain.c (blockJobImpl): Move block copy guts...
      (cmdBlockCopy): ...into their lone caller.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      0eaad0a3
    • P
      storage_conf: Fix libvirtd crash when defining scsi storage pool · 119b6dfc
      Pradipta Kr. Banerjee 提交于
      Since 9f781da6
      
      Resolve a libvirtd crash in virStoragePoolSourceFindDuplicate()
      when there is an existing SCSI pool defined with adapter type as
      'scsi_host' and defining a new SCSI pool with adapter type as
      'fc_host' and parent attribute missing or vice versa.
      
      For example, if there is an existing SCSI pool with adapter type
      as 'scsi_host' defined using the following XML
      
      <pool type='scsi'>
        <name>TEST_SCSI_POOL</name>
          <source>
             <adapter type='scsi_host' name='scsi_host1'/>
          </source>
          <target>
              <path>/dev/disk/by-path</path>
          </target>
      </pool>
      
      When defining another SCSI pool with adapter type as 'fc_host' using the
      following XML will crash libvirtd
      
      <pool type='scsi'>
        <name>TEST_SCSI_FC_POOL</name>
        <source>
           <adapter type='fc_host' wwnn='1234567890abcdef' wwpn='abcdef1234567890'/>
        </source>
        <target>
           <path>/dev/disk/by-path</path>
        </target>
      </pool>
      
      Same is true for the reverse case as well where there exists a SCSI pool
      with adapter type as 'fc_host' and another SCSI pool is defined with
      adapter type as 'scsi_host'.
      
      This happens because for fc_host 'name' is optional attribute whereas for
      scsi_host its mandatory. However the check in libvirt for finding duplicate
      storage pools didn't take that into account while comparing
      Signed-off-by: NPradipta Kr. Banerjee <bpradip@in.ibm.com>
      119b6dfc
    • E
      blockcopy: allow block device destination · b7e73585
      Eric Blake 提交于
      To date, anyone performing a block copy and pivot ends up with
      the destination being treated as <disk type='file'>.  While this
      works for data access for a block device, it has at least one
      noticeable shortcoming: virDomainGetBlockInfo() reports allocation
      differently for block devices visited as files (the size of the
      device) than for block devices visited as <disk type='block'>
      (the maximum sector used, as reported by qemu); and this difference
      is significant when trying to manage qcow2 format on block devices
      that can be grown as needed.
      
      Of course, the more powerful virDomainBlockCopy() API can already
      express the ability to set the <disk> type.  But a new API can't
      be backported, while a new flag to an existing API can; and it is
      also rather inconvenient to have to resort to the full power of
      generating XML when just adding a flag to the older call will do
      the trick.  So this patch enhances blockcopy to let the user flag
      when the resulting XML after the copy must list the device as
      type='block'.
      
      * include/libvirt/libvirt.h.in (VIR_DOMAIN_BLOCK_REBASE_COPY_DEV):
      New flag.
      * src/libvirt.c (virDomainBlockRebase): Document it.
      * tools/virsh-domain.c (opts_block_copy, blockJobImpl): Add
      --blockdev option.
      * tools/virsh.pod (blockcopy): Document it.
      * src/qemu/qemu_driver.c (qemuDomainBlockRebase): Allow new flag.
      (qemuDomainBlockCopy): Remember the flag, and make sure it is only
      used on actual block devices.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: Test it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b7e73585
    • E
      blockjob: add new --bytes flag to virsh blockjob · 1105c1de
      Eric Blake 提交于
      Expose the new flag just added to virDomainGetBlockJobInfo.
      With --raw, the presence or absence of --bytes determines which
      flag to use in the single API call.  Without --raw, the use of
      --bytes forces an error if the server doesn't support it,
      otherwise, the code tries to silently fall back to scaling the
      MiB/s value.
      
      My goal is to eventually also support --bytes in bandwidth mode;
      but that's a bit further down the road (and needs a new API flag
      added in libvirt.h first).
      
      This changes the human output, but the previous patch added
      raw output precisely so that we can have flexibility with the
      human output.  For this commit, I used qemu-monitor-command to
      force an unusual bandwidth, but the same will be possible once
      qemu implements virDomainBlockCopy:
      
      Before:
      Block Copy: [100 %]    Bandwidth limit: 2 MiB/s
      After:
      Block Copy: [100 %]    Bandwidth limit: 1048577 bytes/s (1.000 MiB/s)
      
      The cache avoids having to repeatedly checking whether the flag
      works when talking to an older server, when multiple blockjob
      commands are issued during a batch session and the user is
      manually polling for job completion.
      
      * tools/virsh.h (_vshControl): Add a cache.
      * tools/virsh.c (cmdConnect, vshReconnect): Initialize the cache.
      * tools/virsh-domain.c (opts_block_job): Add --bytes.
      * tools/virsh.pod (blockjob): Document this.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1105c1de
    • E
      blockjob: add new --raw flag to virsh blockjob · 2019b7ca
      Eric Blake 提交于
      The current output of 'blockjob [--info]' is a single line
      designed for human consumption; it's not very nice for machine
      parsing.  Furthermore, I have plans to modify the line in
      response to the new flag for controlling bandwidth units.
      Solve that by adding a --raw parameter, which outputs
      information closer to the C struct.
      
      $ virsh blockjob testvm1 vda --raw
       type=Block Copy
       bandwidth=1
       cur=197120
       end=197120
      
      The information is indented, because I'd like for a later patch
      to add a mode that iterates over all the vm's disks with status
      for each; in that mode, each block name would be listed unindented
      before information (if any) about that block.
      
      Now that we have a raw mode, we can guarantee that it won't change
      format over time.  Any app that cares about parsing the output can
      try --raw, and if it fails, know that it was talking to an older
      virsh and fall back to parsing the human-readable format which had
      not changed until now; meanwhile, when not using --raw, we have
      freed future virsh to change the output to whatever makes sense.
      
      My first change to human mode: this command now guarantees a line
      is printed on successful use of the API, even when the API did
      not find a current block job (consistent with the rest of virsh).
      
      Bonus: https://bugzilla.redhat.com/show_bug.cgi?id=1135441
      complained that this message was confusing:
      
      $ virsh blockjob test1 hda  --async --bandwidth 10
      error: conflict between --abort, --info, and --bandwidth modes
      
      even though the man page already documents that --async implies
      abort mode, all because '--abort' wasn't present in the command
      line.  Since I'm adding another case where options are tied
      to or imply a mode, I changed that error to:
      
      error: conflict between abort, info, and bandwidth modes
      
      * tools/virsh-domain.c (cmdBlockJob): Add --raw parameter; tweak
      error wording.
      * tools/virsh.pod (blockjob): Document it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      2019b7ca