1. 09 3月, 2012 3 次提交
    • A
      Attach vm-id to Open vSwitch interfaces. · ac8bbdbd
      Ansis Atteka 提交于
      This patch will allow OpenFlow controllers to identify which interface
      belongs to a particular VM by using the Domain UUID.
      
      ovs-vsctl get Interface vnet0 external_ids
      {attached-mac="52:54:00:8C:55:2C", iface-id="83ce45d6-3639-096e-ab3c-21f66a05f7fa", iface-status=active, vm-id="142a90a7-0acc-ab92-511c-586f12da8851"}
      
      V2 changes:
      Replaced vm-uuid with vm-id. There was a discussion in Open vSwitch
      mailinglist that we should stick with the same DB key postfixes for the
      sake of consistency (e.g iface-id, vm-id ...).
      ac8bbdbd
    • L
      util: whitespace change to virNetDevOpenvswitchAddPort · 38e56abb
      Laine Stump 提交于
      The indentation on the final lines of the function was off by four
      spaces, making me wonder for a second if there was something
      missing. (There wasn't.)
      38e56abb
    • L
      util: add stub pciConfigAddressToSysfsFile for non-linux platforms · 09d22af1
      Laine Stump 提交于
      Absence of this stub function caused a build failure on mingw32.
      09d22af1
  2. 08 3月, 2012 4 次提交
    • M
      util: Don't overflow on errno in virFileAccessibleAs · f05fb6c5
      Michal Privoznik 提交于
      If we need to virFork() to check assess() under different
      UID+GID we need to translate returned status via WEXITSTATUS().
      Otherwise, we may return values greater than 255 which is
      obviously wrong.
      f05fb6c5
    • E
      util: new function for scaling numbers · 0d90823e
      Eric Blake 提交于
      Scaling an integer based on a suffix is something we plan on reusing
      in several contexts: XML parsing, virsh CLI parsing, and possibly
      elsewhere.  Make it easy to reuse, as well as adding in support for
      powers of 1000.
      
      * src/util/util.h (virScaleInteger): New function.
      * src/util/util.c (virScaleInteger): Implement it.
      * src/libvirt_private.syms (util.h): Export it.
      0d90823e
    • E
      api: add overflow error · 239fb8c4
      Eric Blake 提交于
      Overflow can be user-induced, so it deserves more than being called
      an internal error.  Note that in general, 32-bit platforms have
      far more places to trigger this error (anywhere the public API
      used 'unsigned long' but the other side of the connection is a
      64-bit server); but some are possible on 64-bit platforms (where
      the public API computes the product of two numbers).
      
      * include/libvirt/virterror.h (VIR_ERR_OVERFLOW): New error.
      * src/util/virterror.c (virErrorMsg): Translate it.
      * src/libvirt.c (virDomainSetVcpusFlags, virDomainGetVcpuPinInfo)
      (virDomainGetVcpus, virDomainGetCPUStats): Use it.
      * daemon/remote.c (HYPER_TO_TYPE): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainBlockResize): Likewise.
      239fb8c4
    • L
      util: fix build mingw (and all non-linux) build failure · 861707b9
      Laine Stump 提交于
      ATTRIBUTE_UNUSED was accidentally forgotten on one arg of a stub
      function for functionality that's not present on non-linux
      platforms. This causes a non-linux build with
      --enable-compile-warnings=error to fail.
      861707b9
  3. 07 3月, 2012 2 次提交
  4. 06 3月, 2012 5 次提交
    • R
      util: Changes to support portprofiles for hostdevs · 15bbfd83
      Roopa Prabhu 提交于
      This patch includes the following changes to virnetdevmacvlan.c and
      virnetdevvportprofile.c:
      
       - removes some netlink functions which are now available in
         virnetdev.c
      
       - Adds a vf argument to all port profile functions.
      
      For 802.1Qbh devices, the port profile calls can use a vf argument if
      passed by the caller. If the vf argument is -1 it will try to derive the vf
      if the device passed is a virtual function.
      
      For 802.1Qbg devices, This patch introduces a null check for the device
      argument because during port profile assignment on a hostdev, this argument
      can be null.
      Signed-off-by: NRoopa Prabhu <roprabhu@cisco.com>
      15bbfd83
    • R
      util: support functions for mac/portprofile associations on hostdev · 5095bf06
      Roopa Prabhu 提交于
      This patch adds the following:
      
      - functions to set and get vf configs
      - Functions to replace and store vf configs (Only mac address is handled today.
        But the functions can be easily extended for vlans and other vf configs)
      - function to dump link dev info (This is moved from virnetdevvportprofile.c)
      Signed-off-by: NRoopa Prabhu <roprabhu@cisco.com>
      5095bf06
    • R
      util: two new pci util functions · b8b70273
      Roopa Prabhu 提交于
      pciDeviceGetVirtualFunctionInfo returns pf netdevice name and virtual
      function index for a given vf. This is just a wrapper around existing functions
      to return vf's pf and vf_index with one api call
      
      pciConfigAddressToSysfsfile returns the sysfile pci device link
      from a 'struct pci_config_address'
      Signed-off-by: NRoopa Prabhu <roprabhu@cisco.com>
      b8b70273
    • J
      Fix build after commit e3ba4025 · 118cfc25
      Jim Fehlig 提交于
      Commit e3ba4025 introduced a few build errors with HAVE_LIBNL undefined.
      118cfc25
    • L
      util: eliminate crash in virNetDevMacVLanCreateWithVPortProfile · d2a9d55f
      Laine Stump 提交于
      Commit 723d5c (added after the release of 0.9.10) adds a
      NetlinkEventClient for each interface sent to
      virNetDevMacVLanCreateWithVPortProfile. This should only be done if
      the interface actually *has* a virtPortProfile, otherwise the event
      handler would be a NOP. The bigger problem is that part of the setup
      to create the NetlinkEventClient is to do a memcpy of virtPortProfile
      - if it's NULL, this triggers a segv.
      
      This patch just qualifies the code that adds the client - if
      virtPortProfile is NULL, it's skipped.
      d2a9d55f
  5. 03 3月, 2012 2 次提交
    • L
      util: combine bools in virNetDevTapCreateInBridgePort into flags · d1c31023
      Laine Stump 提交于
      With an additional new bool added to determine whether or not to
      discourage the use of the supplied MAC address by the bridge itself,
      virNetDevTapCreateInBridgePort had three booleans (well, 2 bools and
      an int used as a bool) in the arg list, which made it increasingly
      difficult to follow what was going on. This patch combines those three
      into a single flags arg, which not only shortens the arg list, but
      makes it more self-documenting.
      d1c31023
    • A
      util: centralize tap device MAC address 1st byte "0xFE" modification · c1b164d7
      Ansis Atteka 提交于
      When a tap device for a domain is created and attached to a bridge,
      the first byte of the tap device MAC address is set to 0xFE, while the
      rest is set to match the MAC address that will be presented to the
      guest as its network device MAC address. Setting this high value in
      the tap's MAC address discourages the bridge from using the tap
      device's MAC address as the bridge's own MAC address (Linux bridges
      always take on the lowest numbered MAC address of all attached devices
      as their own).
      
      In one case within libvirt, a tap device is created and attached to
      the bridge with the intent that its MAC address be taken on by the
      bridge as its own (this is used to assure that the bridge has a fixed
      MAC address to prevent network outages created by the bridge MAC
      address "flapping" as guests are started and stopped). In this case,
      the first byte of the mac address is *not* altered to 0xFE.
      
      In the current code, callers to virNetDevTapCreateInBridgePort each
      make the MAC address modification themselves before calling, which
      leads to code duplication, and also prevents lower level functions
      from knowing the real MAC address being used by the guest. The problem
      here is that openvswitch bridges must be informed about this MAC
      address, or they will be unable to pass traffic to/from the guest.
      
      This patch centralizes the location of the MAC address "0xFE fixup"
      into virNetDevTapCreateInBridgePort(), meaning 1) callers of this
      function no longer need the extra strange bit of code, and 2)
      bitNetDevTapCreateBridgeInPort itself now is called with the guest's
      unaltered MAC address, and can pass it on, unmodified, to
      virNetDevOpenvswitchAddPort.
      
      There is no other behavioral change created by this patch.
      c1b164d7
  6. 02 3月, 2012 3 次提交
    • E
      build: fix output of pid values · 355ec281
      Eric Blake 提交于
      Nuke the last vestiges of printing pid_t values with the wrong
      types, at least in code compiled on mingw64.  There may be other
      places, but for now they are only compiled on systems where the
      existing %d doesn't trigger gcc warnings.
      
      * src/rpc/virnetsocket.c (virNetSocketNew): Use %lld and casting,
      rather than assuming any particular int type for pid_t.
      * src/util/command.c (virCommandRunAsync, virPidWait)
      (virPidAbort): Likewise.
      (verify): Drop a now stale assertion.
      355ec281
    • E
      build: use correct type for pid and similar types · 3e2c3d8f
      Eric Blake 提交于
      No thanks to 64-bit windows, with 64-bit pid_t, we have to avoid
      constructs like 'int pid'.  Our API in libvirt-qemu cannot be
      changed without breaking ABI; but then again, libvirt-qemu can
      only be used on systems that support UNIX sockets, which rules
      out Windows (even if qemu could be compiled there) - so for all
      points on the call chain that interact with this API decision,
      we require a different variable name to make it clear that we
      audited the use for safety.
      
      Adding a syntax-check rule only solves half the battle; anywhere
      that uses printf on a pid_t still needs to be converted, but that
      will be a separate patch.
      
      * cfg.mk (sc_correct_id_types): New syntax check.
      * src/libvirt-qemu.c (virDomainQemuAttach): Document why we didn't
      use pid_t for pid, and validate for overflow.
      * include/libvirt/libvirt-qemu.h (virDomainQemuAttach): Tweak name
      for syntax check.
      * src/vmware/vmware_conf.c (vmwareExtractPid): Likewise.
      * src/driver.h (virDrvDomainQemuAttach): Likewise.
      * tools/virsh.c (cmdQemuAttach): Likewise.
      * src/remote/qemu_protocol.x (qemu_domain_attach_args): Likewise.
      * src/qemu_protocol-structs (qemu_domain_attach_args): Likewise.
      * src/util/cgroup.c (virCgroupPidCode, virCgroupKillInternal):
      Likewise.
      * src/qemu/qemu_command.c(qemuParseProcFileStrings): Likewise.
      (qemuParseCommandLinePid): Use pid_t for pid.
      * daemon/libvirtd.c (daemonForkIntoBackground): Likewise.
      * src/conf/domain_conf.h (_virDomainObj): Likewise.
      * src/probes.d (rpc_socket_new): Likewise.
      * src/qemu/qemu_command.h (qemuParseCommandLinePid): Likewise.
      * src/qemu/qemu_driver.c (qemudGetProcessInfo, qemuDomainAttach):
      Likewise.
      * src/qemu/qemu_process.c (qemuProcessAttach): Likewise.
      * src/qemu/qemu_process.h (qemuProcessAttach): Likewise.
      * src/uml/uml_driver.c (umlGetProcessInfo): Likewise.
      * src/util/virnetdev.h (virNetDevSetNamespace): Likewise.
      * src/util/virnetdev.c (virNetDevSetNamespace): Likewise.
      * tests/testutils.c (virtTestCaptureProgramOutput): Likewise.
      * src/conf/storage_conf.h (_virStoragePerms): Use mode_t, uid_t,
      and gid_t rather than int.
      * src/security/security_dac.c (virSecurityDACSetOwnership): Likewise.
      * src/conf/storage_conf.c (virStorageDefParsePerms): Avoid
      compiler warning.
      3e2c3d8f
    • L
      util: remove unneeded #include in virrandom.c · 3c30fbcd
      Laine Stump 提交于
      Commit 7c90026d added #include "conf/domain_conf.h" to
      util/virrandom.c. Fortunately it didn't actually use anything from
      domain_conf.h, since as far as I'm aware, files in util aren't allowed
      to reference anything in conf (although the opposite is allowed). So
      this #include is unnecessary.
      
      I verified it still compiles with the line removed, but have placed a
      one day moratorium on me doing any "trivial rule" pushes, so will
      wait for someone else to verify/ACK before pushing.
      3c30fbcd
  7. 01 3月, 2012 1 次提交
  8. 29 2月, 2012 5 次提交
  9. 27 2月, 2012 1 次提交
    • P
      pidfile: Make checking binary path in virPidFileRead optional · 3e0623eb
      Peter Krempa 提交于
      This patch changes behavior of virPidFileRead to enable passing NULL as
      path to the binary the pid file should be checked against to skip this
      check. This enables using this function for reading files that have same
      semantics as pid files, but belong to unknown processes.
      3e0623eb
  10. 25 2月, 2012 1 次提交
    • M
      Fixed URI parsing · 9f748277
      Martin Kletzander 提交于
      Function xmlParseURI does not remove square brackets around IPv6
      address when parsing. One of the solutions is making wrappers around
      functions working with xmlURI*. This assures that uri->server will be
      always properly assigned and it doesn't have to be changed when used
      on some new place in the code.
      For this purpose, functions virParseURI and virSaveURI were
      added. These function are wrappers around xmlParseURI and xmlSaveUri
      respectively.
      Also there is one new syntax check function to prohibit these functions
      anywhere else.
      
      File changes:
       - src/util/viruri.h        -- declaration
       - src/util/viruri.c        -- definition
       - src/libvirt_private.syms -- symbol export
       - src/Makefile.am          -- added source and header files
       - cfg.mk                   -- added sc_prohibit_xmlURI
       - all others               -- ID name and include fixes
      9f748277
  11. 24 2月, 2012 1 次提交
    • B
      virterror: Misleading error message when name is missing · cff5573d
      Benjamin Cama 提交于
      [forwarding this here from RH bug #796732]
      
      When creating a network (virsh net-create) with an erroneous XML
      containing an empty <name> element, the error message is misleading:
      
      error: Failed to create network from foo.xml
      error: missing domain name information
      
      It took me a bit of time to figure out that it was the *network* name
      that was missing (I generate this xml and didn't look at it, first).
      
      I realized that the same message is used for missing name when creating
      a domain, network, or device node.
      cff5573d
  12. 23 2月, 2012 1 次提交
  13. 22 2月, 2012 3 次提交
    • J
      Add support for unsafe migration · 7808844d
      Jiri Denemark 提交于
      This patch adds VIR_MIGRATE_UNSAFE flag for migration APIs and new
      VIR_ERR_MIGRATION_UNSAFE error code.  The error code should be returned
      whenever migrating a domain is considered unsafe (e.g., it's configured
      in a way that does not ensure data integrity once it is migrated).
      VIR_MIGRATE_UNSAFE flag may be used to force migration even though it
      would normally be considered unsafe and forbidden.
      7808844d
    • M
      configure: Define program name if not found · 2b38e59b
      Michal Privoznik 提交于
      AC_CHECK_PROG checks for program in given path. However, if it doesn't
      exists, [variable] is set to [value-if-not-found]. We don't want this
      to be the empty string in case of 'modprobe' and 'scrub' as we want to
      fallback to runtime detection.
      2b38e59b
    • M
      util: Fix virFileAccessibleAs return path from parent · b90d4722
      Michal Privoznik 提交于
      Despite documentation, if we do fork() parent always returns -1
      even if file is accessible. Which is wrong obviously.
      b90d4722
  14. 20 2月, 2012 1 次提交
    • L
      Fix compilation on MacOS X · 10269064
      Lincoln Myers 提交于
      * src/util/virfile.h: the virFileWrapperFdFlags being defined as
        a globa variable instead of a type ended up generating a duplicate
        symbol error.
      * AUTHORS: added Lincoln Myers
      10269064
  15. 16 2月, 2012 1 次提交
    • A
      network: support Open vSwitch · df810046
      Ansis Atteka 提交于
      This patch allows libvirt to add interfaces to already
      existing Open vSwitch bridges. The following syntax in
      domain XML file can be used:
      
          <interface type='bridge'>
            <mac address='52:54:00:d0:3f:f2'/>
            <source bridge='ovsbr'/>
            <virtualport type='openvswitch'>
              <parameters interfaceid='921a80cd-e6de-5a2e-db9c-ab27f15a6e1d'/>
            </virtualport>
            <address type='pci' domain='0x0000' bus='0x00'
                                slot='0x03' function='0x0'/>
          </interface>
      
      or if libvirt should auto-generate the interfaceid use
      following syntax:
      
          <interface type='bridge'>
            <mac address='52:54:00:d0:3f:f2'/>
            <source bridge='ovsbr'/>
            <virtualport type='openvswitch'>
            </virtualport>
            <address type='pci' domain='0x0000' bus='0x00'
                                slot='0x03' function='0x0'/>
          </interface>
      
      It is also possible to pass an optional profileid. To do that
      use following syntax:
      
         <interface type='bridge'>
           <source bridge='ovsbr'/>
           <mac address='00:55:1a:65:a2:8d'/>
           <virtualport type='openvswitch'>
             <parameters interfaceid='921a80cd-e6de-5a2e-db9c-ab27f15a6e1d'
                         profileid='test-profile'/>
           </virtualport>
         </interface>
      
      To create Open vSwitch bridge install Open vSwitch and
      run the following command:
      
          ovs-vsctl add-br ovsbr
      df810046
  16. 13 2月, 2012 1 次提交
  17. 11 2月, 2012 1 次提交
  18. 10 2月, 2012 2 次提交
    • O
      util: Do not use PRIx64 macro · 2bcfd5b1
      Osier Yang 提交于
      It breaks the build on Mingw32,  because PRIx64 is coming
      from the Win32 headers, but virAsprintf uses the gnulib printf.
      2bcfd5b1
    • O
      npiv: Auto-generate WWN if it's not specified · 7c90026d
      Osier Yang 提交于
      The auto-generated WWN comply with the new addressing schema of WWN:
      
      <quote>
      the first nibble is either hex 5 or 6 followed by a 3-byte vendor
      identifier and 36 bits for a vendor-specified serial number.
      </quote>
      
      We choose hex 5 for the first nibble. And for the 3-bytes vendor ID,
      we uses the OUI according to underlying hypervisor type, (invoking
      virConnectGetType to get the virt type). e.g. If virConnectGetType
      returns "QEMU", we use Qumranet's OUI (00:1A:4A), if returns
      ESX|VMWARE, we use VMWARE's OUI (00:05:69). Currently it only
      supports qemu|xen|libxl|xenapi|hyperv|esx|vmware drivers. The last
      36 bits are auto-generated.
      7c90026d
  19. 09 2月, 2012 2 次提交
    • E
      sysinfo: simplify function signature · ba8074b8
      Eric Blake 提交于
      Now that no one is relying on the return value being a pointer to
      somewhere inside of the passed-in argument, we can simplify the
      callers to simply return success or failure.  Also wrap some long
      lines and add some const-correctness.
      
      * src/util/sysinfo.c (virSysinfoParseBIOS, virSysinfoParseSystem)
      (virSysinfoParseProcessor, virSysinfoParseMemory): Change return.
      (virSysinfoRead): Adjust caller.
      ba8074b8
    • D
      Replace truncate() with ftruncate() · bc6bb3a3
      Daniel P. Berrange 提交于
      Mingw32 does not have any truncate() API defined, but it does
      have ftruncate(). So replace use of the former with the latter
      bc6bb3a3