1. 16 6月, 2014 6 次提交
    • E
      blockcommit: require base below top · 3e3c6ff1
      Eric Blake 提交于
      The block commit code looks for an explicit base file relative
      to the discovered top file; so for a chain of:
        base <- snap1 <- snap2 <- snap3
      and a command of:
        virsh blockcommit $dom vda --base snap2 --top snap1
      we got a sane message (here from libvirt 1.0.5):
      error: invalid argument: could not find base 'snap2' below 'snap1' in chain for 'vda'
      
      Meanwhile, recent refactoring has slightly reduced the quality of the
      libvirt error messages, by losing the phrase 'below xyz':
      error: invalid argument: could not find image 'snap2' in chain for 'snap3'
      
      But we had a one-off, where we were not excluding the top file
      itself in searching for the base; thankfully qemu still reports
      the error, but the quality is worse:
        virsh blockcommit $dom vda --base snap2 --top snap2
      error: internal error unable to execute QEMU command 'block-commit': Base '/snap2' not found
      
      Fix the one-off in blockcommit by changing the semantics of name
      lookup - if a starting point is specified, then the result must
      be below that point, rather than including that point.  The only
      other call to chain lookup was blockpull code, which was already
      forcing the lookup to omit the active layer and only needs a
      tweak to use the new semantics.
      
      This also fixes the bug exposed in the testsuite, where when doing
      a lookup pinned to an intermediate point in the chain, we were
      unable to return the name of the parent also in the chain.
      
      * src/util/virstoragefile.c (virStorageFileChainLookup): Change
      semantics for non-NULL startFrom.
      * src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Adjust caller,
      to keep existing semantics.
      * tests/virstoragetest.c (mymain): Adjust to expose new semantics.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      3e3c6ff1
    • E
      storage: better tests of lookup · b10a0e91
      Eric Blake 提交于
      Add some more tests of what happens when we restrict a lookup
      to begin at a point in the middle of a chain.  In particular,
      we want to ensure that a parent is not found when starting at
      the child.  This commit also demonstrates that we have a slight
      difference in behavior on what parent we report when filtering
      is in effect; as the determination of the parent affects the
      code in block commit, exposing this in the testsuite will help
      justify changes in future patches that tweak the semantics of
      what lookups are allowed.
      
      * tests/virstoragetest.c (testStorageLookup): Test user input.
      (TEST_LOOKUP_TARGET): Add parameter.
      (mymain): Add lookup tests.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b10a0e91
    • E
      storage: renumber lookup tests · 54597c56
      Eric Blake 提交于
      The next patch will be adding tests, including adding a parameter
      for testing more conditions.  For ease of review of that patch, I
      want to create common context lines that don't change when the new
      tests are added (it's easier to visually review additions than it
      is to review an entire chunk of tests rewritten into another
      larger chunk of tests).
      
      * tests/virstoragetest.c (mymain): Add a parameter and renumber
      the lookup tests.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      54597c56
    • E
      storage: add alias for less typing · 47aaceb7
      Eric Blake 提交于
      Typing chain->backingStore->backingStore gets old after a while;
      introduce some alias variables to make the test more compact.
      
      * tests/virstoragetest.c (mymain): Introduce some shorthand.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      47aaceb7
    • P
      qemu: snapshot: Don't mark all block disks for metadata reuse · b77d3d9b
      Peter Krempa 提交于
      For block devices used as snapshot source the new snapshot code would
      set the reuse flag. This inhibits to take snapshot without specially
      preparing the block image before taking the snapshot.
      
      Fortunately this is not a regression as only the new way of specifying
      snapshot source is affected.
      
      For the followin snapshot XML:
       <domainsnapshot>
         <disks>
           <disk name='vda' type='block'>
             <driver type='qcow2'/>
             <source dev="/dev/andariel/testsnap" />
           </disk>
         </disks>
       </domainsnapshot>
      
      You'd get:
      error: internal error: unable to execute QEMU command 'transaction': Image is not in qcow2 format
      
      After this patch the snapshot is created successfully.
      b77d3d9b
    • P
      leaseshelper: fix another crash · 647bdf02
      Pavel Hrdina 提交于
      We create a 'lease_new' when we are adding new lease entry, then later
      in the code we add the 'lease_new' into a 'leases_array_new' which
      leads into the crash because we double free the 'lease_new'.
      
      To prevent the double free we set the 'lease_new' to NULL after
      successful append into the 'leases_array_new'.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      647bdf02
  2. 14 6月, 2014 4 次提交
  3. 13 6月, 2014 5 次提交
    • R
      bhyve: implement PCI address allocation · aad479dc
      Roman Bogorodskiy 提交于
      Automatically allocate PCI addresses for devices instead
      of hardcoding them in the driver code. The current
      allocation schema is to dedicate an entire slot for each devices.
      
      Also, allow having arbitrary number of devices.
      aad479dc
    • M
      virNetDevGetLinkInfo: Don't report link speed if NIC's not up · 90ba5ef1
      Michal Privoznik 提交于
      The kernel's more broken than one would think. Various drivers report
      various (usually spurious) values if the interface is in other state
      than 'up' . While on some we experience -EINVAL when read()-ing the
      speed sysfs file, with other drivers we might get anything from 0 to
      UINT_MAX. If that's the case it's better to not report link speed.
      Well, the interface is not up anyway.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      90ba5ef1
    • P
      tests: virstoragetest: Fix output when hitting errors · 51c43905
      Peter Krempa 提交于
      When the test is failing but the debug output isn't enabled the
      resulting line would look ugly like and would not contain the actual
      difference.
      
      TEST: virstoragetest
            .................chain member 1!chain member 1!chain member 1!
      
      Store the member index in the actual checked string to hide this problem
      51c43905
    • E
      blockcommit: update error messages related to block jobs · 278c51af
      Eric Blake 提交于
      A future patch will add two-phase block commit jobs; as the
      mechanism for managing them is similar to managing a block copy
      job, existing errors should be made generic enough to occur
      for either job type.
      
      * src/conf/domain_conf.c (virDomainHasDiskMirror): Update
      comment.
      * src/qemu/qemu_driver.c (qemuDomainDefineXML)
      (qemuDomainSnapshotCreateXML, qemuDomainRevertToSnapshot)
      (qemuDomainBlockJobImpl, qemuDomainBlockCopy): Update error
      message.
      * src/qemu/qemu_hotplug.c (qemuDomainDetachDiskDevice): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      278c51af
    • E
      virsh: improve blockcopy UI · 17840379
      Eric Blake 提交于
      Peter's review of an early version of my addition of active block
      commit pointed out some issues that I was copying from the block
      copy code; fix them up now before perpetuating them.
      
      For virsh commands that manage a single API call, it's nice to have
      a 1:1 mapping of options to flags, so that we can test that
      lower-layer software handles flag combinations correctly.  But where
      virsh is introducing syntactic sugar to combine multiple API calls
      into a single user interface, we might as well make that interface
      compact.  That is, we should allow the shorter command-line of
      'blockcopy $dom $disk --pivot' without having to explicitly specify
      --wait, because this isn't directly a flag passed to a single
      underlying API call.
      
      Also, my use of embedded ?: ternaries bordered on unreadable.
      
      * tools/virsh-domain.c (cmdBlockCopy): Make --pivot, --finish,
      and --timeout imply --wait. Drop excess ?: operators.
      * tools/virsh.pod (blockcopy): Update documentation.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      17840379
  4. 12 6月, 2014 18 次提交
  5. 11 6月, 2014 7 次提交
    • P
      leaseshelper: fix crash · a93504cc
      Pavel Hrdina 提交于
      Commit baafe668 introduced new leaseshelper with a crash of freeing
      env string. Calling 'getenv()' inside 'virGetEnvAllowSUID()' may
      return a static string and we definitely should not free it.
      
      The author probably want to free the copy of that string.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      a93504cc
    • E
      maint: exempt graphic binaries from syntax check · de43582b
      Eric Blake 提交于
      Roman Bogorodskiy reported a syntax-check failure when using
      FreeBSD; complaining that:
      
      prohibit_empty_first_line
      tools/libvirt_win_icon_16x16.ico:1:
      tools/libvirt_win_icon_32x32.ico:1:
      tools/libvirt_win_icon_48x48.ico:1:
      tools/libvirt_win_icon_64x64.ico:1:
      maint.mk: Prohibited empty first line
      
      In reality, the first 'line' of that file is NOT empty; but since
      it is a binary file, awk is not required to handle it gracefully.
      The simplest solution is to exempt all image files from syntax
      checks in the first place - after all, we only store them in git
      because they are inconvenient to regenerate, but they are not our
      preferred format for making modifications, and syntax check should
      only cover files that we are likely to modify.
      
      * cfg.mk (VC_LIST_ALWAYS_EXCLUDE_REGEX): Exempt images.
      (exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF): Simplify.
      (exclude_file_name_regexp--sc_trailing_blank): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      de43582b
    • S
      qemu: Properly label FDs when restoring domain with static label · edc80e23
      Shivaprasad G Bhat 提交于
      When saving domain with relabel=no, the file that gets created must have the
      context set anyway.  That way restore can be successful without the need of
      relabelling the file.
      Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
      edc80e23
    • J
      vmware: make version parsing more robust · 775bb9b1
      Jean-Baptiste Rouault 提交于
      Since commit d69415d4, vmware version is parsed from both stdout and
      stderr. This patch makes version parsing work even if there is garbage
      (libvirt debug messages for example) in the command output.
      
      Add test data for this case.
      775bb9b1
    • M
      virnetdev: Use ifname in virNetDevGetLinkInfo · 3c43b6a7
      Michal Privoznik 提交于
      If we're compiling on non-Linux platform, the virNetDevGetLinkInfo()
      is a dummy function which barely logs debug message that getting link
      info is not supported. However, while the debug message was prepared
      for printing the interface name too, I actually forgot to pass the
      variable which resulted in build error on platforms like mingw or
      FreeBSD.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      3c43b6a7
    • M
      node_device: Expose link state & speed · 0311ef3d
      Michal Privoznik 提交于
      While exposing the info under <interface/> in previous patch works, it
      may work only in cases where interface is configured on the host.
      However, orchestrating application may want to know the link state and
      speed even in that case. That's why we ought to expose this in nodedev
      XML too:
      
      virsh # nodedev-dumpxml net_eth0_f0_de_f1_2b_1b_f3
      <device>
        <name>net_eth0_f0_de_f1_2b_1b_f3</name>
        <path>/sys/devices/pci0000:00/0000:00:19.0/net/eth0</path>
        <parent>pci_0000_00_19_0</parent>
        <capability type='net'>
          <interface>eth0</interface>
          <address>f0:de:f1:2b:1b:f3</address>
          <link speed='1000' state='up'/>
          <capability type='80203'/>
        </capability>
      </device>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      0311ef3d
    • M
      interface_backend_udev: Implement link speed & state · b2019ee4
      Michal Privoznik 提交于
      In the previous commit the helper function was prepared, so now
      we can wire it up and benefit from it. The Makefile change is
      required because we're including virnedev,h which includes
      virnetlink.h which tries to include netlink/msg.h. However this
      file is not under /usr/include directly but is dependent on libnl
      used.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      b2019ee4