1. 17 12月, 2014 4 次提交
    • E
      build: fix typo in previous patch · 9d128a20
      Eric Blake 提交于
      * src/util/virfile.c (safezero_mmap): Fix missing semicolon.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      9d128a20
    • M
      util: Fix fallocate stubs for mingw build · 9bce4386
      Martin Kletzander 提交于
      When any of the functions modified in commit 214c687b took false branch,
      the function itself used none of its parameters resulting in "unused
      parameter" error.  Rewriting these functions to the stubs we use
      elsewhere should fix the problem.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      9bce4386
    • J
      virstoragefile: Have virStorageFileResize use safezero · 18f03166
      John Ferlan 提交于
      Currently virStorageFileResize() function uses build conditionals to
      choose either the posix_fallocate() or syscall(SYS_fallocate) with no
      fallback in order to preallocate the space in the newly resized file.
      
      Since the safezero code has a similar set of conditionals modify the
      resize and safezero code in order to allow the resize logic to make use
      of safezero to unify the look/feel of the code paths.
      
      Add a new boolean (resize) to safezero() to make the optional decision
      whether to try syscall(SYS_fallocate) if the posix_fallocate fails because
      HAVE_POSIX_FALLOCATE is not defined (eg, return -1 and errno == 0).
      
      Create a local safezero_sys_fallocate in order to handle the resize
      code paths that support that.  If not present, the set errno = ENOSYS
      in order to allow the caller to handle the failure scenarios.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      18f03166
    • J
      virfile: Refactor safezero · 214c687b
      John Ferlan 提交于
      Currently build conditionals decide which of two safezero() functions
      should be built - either the posix_fallocate() or mmap() with a fallback
      to a slower safewrite() algorithm in order to preallocate space in a raw file.
      
      This patch will refactor safezero to utilize static functions for either
      posix_fallocate or mmap/safewrite. The build conditional still exist, but
      are only for shorter sections of code.
      
      The posix_fallocate path will make use of the ret/errno setting to contain
      the logic for safezero to decide whether it needs to fallback to other
      algorithms. A return of -1 with errno not changed will indicate the conditional
      is not present; otherwise, a return of -1 with errno change indicates the
      call was made and it failed (no functional difference to current algorithm).
      
      The mmap/safewrite option changes only slightly to handle the ftruncate
      failure for mmap. That is, previously if the ftruncate failed, there was
      no fallback to the slow safewrite option.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      214c687b
  2. 16 12月, 2014 2 次提交
  3. 15 12月, 2014 3 次提交
  4. 13 12月, 2014 1 次提交
    • C
      Avoid getting '-1:-1' in devices cgroup list · 5acbb8f9
      Cédric Bosdonnat 提交于
      When calling virCgroupAllowAllDevices we get these invalid entries
      in the device cgroup config.
          b -1:-1 rw
          c -1:-1 rw
      Check for positive values before outputting the major and minor to
      avoid that.
      5acbb8f9
  5. 11 12月, 2014 1 次提交
    • M
      network: Bring netdevs online later · 82977058
      Matthew Rosato 提交于
      Currently, MAC registration occurs during device creation, which is
      early enough that, during live migration, you end up with duplicate
      MAC addresses on still-running source and target devices, even though
      the target device isn't actually being used yet.
      This patch proposes to defer MAC registration until right before
      the guest can actually use the device -- In other words, right
      before starting guest CPUs.
      Signed-off-by: NMatthew Rosato <mjrosato@linux.vnet.ibm.com>
      Signed-off-by: NLaine Stump <laine@laine.org>
      82977058
  6. 10 12月, 2014 2 次提交
    • J
      viriscsi: Need to sendtargets on Initiator IQN · 72925169
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1172015
      
      The refactoring done as part of commit id '59446096' caused a regression
      for the multi initiator IQN commit '6aabcb5b' because the sendtargets was
      not done on/for the initiator IQN prior to login (or trying to disable
      autologin)
      
      Prior to that commit, the paths were essentially
      
      virStorageBackendISCSIStartPool
          virStorageBackendISCSILogin
              virStorageBackendISCSIConnection
                  if initiatoriqn
                      virStorageBackendCreateIfaceIQN
                      Issue sendtargets
                      Perform --login
                  else
                      Issue sendtargets
                      Perform --login
      
      After that commit:
      
      virStorageBackendISCSIStartPool
          Issue sendtargets
          Call virStorageBackendISCSIConnection
              If initiatoriqn
                  virStorageBackendCreateIfaceIQN
                  Perform --login
              else
                  Perform --login
      
      So for non initiator IQN paths, nothing changed. For the initiator path,
      the --login fails as does any attempts to change autologin via "--op update
      --name node.startup --value manual".
      72925169
    • G
      define NTF_{SELF,MASTER} if undefined · 73a43665
      Guido Günther 提交于
      Older kernel headers lack this definition (e.g. Debian Wheezy's 3.2)
      73a43665
  7. 09 12月, 2014 3 次提交
    • E
      build: fix unused variable in mingw · b4861ce9
      Eric Blake 提交于
      Bug introduced in commit 100b7a72:
      
      util/virnetdevbridge.c: In function 'virNetDevBridgePortSetLearning':
      util/virnetdevbridge.c:359:38: error: unused parameter 'enable' [-Werror=unused-parameter]
                                      bool enable)
                                            ^
      
      * src/util/virnetdevbridge.c (virNetDevBridgePortSetLearning): Mark
      unused variable.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b4861ce9
    • L
      util: functions to manage bridge fdb (forwarding database) · 19a5474d
      Laine Stump 提交于
      These two functions use netlink RTM_NEWNEIGH and RTM_DELNEIGH messages
      to add and delete entries from a bridge's fdb. The bridge itself is
      not referenced in the arguments to the functions, only the name of the
      device that is attached to the bridge (since a device can only be
      attached to one bridge at a time, and must be attached for this
      function to make sense, the kernel easily infers which bridge's fdb is
      being modified by looking at the device name/index).
      19a5474d
    • L
      util: new functions for setting bridge and bridge port attributes · 100b7a72
      Laine Stump 提交于
      These functions all set/get items in the sysfs for a bridge device.
      100b7a72
  8. 05 12月, 2014 1 次提交
  9. 02 12月, 2014 1 次提交
    • J
      virhook: Resolve Coverity NULL_RETURNS · f7212f6b
      John Ferlan 提交于
      Coverity complains that many other callers to return err from
      virGetLastError() will check if err is not NULL before dereferencing
      it.  Just do the same here for safety.
      f7212f6b
  10. 28 11月, 2014 1 次提交
    • J
      Fix usage of virReportSystemError · 9340528a
      Jiri Denemark 提交于
      virReportSystemError is reserved for reporting system errors, calling it
      with VIR_ERR_* error codes produces error messages that do not make any
      sense, such as
      
          internal error: guest failed to start: Kernel doesn't support user
          namespace: Link has been severed
      
      We should prohibit wrong usage with a syntax-check rule.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      9340528a
  11. 27 11月, 2014 1 次提交
  12. 26 11月, 2014 1 次提交
  13. 25 11月, 2014 2 次提交
    • E
      dbus: fix arrays of bools · 96e0d677
      Eric Blake 提交于
      Commit 2aa167ca tried to fix the DBus interaction code to allow
      callers to use native types instead of 4-byte bools.  But in
      fixing the issue, I missed the case of an arrayref; Conrad Meyer
      shows the following valid complaint issued by clang:
      
        CC       util/libvirt_util_la-virdbus.lo
      util/virdbus.c:956:13: error: cast from 'bool *' to 'dbus_bool_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align]
                  GET_NEXT_VAL(dbus_bool_t, bool_val, bool, "%d");
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      util/virdbus.c:858:17: note: expanded from macro 'GET_NEXT_VAL'
                  x = (dbustype *)(*xptrptr + (*narrayptr - 1));              \
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.
      
      But fixing that points out that we have NEVER supported arrayrefs
      of sub-int types (byte, i16, u16, and now bool).  Again, while raw
      types promote, arrays do not; so the macros HAVE to deal with both
      size possibilities rather than assuming that an arrayref uses the
      same sizing as the promoted raw type.
      
      Obviously, our testsuite wasn't covering as much as it should have.
      
      * src/util/virdbus.c (GET_NEXT_VAL): Also fix array cases.
      (SET_NEXT_VAL): Fix uses of sub-int arrays.
      * tests/virdbustest.c (testMessageArray, testMessageArrayRef):
      Test it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      96e0d677
    • C
      ip link needs 'name' in 3.16 to create the veth pair · 433b427f
      Cédric Bosdonnat 提交于
      Due to a change (or bug?) in ip link implementation, the command
          'ip link add vnet0...'
      is forced into
          'ip link add name vnet0...'
      The changed command also works on older versions of iproute2, just the
      'name' parameter has been made mandatory.
      433b427f
  14. 21 11月, 2014 9 次提交
    • P
      storage: rbd: Implement support for passing config file option · b7d1bee2
      Peter Krempa 提交于
      To be able to express some use cases of the RBD backing with libvirt, we
      need to be able to specify a config file for the RBD client to qemu as
      that is one of the commonly used options.
      b7d1bee2
    • P
      storage: rbd: qemu: Add support for specifying internal RBD snapshots · 02556606
      Peter Krempa 提交于
      Some storage systems have internal support for snapshots. Libvirt should
      be able to select a correct snapshot when starting a VM.
      
      This patch adds a XML element to select a storage source snapshot for
      the RBD protocol which supports this feature.
      02556606
    • P
      storage: Allow parsing of RBD backing strings when building backing chain · 930b7759
      Peter Krempa 提交于
      As we now have a common function to parse backing store string for RBD
      backing store we can reuse it in the backing store walker so that we
      don't fail on files backed by RBD storage.
      
      This patch also adds a few tests to verify that the parsing works as
      expected.
      930b7759
    • P
      util: storagefile: Split out parsing of NBD string into a separate func · b327df87
      Peter Krempa 提交于
      Split out the code so that the function looks homogenous after adding
      more protocol specific parsers.
      b327df87
    • P
      util: split out qemuParseRBDString into a common helper · 5604c056
      Peter Krempa 提交于
      To allow reuse this non-trivial parser code in the backing store parser
      this part of the command line parser needs to be split out into a
      separate funciton.
      5604c056
    • P
      util: storage: Copy hosts of a storage file only if they exist · c264ea58
      Peter Krempa 提交于
      If there are no hosts for a storage source virStorageSourceCopy and
      virStorageSourceNewFromBackingRelative would try to copy them anyways.
      As the success of virStorageNetHostDefCopy is determined by returning
      a pointer and malloc of 0 elements might return NULL according to the
      implementation, the result of the copy function may vary.
      
      Fix this by copying the hosts array only if there are hosts defined.
      c264ea58
    • P
      util: storage: Add notice for extension of struct virStorageSource · ceb3e595
      Peter Krempa 提交于
      As we now have a deep copy function for struct virStorageSource add a
      notice that extensions of the structure require also appropriate changes
      to the virStorageSourceCopy func.
      ceb3e595
    • P
      util: buffer: Clarify scope of the escape operation in virBufferEscape · 7be41e78
      Peter Krempa 提交于
      The escaping is applied only to the string, not the format argument.
      State this fact in the docs.
      7be41e78
    • P
      storage: qemu: Fix security labelling of new image chain elements · 7e130e8b
      Peter Krempa 提交于
      When creating a disk image snapshot the libvirt code would blindly copy
      the parents label to the newly created image. This runs into problems
      when you start a VM from an image hosted on NFS (or other storage system
      that doesn't support selinux labels) and the snapshot destination is on
      a storage system that does support selinux labels. Libvirt's code in
      that case generates a different security label for the image hosted on
      NFS. This label is valid only for NFS images and doesn't allow access in
      case of a locally stored image.
      
      To fix this issue libvirt needs to refrain from copying security
      information in cases where the default domain seclabel is a better
      choice.
      
      This patch repurposes the now unused @force argument of
      virStorageSourceInitChainElement to denote whether a copy of the
      security labelling stuff should be attempted or not. This allows to
      fine-control the copy operation for cases where we need to keep the
      label of the old disk vs. the cases where we need to keep the label
      unset to use the default domain imagelabel.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1151718
      7e130e8b
  15. 20 11月, 2014 3 次提交
    • E
      build: fix build when not using dbus · be90aa00
      Eric Blake 提交于
      Commit c0e70221 breaks on a machine that lacks dbus headers:
      
      In file included from util/virdbus.c:24:0:
      util/virdbuspriv.h:31:3: error: unknown type name 'dbus_int16_t'
      
      * src/util/virdbuspriv.h (DBusBasicValue): Only provide fallback
      when dbus is compiled.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      be90aa00
    • E
      build: fix build with older dbus headers · c0e70221
      Eric Blake 提交于
      Compilation on a RHEL 5 host failed, due to the older dbus headers
      present on that machine, and triggered by commit 2aa167ca:
      
      util/virdbus.c: In function 'virDBusMessageIterDecode':
      util/virdbus.c:952: error: 'DBusBasicValue' undeclared (first use in this function)
      
      * m4/virt-dbus.m4 (LIBVIRT_CHECK_DBUS): Check for DBusBasicValue.
      * src/util/virdbuspriv.h (DBusBasicValue): Provide fallback.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c0e70221
    • E
      util: don't log failure when older iptables lacks -w · 5bc033e2
      Eric Blake 提交于
      Commit dc33e6e4 caused older platforms like Fedora 20 to emit
      scary log messages at startup:
      
      2014-11-19 23:12:58.800+0000: 28906: error : virCommandWait:2532 : internal error: Child process (/usr/sbin/iptables -w -L -n) unexpected exit status 2: iptables v1.4.19.1: unknown option "-w"
      Try `iptables -h' or 'iptables --help' for more information.
      
      Since we are probing and expect to handle the case where -w is not
      supported, we should not let virCommand log it as an error.
      
      * src/util/virfirewall.c (virFirewallCheckUpdateLock): Handle
      non-zero status ourselves.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      5bc033e2
  16. 19 11月, 2014 3 次提交
    • E
      maint: forbid 'int foo = true' · eb909376
      Eric Blake 提交于
      I noticed this while working on qemuDomainGetBlockInfo.  Assigning
      a bool value to an int variable compiles fine, but raises red flags
      on the maintenance front as it becomes too easy to assign -1 or 2
      or any other non-bool value to the same variable.
      
      * cfg.mk (sc_prohibit_int_assign_bool): New rule.
      * src/conf/snapshot_conf.c (virDomainSnapshotRedefinePrep): Fix
      offenders.
      * src/qemu/qemu_driver.c (qemuDomainGetBlockInfo)
      (qemuDomainSnapshotCreateXML): Likewise.
      * src/test/test_driver.c (testDomainSnapshotAlignDisks):
      Likewise.
      * src/util/vircgroup.c (virCgroupSupportsCpuBW): Likewise.
      * src/util/virpci.c (virPCIDeviceBindToStub): Likewise.
      * src/util/virutil.c (virIsCapableVport): Likewise.
      * tools/virsh-domain-monitor.c (cmdDomMemStat): Likewise.
      * tools/virsh-domain.c (cmdBlockResize, cmdScreenshot)
      (cmdInjectNMI, cmdSendKey, cmdSendProcessSignal)
      (cmdDetachInterface): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      eb909376
    • E
      virdbus: don't force users to pass int for bool values · 2aa167ca
      Eric Blake 提交于
      Use of an 'int' to represent a 'bool' value is confusing.  Just
      because dbus made the mistake of cementing their 4-byte wire
      format of dbus_bool_t into their API doesn't mean we have to
      repeat the mistake.  With a little bit of finesse, we can
      guarantee that we provide a large-enough value to the DBus
      code, while still copying only the relevant one-byte bool
      to the client code, and isolate the rest of our code base from
      the DBus stupidity.
      
      * src/util/virdbus.c (GET_NEXT_VAL): Add parameter.
      (virDBusMessageIterDecode): Adjust all clients.
      * src/util/virpolkit.c (virPolkitCheckAuth): Use nicer type.
      * tests/virdbustest.c (testMessageSimple, testMessageStruct):
      Test new behavior.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      2aa167ca
    • A
      network: Add network bandwidth support to ethernet interfaces · 22cff52a
      Anirban Chakraborty 提交于
      Ethernet interfaces in libvirt currently do not support bandwidth setting.
      For example, following xml file for an interface will not apply these
      settings to corresponding qdiscs.
      
          <interface type="ethernet">
            <mac address="02:36:1d:18:2a:e4"/>
            <model type="virtio"/>
            <script path=""/>
            <target dev="tap361d182a-e4"/>
            <bandwidth>
              <inbound average="984" peak="1024" burst="64"/>
              <outbound average="2000" peak="2048" burst="128"/>
            </bandwidth>
          </interface>
      Signed-off-by: NAnirban Chakraborty <abchak@juniper.net>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      22cff52a
  17. 15 11月, 2014 1 次提交
  18. 14 11月, 2014 1 次提交
    • D
      Re-add use of locking with iptables/ip6tables/ebtables · dc33e6e4
      Daniel P. Berrange 提交于
      A previous commit introduced use of locking with invocation
      of iptables in the viriptables.c module
      
        commit ba95426d
        Author: Serge Hallyn <serge.hallyn@ubuntu.com>
        Date:   Fri Nov 1 12:36:59 2013 -0500
      
          util: use -w flag when calling iptables
      
      This only ever had effect with the virtual network driver,
      as it was not wired up into the nwfilter driver. Unfortunately
      in the firewall refactoring the use of the -w flag was
      accidentally lost.
      
      This patch introduces it to the virfirewall.c module so that
      both the virtual network and nwfilter drivers will be using
      it. It also ensures that the equivalent --concurrent flag
      to ebtables is used.
      dc33e6e4