1. 29 6月, 2011 24 次提交
    • E
      maint: improve makefile whitespace · 9fdeaeef
      Eric Blake 提交于
      None of these instances cause any semantic differences, but
      consistency is nice.
      
      * src/Makefile.am: Replace leading spaces with tabs.
      9fdeaeef
    • O
      tests: Fix memory leak in virnetmessagetest · a2753079
      Osier Yang 提交于
      Detected when playing with "make -C tests valgrind".
      a2753079
    • O
      conf: Fix memory leak in virNetworkDNSDefFormat · c9f604fc
      Osier Yang 提交于
      c9f604fc
    • M
      eb9dee2b
    • M
      network: Fix dnsmasq hostsfile creation logic and related tests · 9523b3c3
      Matthias Bolte 提交于
      networkSaveDnsmasqHostsfile was added in 8fa9c221 (Apr 2010).
      It has a force flag. If the dnsmasq hostsfile already exists force
      needs to be true to overwrite it. networkBuildDnsmasqArgv sets force
      to false, networkDefine sets it to true. This results in the
      hostsfile being written only in networkDefine in the common case.
      If no error occurred networkSaveDnsmasqHostsfile returns true and
      networkBuildDnsmasqArgv adds the --dhcp-hostsfile to the dnsmasq
      command line.
      
      networkSaveDnsmasqHostsfile was changed in 89ae9849 (24 Jun 2011)
      to return a new dnsmasqContext instead of reusing one. This change broke
      the logic of the force flag as now networkSaveDnsmasqHostsfile returns
      NULL on error, but the early return -- if force was not set and the
      hostsfile exists -- returns 0. This turned the early return in an error
      case and networkBuildDnsmasqArgv didn't add the --dhcp-hostsfile option
      anymore if the hostsfile already exists. It did because networkDefine
      created the hostsfile already.
      
      Then 9d4e2845 fixed the return 0 case in networkSaveDnsmasqHostsfile
      but didn't apply the force option correctly to the new addnhosts file.
      Now force doesn't control an early return anymore, but influences the
      handling of the hostsfile context creation and dnsmasqSave is always
      called now. This commit also added test cases that reveal several
      problems. First, the tests now calls functions that try to write the
      dnsmasq config files to disk. If someone runs this tests as root this
      might overwrite actively used dnsmasq config files, this is a no-go. Also
      the tests depend on configure --localstatedir, this needs to be fixed as
      well, because it makes the tests fail when localstatedir is different
      from /var.
      
      This patch does several things to fix this:
      
      1) Move dnsmasqContext creation and saving out of networkBuildDnsmasqArgv
      to the caller to separate the command line generation from the config
      file writing. This makes the command line generation testable without the
      risk of interfering with system files, because the tests just don't call
      dnsmasqSave.
      
      2) This refactoring of networkSaveDnsmasqHostsfile makes the force flag
      useless as the saving happens somewhere else now. This fixes the wrong
      usage of the force flag in combination with then newly added addnhosts
      file by removing the force flag.
      
      3) Adapt the wrong test cases to the correct behavior, by adding the
      missing --dhcp-hostsfile option. Both affected tests contain DHCP host
      elements but missed the necessary --dhcp-hostsfile option.
      
      4) Rename networkSaveDnsmasqHostsfile to networkBuildDnsmasqHostsfile,
      because it doesn't save the dnsmasqContext anymore.
      
      5) Move all directory creations in dnsmasq context handling code from
      the *New functions to dnsmasqSave to avoid directory creations in system
      paths in the test cases.
      
      6) Now that networkBuildDnsmasqArgv doesn't create the dnsmasqContext
      anymore the test case can create one with the localstatedir that is
      expected by the tests instead of the configure --localstatedir given one.
      9523b3c3
    • M
      Fix compilation with systemtap 1.3 · c565b67a
      Matthias Bolte 提交于
      Version 1.3 of <sys/sdt.h> uses this macro
      
        #define STAP_CAST(t) (size_t)t
      
      that breaks like this if t is a function
      
        remote.c:1775: error: cast from function call of type 'const char *'
        to non-matching type 'long unsigned int' [-Wbad-function-cast]
      
      For that to work it should probably look like this
      
        #define STAP_CAST(t) ((size_t)(t))
      
      In systemtap 1.4 this was completely rewritten.
      
      Anyway, before commit df0b57a9 t was always a variable, but now
      also a function is used here, namely virNetSASLSessionGetIdentity.
      
      Use an intermediate variable to avoid this problem.
      c565b67a
    • E
      build: fix mingw build · f05759e0
      Eric Blake 提交于
      ./autobuild.sh died on several messages resembling:
      
      ../../src/rpc/virnetsocket.c: In function 'virNetSocketNewListenTCP':
      ../../src/rpc/virnetsocket.c:231:9: error: implicit declaration of function 'bind_used_without_requesting_gnulib_module_bind' [-Wimplicit-function-declaration]
      ../../src/rpc/virnetsocket.c:231:9: error: nested extern declaration of 'bind_used_without_requesting_gnulib_module_bind' [-Wnested-externs]
      
      Basically, gnulib socket fds are not safe to pass to mingw socket
      functions unless we pull in those gnulib modules.
      
      * bootstrap.conf (gnulib_modules): Add modules to handle socket
      functions on mingw.
      f05759e0
    • E
      sysinfo: fix parsing regression · c8eaba64
      Eric Blake 提交于
      Detected by gcc -O2, introduced in commit 532ce9c2.  If dmidecode
      outputs a field unrecognized by the parsers, then the code would
      dereference an uninitialized eol variable.
      
      * src/util/sysinfo.c (virSysinfoParseBIOS)
      (virSysinfoParseSystem, virSysinfoParseProcessor)
      (virSysinfoParseMemory): Avoid uninitialized variable.
      c8eaba64
    • E
      build: update translated files · 8f338921
      Eric Blake 提交于
      The last patch was incomplete.  The translated strings merely
      moved between generated file names, rather than disappearing.
      
      * cfg.mk (generated_files): Update generated file names.
      * po/POTFILES.in: Add remote_dispatch.h
      8f338921
    • J
      build: Don't expect translatable strings in a dead file · ec918adf
      Jiri Denemark 提交于
      daemon/remote_dispatch_bodies.h is no longer with us and shouldn't be
      searched for translatable strings.
      ec918adf
    • J
      daemon: Fix build without polkit · 26dbed15
      Jiri Denemark 提交于
      26dbed15
    • E
      remote: fix uninitialized variable · cf2affff
      Eric Blake 提交于
      Detected by gcc -O2:
      
      remote/remote_driver.c: In function 'doRemoteOpen':
      remote/remote_driver.c:2753:26: error: 'sasl' may be used uninitialized in this function [-Werror=uninitialized]
      
      * src/remote/remote_driver.c (remoteAuthSASL): Initialize sasl.
      cf2affff
    • E
      build: fix 'make check' when pdwtags is available · c65fcce8
      Eric Blake 提交于
      Problem introduced in commit 6818cf86.
      
      * src/remote_protocol-structs: Delete unused struct.
      c65fcce8
    • E
      build: sanlock-devel is not in F15 yet · d710531f
      Eric Blake 提交于
      * libvirt.spec.in (with_sanlock): Only default on in rawhide.
      Reported by Gerhard Stenzel.
      d710531f
    • D
      Add documentation for configuration lock managers · 576682a5
      Daniel P. Berrange 提交于
      Add a page which documents how to configure lock managers,
      focusing on use of sanlock with the QEMU/KVM driver
      
      * docs/locking.html.in: Docs about lock managers
      * docs/sitemap.html.in: Add lock manager config to
        the deployment section
      576682a5
    • D
      Support automatic creation of leases for disks in sanlock · 97e4f217
      Daniel P. Berrange 提交于
      The current sanlock plugin requires a central management
      application to manually add <lease> elements to each guest,
      to protect resources that are assigned to it (eg writable
      disks). This makes the sanlock plugin useless for usage
      in more ad hoc deployment environments where there is no
      central authority to associate disks with leases.
      
      This patch adds a mode where the sanlock plugin will
      automatically create leases for each assigned read-write
      disk, using a md5 checksum of the fully qualified disk
      path. This can work pretty well if guests are using
      stable disk paths for block devices eg /dev/disk/by-path/XXXX
      symlinks, or if all hosts have NFS volumes mounted in
      a consistent pattern.
      
      The plugin will create one lockspace for managing disks
      with filename /var/lib/libvirt/sanlock/__LIBVIRT__DISKS__.
      For each VM disks, there will be another file to hold
      a lease /var/lib/libvirt/sanlock/5903e5d25e087e60a20fe4566fab41fd
      Each VM disk lease is usually 1 MB in size. The script
      virt-sanlock-cleanup should be run periodically to remove
      unused lease files from the lockspace directory.
      
      To make use of this capability the admin will need to do
      several tasks:
      
       - Mount an NFS volume (or other shared filesystem)
         on /var/lib/libvirt/sanlock
       - Configure 'host_id' in /etc/libvirt/qemu-sanlock.conf
         with a unique value for each host with the same NFS
         mount
       - Toggle the 'auto_disk_leases' parameter in qemu-sanlock.conf
      
      Technically the first step can be skipped, in which case
      sanlock will only protect against 2 vms on the same host
      using the same disk (or the same VM being started twice
      due to error by libvirt).
      
      * src/locking/libvirt_sanlock.aug,
        src/locking/sanlock.conf,
        src/locking/test_libvirt_sanlock.aug: Add config params
        for configuring auto lease setup
      * libvirt.spec.in: Add virt-sanlock-cleanup program, man
        page
      * tools/virt-sanlock-cleanup.in: Script to purge unused
        disk resource lease files
      97e4f217
    • D
      Support loading a configuration file for sanlock plugin · 58eb4f2c
      Daniel P. Berrange 提交于
      Introduce a configuration file with a single parameter
      'require_lease_for_disks', which is used to decide whether
      it is allowed to start a guest which has read/write disks,
      but without any leases.
      
      * libvirt.spec.in: Add sanlock config file and augeas
        lens
      * src/Makefile.am: Install sanlock config file and
        augeas lens
      * src/locking/libvirt_sanlock.aug: Augeas master lens
      * src/locking/test_libvirt_sanlock.aug: Augeas test file
      * src/locking/sanlock.conf: Example sanlock config
      * src/locking/lock_driver_sanlock.c: Wire up loading
        of configuration file
      58eb4f2c
    • D
      Allow per-driver config file for lock manager plugins · 5df29ebc
      Daniel P. Berrange 提交于
      Allow a 'configFile' parameter to be passed into the lock
      drivers to provide configuration. Wire up the QEMU driver
      to pass in file names '/etc/libvirt/qemu-$NAME.conf
      eg qemu-sanlock.conf
      
      * src/locking/lock_driver.h, src/locking/lock_driver_nop.c,
        src/locking/lock_driver_sanlock.c, src/locking/lock_manager.c,
        src/locking/lock_manager.h: Add configFile parameter
      * src/qemu/qemu_conf.c: Pass in configuration file path to
        lock driver plugins
      5df29ebc
    • L
      network: add domain to unqualified names defined with <host> · 25171f60
      Laine Stump 提交于
      If a domain name is defined for a network, add the --expand-hosts
      option to the dnsmasq commandline. This results in the domain being
      added to any hostname that is defined in a dns <host> element and
      contains no '.' characters (i.e. it is an "unqualified"
      hostname). Since PTR records are automatically created for any name
      defined in <host>, the result of a PTR request will change from the
      unqualified name to the qualified name.
      
      This also has the same effect on any hostnames that dnsmasq reads
      from the host's /etc/hosts file.
      
      (In the case of guest hostnames that were learned by dnsmasq via DHCP
      requests, they were already getting the domain name added on, even
      without --expand-hosts).
      25171f60
    • D
      Cleanup remote protocol definitions · 6818cf86
      Daniel P. Berrange 提交于
      The standard remote protocol for libvirtd no longer needs to
      include definitions of the generic message header/error structs
      or status codes. This is all defined in the generic RPC protocol
      
      * src/remote/remote_protocol.x: Remove all RPC message definitions
      * src/remote/remote_protocol.h, src/remote/remote_protocol.c:
        Re-generate
      * daemon/remote_generate_stubs.pl: Delete obsolete script
      6818cf86
    • D
      Remove obsolete libvirtd mdns code · ea9694b2
      Daniel P. Berrange 提交于
      libvirtd now uses the generic RPC code for MDNS, so its
      custom mdns APIs are no longer required
      
      * daemon/mdns.c, daemon/mdns.h: Removed obsolete files
      ea9694b2
    • D
      Convert libvirtd over to the new RPC handling APIs · df0b57a9
      Daniel P. Berrange 提交于
      This guts the libvirtd daemon, removing all its networking and
      RPC handling code. Instead it calls out to the new virServerPtr
      APIs for all its RPC & networking work
      
      As a fallout all libvirtd daemon error reporting now takes place
      via the normal internal error reporting APIs. There is no need
      to call separate error reporting APIs in RPC code, nor should
      code use VIR_WARN/VIR_ERROR for reporting fatal problems anymore.
      
      * daemon/qemu_dispatch_*.h, daemon/remote_dispatch_*.h: Remove
        old generated dispatcher code
      * daemon/qemu_dispatch.h, daemon/remote_dispatch.h: New dispatch
        code
      * daemon/dispatch.c, daemon/dispatch.h: Remove obsoleted code
      * daemon/remote.c, daemon/remote.h: Rewrite for new dispatch
        APIs
      * daemon/libvirtd.c, daemon/libvirtd.h: Remove all networking
        code
      * daemon/stream.c, daemon/stream.h: Update for new APIs
      * daemon/Makefile.am: Link to libvirt-net-rpc-server.la
      df0b57a9
    • D
      Convert the remote driver to new RPC client APIs · c1b22644
      Daniel P. Berrange 提交于
      This guts the current remote driver, removing all its networking
      handling code. Instead it calls out to the new virClientPtr and
      virClientProgramPtr APIs for all RPC & networking work.
      
      * src/Makefile.am: Link remote driver with generic RPC code
      * src/remote/remote_driver.c: Gut code, replacing with RPC
        API calls
      * src/rpc/gendispatch.pl: Update for changes in the way
        streams are handled
      c1b22644
    • D
      Add XDR_CFLAGS to libvirt-net-rpc.la library · 51ae69be
      Daniel P. Berrange 提交于
      * src/Makefile.am: Add XDR_CFLAGS
      51ae69be
  2. 28 6月, 2011 6 次提交
    • D
      Ensure sanlock socket is labelled with the VM process label · 5247b069
      Daniel P. Berrange 提交于
      The libvirt sanlock plugin is intentionally leaking a file
      descriptor to QEMU. To enable QEMU to use this FD under
      SELinux, it must be labelled correctly. We dont want to use
      the svirt_image_t for this, since QEMU must not be allowed
      to actually use the FD. So instead we label it with svirt_t
      using virSecurityManagerSetProcessFDLabel
      
      * src/locking/domain_lock.c, src/locking/domain_lock.h,
        src/locking/lock_driver.h, src/locking/lock_driver_nop.c,
        src/locking/lock_driver_sanlock.c, src/locking/lock_manager.c,
        src/locking/lock_manager.h: Optionally pass an FD back to
        the hypervisor for security driver labelling
      * src/qemu/qemu_process.c: label the lock manager plugin
        FD with the process label
      5247b069
    • D
      Add a virSecurityManagerSetProcessFDLabel · 8e3c6fbb
      Daniel P. Berrange 提交于
      Add a new security driver method for labelling an FD with
      the process label, rather than the image label
      
      * src/libvirt_private.syms, src/security/security_apparmor.c,
        src/security/security_dac.c, src/security/security_driver.h,
        src/security/security_manager.c, src/security/security_manager.h,
        src/security/security_selinux.c, src/security/security_stack.c:
        Add virSecurityManagerSetProcessFDLabel & impl
      8e3c6fbb
    • D
      Rename virSecurityManagerSetFDLabel method · 4438c63e
      Daniel P. Berrange 提交于
      The virSecurityManagerSetFDLabel method is used to label
      file descriptors associated with disk images. There will
      shortly be a need to label other file descriptors in a
      different way. So the current name is ambiguous. Rename
      the method to virSecurityManagerSetImageFDLabel to clarify
      its purpose
      
      * src/libvirt_private.syms,
        src/qemu/qemu_migration.c, src/qemu/qemu_process.c,
        src/security/security_apparmor.c, src/security/security_dac.c,
        src/security/security_driver.h, src/security/security_manager.c,
        src/security/security_manager.h, src/security/security_selinux.c,
        src/security/security_stack.c: s/FDLabel/ImageFDLabel/
      4438c63e
    • M
    • J
      qemu: Fix update device for CURRENT + FORCE flags · ad7b3276
      Jiri Denemark 提交于
      When CURRENT and FORCE flags were used together, UpdateDeviceFlags did
      nothing because it failed to transform CURRENT into either LIVE or
      CONFIG.
      ad7b3276
    • S
      nwfilter: Return error message about unresolvable variables · ecfbf795
      Stefan Berger 提交于
      This is in response to bugzilla 664629
      
      https://bugzilla.redhat.com/show_bug.cgi?id=664629
      
      The patch below returns an appropriate error message if the chain of
      nwfilters is found to contain unresolvable variables and therefore
      cannot be instantiated.
      
      Example: The following XMl added to a domain:
      
          <interface type='bridge'>
            <mac address='52:54:00:9f:80:45'/>
            <source bridge='virbr0'/>
            <model type='virtio'/>
            <filterref filter='test'/>
          </interface>
      
      that references the following filter
      
      <filter name='test' chain='root'>
        <filterref filter='clean-traffic'/>
        <filterref filter='allow-dhcp-server'/>
      </filter>
      
      now displays upon 'virsh start mydomain'
      
      error: Failed to start domain mydomain
      error: internal error Cannot instantiate filter due to unresolvable variable: DHCPSERVER
      
      'DHPCSERVER' is contained in allow-dhcp-server.
      ecfbf795
  3. 27 6月, 2011 7 次提交
  4. 25 6月, 2011 3 次提交
    • E
      build: avoid uninitialized variable · 2bebf938
      Eric Blake 提交于
      Caught by gcc -O2, during autobuild.sh.
      
      * src/qemu/qemu_driver.c (qemudDomainGetVcpupinInfo): Initialize vm.
      2bebf938
    • E
      build: fix VPATH builds · 481e4d79
      Eric Blake 提交于
      The build currently fails when trying to create virnetprotocol.c
      into $(builddir)/rpc, which doesn't exist.  But since the file
      is part of the tarball, it should be generated into $(srcdir).
      Caught by autobuild.sh.
      
      * src/Makefile.am (VIR_NET_RPC_GENERATED): Generate into srcdir.
      481e4d79
    • T
      vcpupin: add query option to virsh vcpupin command · e0858026
      Taku Izumi 提交于
      This patch teaches "virsh vcpupin" command to query if no list
      is given. Its feature is to show CPU affinity information in more
      reader-friendly way.
      
       # virsh vcpupin VM --config
       VCPU: CPU Affinity
       ----------------------------------
          0: 1-6,9-20
          1: 10
          2: 5,9-11,15-20
          3: 1,3,5,7,9,11,13,15
      
      When cpulist is omitted, vcpu number is optional. When vcpu number is
      provided, information of only specified vcpu is displayed.
      Signed-off-by: NTaku Izumi <izumi.taku@jp.fujitsu.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e0858026