1. 24 6月, 2014 16 次提交
    • G
      graphics: remember graphics not auto allocated ports · 1a065caa
      Giuseppe Scrivano 提交于
      When looking for a port to allocate, the port allocator didn't take in
      consideration ports that are statically set by the user.  Defining
      these two graphics elements in the XML would cause an error, as the
      port allocator would try to use the same port for the spice graphics
      element:
      
          <graphics type='spice' autoport='yes'/>
          <graphics type='vnc' port='5900' autoport='no'/>
      
      The new *[pP]ortReserved variables keep track of the ports that were
      successfully tracked as used by the port allocator but that weren't
      bound.
      
      Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1081881Signed-off-by: NGiuseppe Scrivano <gscrivan@redhat.com>
      1a065caa
    • G
      virtportallocator: new function "virPortAllocatorSetUsed" · 1d8d2fbc
      Giuseppe Scrivano 提交于
      virPortAllocatorSetUsed permits to set a port as already used and
      prevent the port allocator to use it without any attempt to bind it.
      Signed-off-by: NGiuseppe Scrivano <gscrivan@redhat.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      1d8d2fbc
    • N
      net-dhcp-leases: Add virsh support · 59cac9a9
      Nehal J Wani 提交于
      Use virNetworkGetDHCPLeases and virNetworkGetDHCPLeasesForMAC in virsh.
      
      The new feature supports the follwing methods:
      
      1. Retrieve leases info for a given virtual network
      
      2. Retrieve leases info for given network interface
      
      tools/virsh-domain-monitor.c
         * Introduce new command : net-dhcp-leases
           Example Usage: net-dhcp-leases <network> [mac]
      
         virsh # net-dhcp-leases --network default6
         Expiry Time          MAC address        Protocol  IP address                Hostname        Client ID or DUID
         -------------------------------------------------------------------------------------------------------------------
         2014-06-16 03:40:14  52:54:00:85:90:e2  ipv4      192.168.150.231/24        fedora20-test   01:52:54:00:85:90:e2
         2014-06-16 03:40:17  52:54:00:85:90:e2  ipv6      2001:db8:ca2:2:1::c0/64   fedora20-test   00:04:b1:d8:86:42:e1:6a:aa:cf:d5:86:94:23:6f:94:04:cd
         2014-06-16 03:34:42  52:54:00:e8:73:eb  ipv4      192.168.150.181/24        ubuntu14-vm     -
         2014-06-16 03:34:46  52:54:00:e8:73:eb  ipv6      2001:db8:ca2:2:1::5b/64   -               00:01:00:01:1b:30:c6:aa:52:54:00:e8:73:eb
      
      tools/virsh.pod
         * Document new command
      
      src/internal.h
         * Introduce new macro: EMPTYSTR
      59cac9a9
    • N
      net-dhcp-leases: Private implementation inside network · ba513982
      Nehal J Wani 提交于
      Query the network driver for the path of the custom leases file for the given
      virtual network and parse it to retrieve info.
      
      src/network/bridge_driver.c:
      * Implement networkGetDHCPLeases
      * Implement networkGetDHCPLeasesForMAC
      * Implement networkGetDHCPLeasesHelper
      ba513982
    • N
      net-dhcp-leases: Implement the remote protocol · 990c3b65
      Nehal J Wani 提交于
      Implement RPC calls for virNetworkGetDHCPLeases, virNetworkGetDHCPLeasesForMAC
      
      daemon/remote.c
         * Define remoteSerializeNetworkDHCPLeases,
                  remoteDispatchNetworkGetDHCPLeases
         * Define remoteDispatchNetworkGetDHCPLeasesForMAC
         * Define helper function remoteSerializeDHCPLease
      
      src/remote/remote_driver.c
         * Define remoteNetworkGetDHCPLeases
         * Define remoteNetworkGetDHCPLeasesForMAC
         * Define helper function remoteSerializeDHCPLease
      
      src/remote/remote_protocol.x
         * New RPC procedure: REMOTE_PROC_NETWORK_GET_DHCP_LEASES
         * Define structs remote_network_dhcp_leases, remote_network_get_dhcp_leases_args,
                          remote_network_get_dhcp_leases_ret
         * New RPC procedure: REMOTE_PROC_NETWORK_GET_DHCP_LEASES_FOR_MAC
         * Define structs remote_network_dhcp_leases_for_mac, remote_network_get_dhcp_leases_for_mac_args,
                          remote_network_get_dhcp_leases_for_mac_ret
      
      src/remote_protocol-structs
         * New structs added
      
      src/rpc/gendispatch.pl
         * Add exception (s/Dhcp/DHCP) for auto-generating names of the remote functions
           in daemon/remote_dispatch.h
      990c3b65
    • N
      net-dhcp-leases: Implement the public APIs · 03e0e79e
      Nehal J Wani 提交于
      Introduce 3 new APIs, virNetworkGetDHCPLeases, virNetworkGetDHCPLeasesForMAC
      and virNetworkDHCPLeaseFree.
      
      * virNetworkGetDHCPLeases: returns the dhcp leases information for a given
           virtual network.
      
        For DHCPv4, the information returned:
        - Network Interface Name
        - Expiry Time
        - MAC address
        - IAID (NULL)
        - IPv4 address (with type and prefix)
        - Hostname (can be NULL)
        - Client ID (can be NULL)
      
        For DHCPv6, the information returned:
        - Network Interface Name
        - Expiry Time
        - MAC address
        - IAID (can be NULL, only in rare cases)
        - IPv6 address (with type and prefix)
        - Hostname (can be NULL)
        - Client DUID
      
        Note: @mac, @iaid, @ipaddr, @clientid are in ASCII form, not raw bytes.
        Note: @expirytime can 0, in case the lease is for infinite time.
      
      * virNetworkGetDHCPLeasesForMAC: returns the dhcp leases information for a
           given virtual network and specified MAC Address.
      
      * virNetworkDHCPLeaseFree: allows the upper layer application to free the
           network interface object conveniently.
      
      There is no support for flags, so user is expected to pass 0 for
      both the APIs.
      
      include/libvirt/libvirt.h.in:
        * Define virNetworkGetDHCPLeases
        * Define virNetworkGetDHCPLeasesForMAC
        * Define virNetworkDHCPLeaseFree
      
      src/driver.h:
        * Define networkGetDHCPLeases
        * Define networkGetDHCPLeasesForMAC
      
      src/libvirt.c:
        * Implement virNetworkGetDHCPLeases
        * Implement virNetworkGetDHCPLeasesForMAC
        * Implement virNetworkDHCPLeaseFree
      
      src/libvirt_public.syms:
        * Export the new symbols
      03e0e79e
    • J
      Fix shadowed variable with older gcc · ebd05fd5
      Ján Tomko 提交于
      Commit 2cff94cc fixed the shadowed 'link' added by commit 975f0e2e,
      but forgot the 'link' added by commit 08aa22ec.
      ebd05fd5
    • C
      LXC: trivially support flag VIR_DRV_FEATURE_TYPED_PARAM_STRING · bffe8d2d
      Chen Hanxiao 提交于
      Fix lxcDomainGetMemoryParameters and lxcDomainGetSchedulerParametersFlags:
      virsh -c lxc:/// memtune DOMAIN
      error: Unable to get number of memory parameters
      error: unsupported flags (0x4) in function lxcDomainGetMemoryParameters
      
      Introduced by commit 399394.
      Signed-off-by: NChen Hanxiao <chenhanxiao@cn.fujitsu.com>
      Signed-off-by: NJán Tomko <jtomko@redhat.com>
      bffe8d2d
    • M
      virNumaGetPages: Don't fail on huge page-less systems · 2c78a270
      Michal Privoznik 提交于
      If we are running on a system that is not capable of huge pages (e.g.
      because the kernel is not configured that way) we still try to open
      "/sys/kernel/mm/hugepages/" which however does not exist. We should
      be tolerant to this specific use case.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      2c78a270
    • M
      virNumaGetPageInfo: Take huge pages into account · 3499eedd
      Michal Privoznik 提交于
      On the Linux kernel, if huge pages are allocated the size they cut off
      from memory is accounted under the 'MemUsed' in the meminfo file.
      However, we want the sum to be subtracted from 'MemTotal'. This patch
      implements this feature. After this change, we can enable reporting
      of the ordinary system pages in the capability XML:
      
      <capabilities>
      
        <host>
          <uuid>01281cda-f352-cb11-a9db-e905fe22010c</uuid>
          <cpu>
            <arch>x86_64</arch>
            <model>Haswell</model>
            <vendor>Intel</vendor>
            <topology sockets='1' cores='1' threads='1'/>
            <feature/>
            <pages unit='KiB' size='4'/>
            <pages unit='KiB' size='2048'/>
            <pages unit='KiB' size='1048576'/>
          </cpu>
          <power_management/>
          <migration_features/>
          <topology>
            <cells num='4'>
              <cell id='0'>
                <memory unit='KiB'>4048248</memory>
                <pages unit='KiB' size='4'>748382</pages>
                <pages unit='KiB' size='2048'>3</pages>
                <pages unit='KiB' size='1048576'>1</pages>
                <distances/>
                <cpus num='1'>
                  <cpu id='0' socket_id='0' core_id='0' siblings='0'/>
                </cpus>
              </cell>
              ...
            </cells>
          </topology>
        </host>
      </capabilities>
      
      You can see the beautiful thing about this: if you sum up all the
      <pages/> you'll get <memory/>.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      3499eedd
    • P
      storage: gluster: Avoid name shadow on older compilers · 2cff94cc
      Peter Krempa 提交于
      s/link/linkpath/g in virStorageFileBackendGlusterReadlinkCallback as
      older gcc complains.
      2cff94cc
    • P
      storage: gluster: Add backend to return unique storage file path · 975f0e2e
      Peter Krempa 提交于
      Use virStorageFileSimplifyPathInternal to canonicalize gluster paths
      via a callback and use it for the unique volume path retrieval API.
      975f0e2e
    • P
      util: storagefile: Introduce universal function to canonicalize paths · 08aa22ec
      Peter Krempa 提交于
      Introduce a common function that will take a callback to resolve links
      that will be used to canonicalize paths on various storage systems and
      add extensive tests.
      08aa22ec
    • P
      util: string: Add helper to free non-NULL terminated string arrays · 5d4a4825
      Peter Krempa 提交于
      To free string lists with some strings stolen from the middle we need to
      walk the complete array. Introduce a new helper that takes the string
      list size to free such string lists.
      5d4a4825
    • J
      libxl: prefer qdisk for <driver name='file'> · 48d81cef
      Jim Fehlig 提交于
      The libxl driver currently sets the disk backend to
      LIBXL_DISK_BACKEND_TAP when <driver name='file'> is specified
      in the <disk> config.  qdisk should be prefered with this
      configuration, otherwise existing configuration such as the
      following, which worked with the old Xen driver, will not work
      with the libxl driver
      
        <disk type='file' device='cdrom'>
          <driver name='file'/>
          <source file='/path/to/some/iso'/>
          <target dev='hdc' bus='ide'/>
          <readonly/>
        </disk>
      
      In addition, tap performs poorly compared to qdisk.
      48d81cef
    • M
      cmdFreepages: initialize @tmp · 8d8e1d9d
      Michal Privoznik 提交于
      In the 404bac14 the @tmp variable was introduced. It's purpose is to
      avoid typecasting when parsing --pagesize argument. However, if the
      argument is not presented, tmp may be used uninitialized resulting in
      bogus virNodeGetFreePages() API call:
      
      virsh freepages --cellno 2
      error: Failed to open file '/sys/devices/system/node/node2/hugepages/hugepages-4294967295kB/free_hugepages': No such file or directory
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      8d8e1d9d
  2. 23 6月, 2014 14 次提交
    • R
      Fix closedir usage in virNumaGetPages · 4a82ef92
      Roman Bogorodskiy 提交于
      virNumaGetPages calls closedir(dir) in cleanup and dir could
      be NULL if we jump there from the failed opendir() call.
      
      While it's not harmful on Linux, FreeBSD libc crashes [1], so
      make sure that dir is not NULL before calling closedir.
      
      1: http://lists.freebsd.org/pipermail/freebsd-standards/2014-January/002704.html
      4a82ef92
    • D
      Add pkg-config files to allow deps to build against source tree · 60c343f6
      Daniel P. Berrange 提交于
      When testing language bindings it is useful to be able to build
      them against an uninstalled libvirt source tree. Add a dummy
      set of pkg-config files to allow for this. This can be used by
      setting
      
        export PKG_CONFIG_PATH=/path/to/libvirt/git/src
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      60c343f6
    • D
      Add pkg-config files for libvirt-qemu & libvirt-lxc · 65d8c92a
      Daniel P. Berrange 提交于
      For some reason there have never been pkg-config files created
      for the libvirt-qemu.so and libvirt-lxc.so libraries.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      65d8c92a
    • D
      Don't include @libs@ in libvirt.pc.in file · 1167751f
      Daniel P. Berrange 提交于
      The libvirt.pc file we install is ending up polluted with a
      load of compiler flags that should be private to the libvirt
      build. eg
      
      Libs: -L${libdir} -lvirt -ldl -O2 -g -pipe -Wall \
            -Wp,-D_FORTIFY_SOURCE=2 -fexceptions \
            -fstack-protector-strong --param=ssp-buffer-size=4 \
            -grecord-gcc-switches  -m64 -mtune=generic
      
      this is caused by including @libs@ in the Libs: line of the
      pkgconfig.pc.in file.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1167751f
    • M
      virnuma: Actually build huge page code · 9e72691b
      Michal Privoznik 提交于
      One of previous commits (e6258a33) tried to build the huge page code
      only on Linux since it's Linux centric indeed. But it failed miserably
      as it used 'WITH_LINUX' which is an automake conditional not a gcc
      one. In the sources we need to use __linux__.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      9e72691b
    • L
      qemu: parse -device virtio-balloon · ef016226
      Laine Stump 提交于
      There are no options to parse here other than the name of the device,
      and all three possible device names have the same prefix
      ("virtio-balloon" with "-ccw", "-pci", or "-device" appended), so the
      code is fairly simple. It has been implemented such that it will be
      easier to add handling for other -device entries that aren't otherwise
      recognized - just add another "else if (STRPREFIX(opts, ....)" clause.
      
      qemuParseCommandLineString() previously would always add a <memballoon
      model='virtio'/> to every result (the comments erroneously say that it
      is adding a <memballoon model='none'/>) This has been changed to add
      model='none', and 84 test case xml's updated accordingly (so that
      qemuxml2argvtest won't fail).
      
      Now that the memballoon device is properly parsed, we can safely add a
      test for properly ignoring -nodefconfig and -nodefaults. Rather than
      adding an entire new test case for this (and memballoon), we just
      randomly pick the clock-utc test and modify it slightly to fulfill the
      purpose.
      ef016226
    • J
      Report correct error in virNetDevTapCreate · f8a33815
      Ján Tomko 提交于
      ioctl returns -1, not the errno value
      f8a33815
    • J
      Do not call closedir with NULL argument · 10af0a19
      Ján Tomko 提交于
      Only three other callers possibly call closedir on a NULL argument.
      Even though these probably won't be used on FreeBSD where this crashes,
      let's be nice and only call closedir on an actual directory stream.
      10af0a19
    • J
      Fix invalid write in virNumaGetDistances · 9a2e523e
      Ján Tomko 提交于
      ==== Invalid write of size 4
      ====    at 0x52E678C: virNumaGetDistances (virnuma.c:479)
      ====    by 0x5396890: nodeCapsInitNUMA (nodeinfo.c:1796)
      ====    by 0x203C2B: virQEMUCapsInit (qemu_capabilities.c:960)
      ====  Address 0xe10a1e0 is 0 bytes after a block of size 0 alloc'd
      ====    at 0x4C2A6D0: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ====    by 0x52A10D6: virAllocN (viralloc.c:191)
      ====    by 0x52E674D: virNumaGetDistances (virnuma.c:470)
      ====    by 0x5396890: nodeCapsInitNUMA (nodeinfo.c:1796)
      ====    by 0x203C2B: virQEMUCapsInit (qemu_capabilities.c:960)
      9a2e523e
    • P
      util: numa: Stub out hugepage code on non-Linux platforms · e6258a33
      Peter Krempa 提交于
      The hugepage sizing and counting code gathers the information from sysfs
      and thus isn't portable. Stub it out for non-Linux so that we can report
      a better error. This patch also avoids calling sysinfo() on Mingw where
      it isn't supported.
      e6258a33
    • P
      util: numa: Catch readdir errors in virNumaGetPages · 00b2317a
      Peter Krempa 提交于
      Don't return possibly incomplete result if virDirRead fails.
      00b2317a
    • P
      tests: Fix syntax-check after cdd11151 · 42d75b44
      Peter Krempa 提交于
      makefile_conditionals
      tests/Makefile.am:293:endif
      maint.mk: match "if FOO" with "endif FOO" in Makefiles
      make: *** [sc_makefile_conditionals] Error 1
      42d75b44
    • P
      test: Disable storage test when FS backend isn't compiled in · cdd11151
      Peter Krempa 提交于
      'virstoragetest' accesses backing chains of files on local storage with
      the help of the storage driver. Disable the test on builds without the
      storage driver as the test is crashing otherwise.
      
      Reported by: Roman Bogorodskiy
      cdd11151
    • J
      Properly check the return value of CCWAddressAsString · 3fe9d75a
      Ján Tomko 提交于
      It returns NULL on failure. Checking if the negation of it
      is less than zero makes no sense. (Found by coverity after moving
      the code)
      
      In another case, the return value wasn't checked at all.
      3fe9d75a
  3. 21 6月, 2014 2 次提交
  4. 20 6月, 2014 8 次提交
    • M
      cpu_arm: Support all ARM processors we know about · d06d4c95
      Michal Privoznik 提交于
      So far three ARM processor families are known to libvirt,
      however the cpu driver knows only about one of them. This
      make host initialization on the other two fail:
      
      2014-06-17 13:35:41.419+0000: 6840: info : libvirt version: 1.2.6
      2014-06-17 13:35:41.419+0000: 6840: error : cpuNodeData:342 : this function is not supported by the connection driver: cannot get node CPU data for armv6l architecture
      2014-06-17 13:35:41.433+0000: 6840: warning : virQEMUCapsInit:943 : Failed to get host CPU
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      d06d4c95
    • M
      virNodeParseSocket: Take ARM into account · f4dc812c
      Michal Privoznik 提交于
      The virNodeParseSocket() function tries to get socked ID from
      'topology/physical_package_id' file. However, on some architectures
      the file contains the -1 constant which makes in turn libvirt think
      the info extraction was unsuccessful. If that's the case, we need to
      overwrite the obtained integer with zero like we are doing for other
      architectures.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      f4dc812c
    • M
      nodeinfotest: Print error if cpuinfo file can't be opened · 1ad78434
      Michal Privoznik 提交于
      Currently, we are opening the cpuinfo file via fopen() which if fails
      doesn't print any error message. We should do that instead.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      1ad78434
    • M
      virNodeParseNode: Propagate host architecture · 9571eaaa
      Michal Privoznik 提交于
      As in previous commit, there are again some places where we can do
      runtime decision instead of compile time. This time it's whether the
      'topology/physical_package_id' is allowed to have '-1' within or not.
      Then, core ID is pared differently on s390(x) than on the rest of
      architectures.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      9571eaaa
    • M
      nodeinfo: Introduce @arch to linuxNodeInfoCPUPopulate · e8083575
      Michal Privoznik 提交于
      So far, we are doing compile time decisions on which architecture is
      used. However, for testing purposes it's much easier if we pass host
      architecture as parameter and then let the function decide which code
      snippet for extracting host CPU info will be used.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      e8083575
    • L
      interface: clean up virInterfaceDefDevFormat · 0b33d7c9
      Laine Stump 提交于
      This modifies the formatting function of virInterface to be a proper
      mirror of the parse function, including the addition of a
      "parentIfType" arg so that we can decide whether or not it is
      appropriate to emit the elements that are only in toplevel interfaces,
      as well as the <link> element (which isn't allowed for bridge
      interfaces).
      
      Since the restructuring of the code necessarily changes the order of
      some of the elements, some test case data had to be updated.
      0b33d7c9
    • L
      interface: clean up virInterfaceDefParseXML · 3aa81973
      Laine Stump 提交于
      the switch cases for the 4 different interface types had repetitive
      code which has now been pulled out as common. While touching those
      lines, some extra usage of "!= NULL" etc has been eliminated to make
      things more compact and inline with current coding practices.
      
      NB: parentIfType == VIR_INTERFACE_TYPE_LAST means that this is a
      toplevel interface (not a subordinate of a bridge or bond). Only
      toplevel interfaces can have a start mode, mtu, or IP address element.
      3aa81973
    • L
      interface: move parsing of bridge attributes into appropriate function · 7edc46ac
      Laine Stump 提交于
      For some reason the bridge stp mode and delay were put directly into
      the "bridge" case of the switch in virInterfaceDefParseXML(), although
      they are inside the <bridge> element, and so should be parsed in the
      function created for that purpose - virInterfaceBridgeDefFormat().
      7edc46ac