1. 09 9月, 2013 2 次提交
  2. 07 9月, 2013 1 次提交
    • E
      qemu: don't leave shutdown inhibited on attach failure · 93e59975
      Eric Blake 提交于
      While debugging a failure of 'virsh qemu-attach', I noticed that
      we were leaking the count of active domains on failure.  This
      means that a libvirtd session that is supposed to quit after
      active domains disappear will hang around forever.
      
      * src/qemu/qemu_process.c (qemuProcessAttach): Undo count of
      active domains on failure.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      93e59975
  3. 06 9月, 2013 6 次提交
    • E
      qemu: recognize -machine accel=kvm when parsing native · 2b1ef11c
      Eric Blake 提交于
      In Fedora 19, 'qemu-kvm' is a simple wrapper that calls
      'qemu-system-x86_64 -machine accel=kvm'.  Attempting
      to use 'virsh qemu-attach $pid' to a machine started as:
      
      qemu-kvm -cdrom /var/lib/libvirt/images/foo.img \
       -monitor unix:/tmp/demo,server,nowait -name foo \
       --uuid cece4f9f-dff0-575d-0e8e-01fe380f12ea
      
      was failing with:
      error: XML error: No PCI buses available
      
      because we did not see 'kvm' in the executable name read from
      /proc/$pid/cmdline, and tried to assign os.machine as
      "accel=kvm" instead of "pc"; this in turn led to refusal to
      recognize the pci bus.
      
      Noticed while investigating https://bugzilla.redhat.com/995312
      although there are still other issues to fix before that bug
      will be completely solved.
      
      I've concluded that the existing parser code for native-to-xml
      is a horrendous hodge-podge of ad-hoc approaches; I basically
      rewrote the -machine section to be a bit saner.
      
      * src/qemu/qemu_command.c (qemuParseCommandLine): Don't assume
      -machine argument is always appropriate for os.machine; set
      virtType if accel is present.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      2b1ef11c
    • E
      qemu: only parse basename when determining emulator properties · 6a373fb2
      Eric Blake 提交于
      'virsh domxml-from-native' and 'virsh qemu-attach' could misbehave
      for an emulator installed in (a somewhat unlikely) location
      such as /usr/local/qemu-1.6/qemu-system-x86_64 or (an even less
      likely) /opt/notxen/qemu-system-x86_64.  Limit the strstr seach
      to just the basename of the file where we are assuming details
      about the binary based on its name.
      
      While testing, I accidentally triggered a core dump during strcmp
      when I forgot to set os.type on one of my code paths; this patch
      changes such a coding error to raise a nicer internal error instead.
      
      * src/qemu/qemu_command.c (qemuParseCommandLine): Compute basename
      earlier.
      * src/conf/domain_conf.c (virDomainDefPostParseInternal): Avoid
      NULL deref.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6a373fb2
    • C
      LXC: fix typos in lxc_container.c · 744fb508
      Chen Hanxiao 提交于
      Fix docs and error message typos in lxc_container.c
      Signed-off-by: NChen Hanxiao <chenhanxiao@cn.fujitsu.com>
      744fb508
    • A
      Docs: fix a typo in virt-login-shell.pod · 55fbbd49
      Alex Jia 提交于
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      55fbbd49
    • J
      libxl: Compile regular expression where it is used · 4e0ba0bd
      Jim Fehlig 提交于
      The regular expression used to determine guest capabilities
      was compiled in libxlCapsInitHost() but used in libxlCapsInitGuests().
      Move compilation to libxlCapsInitGuests() where it is used, and free
      the compiled regex after use.  Ensure not to free the regex if
      compilation fails.
      4e0ba0bd
    • J
      Don't call regfree() if regcomp() fails · 88183768
      Jim Fehlig 提交于
      POSIX states that the preg parameter to regcomp() is undefined on
      failure, so no need to call regfree() in these cases.
      
      http://pubs.opengroup.org/onlinepubs/009695399/functions/regcomp.html
      
      See also a discussion on the libvirt dev list
      
      https://www.redhat.com/archives/libvir-list/2013-September/msg00262.html
      88183768
  4. 05 9月, 2013 26 次提交
    • E
      spec: make client-only testing easier · 12509c79
      Eric Blake 提交于
      Several recent patches cleaned up 'make rpm' for the situation
      when client_only is true; these were done by manual spec file
      editing (since it's relatively hard to come by a RHEL 5 s390
      box).  Make it easier to do in the future via a simpler command
      line override.
      
      * libvirt.spec.in (client_only): Allow for override.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      12509c79
    • E
      build: shut up automake warnings · 1ac24b3b
      Eric Blake 提交于
      I'm tired of seeing screenfuls of messages like these when using
      automake 1.13 (Fedora 19):
      
      configure.ac:2121: warning: The 'AM_PROG_MKDIR_P' macro is deprecated, and its use is discouraged.
      configure.ac:2121: You should use the Autoconf-provided 'AC_PROG_MKDIR_P' macro instead,
      configure.ac:2121: and use '$(MKDIR_P)' instead of '$(mkdir_p)'in your Makefile.am files.
      daemon/Makefile.am:19: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
      
      seeing as how we MUST use those constructs for the benefit of
      automake 1.9 (RHEL 5).  Conversely, RHEL 5 automake complained:
      
      aclocal:configure.ac:36: warning: macro `AM_SILENT_RULES' not found in library
      
      Obviously, I tested this patch on both Fedora 19 and RHEL 5.
      
      * configure.ac (AM_INIT_AUTOMAKE): Avoid obsoletion warnings.
      (AM_SILENT_RULES): Avoid unknown macro warning.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1ac24b3b
    • J
      Fix a typo in network XML docs · 75ad8b67
      Ján Tomko 提交于
      75ad8b67
    • J
      Change 'shortforward' to bool. · 90e2d8d0
      Ján Tomko 提交于
      90e2d8d0
    • J
      Add '<nat>' element to '<forward>' network schemas · 437b7944
      Ján Tomko 提交于
      Commits 905629f4 and 1716e7a6 have added support for specifying
      an IPv4 range and a port range to be used by NAT:
      <forward mode='nat'>
        <nat>
          <address start='10.20.30.40' end='10.20.30.44'/>
          <port start='60000' end='65432'/>
        </nat>
      </forward>
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1004364
      437b7944
    • L
      cpu: Add cpu test cases for PPC CPU driver. · ceb2cec9
      Li Zhang 提交于
      This patch is to add cpu test casses for PPC CPU driver.
      Signed-off-by: NLi Zhang <zhlcindy@linux.vnet.ibm.com>
      ceb2cec9
    • L
      cpu: Implement guestData and update for PPC · b2a68c99
      Li Zhang 提交于
      On Power platform, Power7+ can support Power7 guest.
      It needs to define XML configuration to specify guest's CPU model.
      
      For exmaple:
        <cpu match='exact'>
          <model>POWER7_v2.1</model>
          <vendor>IBM</vendor>
        </cpu>
      Signed-off-by: NLi Zhang <zhlcindy@linux.vnet.ibm.com>
      b2a68c99
    • L
      qemu: Remove CPU features functions calling for non-x86 platform. · adf0d770
      Li Zhang 提交于
      CPU features are not supported on non-x86 and hasFeatures will be NULL.
      
      This patch is to remove CPU features functions calling to avoid errors.
      Signed-off-by: NLi Zhang <zhlcindy@linux.vnet.ibm.com>
      adf0d770
    • I
      Use loop-control to allocate loop device. · 9ba230d4
      Ian Main 提交于
      This patch changes virFileLoopDeviceOpen() to use the new loop-control
      device to allocate a new loop device.  If this behavior is unsupported
      we fall back to the previous method of searching /dev for a free device.
      
      With this patch you can start as many image based LXC domains as you
      like (well almost).
      
      Fixes bug https://bugzilla.redhat.com/show_bug.cgi?id=995543
      9ba230d4
    • G
      LXC: Don't mount securityfs when user namespace enabled · 1583dfda
      Gao feng 提交于
      Right now, securityfs is disallowed to be mounted in non-initial
      user namespace, so we must avoid trying to mount securityfs in
      a container which has user namespace enabled.
      Signed-off-by: NGao feng <gaofeng@cn.fujitsu.com>
      1583dfda
    • D
      Stop calling virAllocN directly from ESX code · 393cf4d6
      Daniel P. Berrange 提交于
      The ESX code has a method esxVI_Alloc which would call
      virAllocN directly, instead of using the VIR_ALLOC_N
      macro. Remove this method and make the callers just
      use VIR_ALLOC as is normal practice.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      393cf4d6
    • L
      virDomainDeviceIsUSB: Drop check for USB controller · ce78098e
      Liuji (Jeremy) 提交于
      Delete the USB controller check from the USB Device checklist in
      virDomainDeviceIsUSB as USB controller is a PCI device rather than
      a USB one.
      Signed-off-by: NLiu Ji <jeremy.liu@huawei.com>
      ce78098e
    • D
      Ensure 'arch' is always set in cpuArchNodeData · 66ec11ad
      Daniel P. Berrange 提交于
      The s390, ppc and arm CPU drivers never set the 'arch' field
      in their impl of cpuArchNodeData. This leads to error messages
      being reported from cpuDataFree later, due to trying to use
      VIR_ARCH_NONE.
      
       #0  virRaiseErrorFull (filename=filename@entry=0x76f94434 "cpu/cpu.c", funcname=funcname@entry=0x76f942dc <__FUNCTION__.18096> "cpuGetSubDriver", linenr=linenr@entry=58,
           domain=domain@entry=31, code=code@entry=1, level=level@entry=VIR_ERR_ERROR, str1=0x76f70e18 "internal error: %s",
           str2=str2@entry=0x7155f2ec "undefined hardware architecture", str3=str3@entry=0x0, int1=int1@entry=-1, int2=int2@entry=-1, fmt=0x76f70e18 "internal error: %s")
           at util/virerror.c:646
       #1  0x76e682ea in virReportErrorHelper (domcode=domcode@entry=31, errorcode=errorcode@entry=1, filename=0x76f94434 "cpu/cpu.c",
           funcname=0x76f942dc <__FUNCTION__.18096> "cpuGetSubDriver", linenr=linenr@entry=58, fmt=0x76f7e7e4 "%s") at util/virerror.c:1292
       #2  0x76ed82d4 in cpuGetSubDriver (arch=<optimized out>) at cpu/cpu.c:57
       #3  cpuGetSubDriver (arch=VIR_ARCH_NONE) at cpu/cpu.c:51
       #4  0x76ed8818 in cpuDataFree (data=data@entry=0x70c22d78) at cpu/cpu.c:216
       #5  0x716aaec0 in virQEMUCapsInitCPU (arch=VIR_ARCH_ARMV7L, caps=0x70c29a08) at qemu/qemu_capabilities.c:867
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      66ec11ad
    • D
      Stop free'ing 'const char *' strings · bbcdd9b5
      Daniel P. Berrange 提交于
      The VIR_FREE() macro will cast away any const-ness. This masked a
      number of places where we passed a 'const char *' string to
      VIR_FREE. Fortunately in all of these cases, the variable was not
      in fact const data, but a heap allocated string. Fix all the
      variable declarations to reflect this.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      bbcdd9b5
    • E
      qemu: simplify list cleanup · 41b55056
      Eric Blake 提交于
      No need to open code now that we have a nice function.
      
      Interestingly, our virStringFreeList function is typed correctly
      (a malloc'd list of malloc'd strings is NOT const, whether at the
      point where it is created, or at the point where it is cleand up),
      so using it with a 'const char **' argument would require a cast
      to keep the compiler.  I chose instead to remove const from code
      even where we don't modify the argument, just to avoid the need
      to cast.
      
      * src/qemu/qemu_command.h (qemuParseCommandLine): Drop declaration.
      * src/qemu/qemu_command.c (qemuParseProcFileStrings)
      (qemuStringToArgvEnv): Don't force malloc'd result to be const.
      (qemuParseCommandLinePid, qemuParseCommandLineString): Simplify
      cleanup.
      (qemuParseCommandLine, qemuFindEnv): Drop const-correctness to
      avoid the need to cast in callers.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      41b55056
    • P
      conf: Don't deref NULL actual network in virDomainNetGetActualHostdev() · a3d24862
      Peter Krempa 提交于
      In commit 991270db I've used virDomainNetGetActualHostdev() to get
      the actual hostdev from a network when removing the network from the
      list to avoid leaving the hostdev in the list. I didn't notice that this
      function doesn't check if the actual network is allocated and
      dereferences it. This crashes the daemon when cleaning up a domain
      object in early startup phases when the actual network definition isn't
      allocated. When the actual definition isn't present, the hostdev that
      might correspond to it won't be present anyways so it's safe to return
      NULL.
      
      Thanks to Cole Robinson for noticing this problem.
      a3d24862
    • J
      libxl: Unconditionally call virSysinfoRead() on driver init · b78e8cb2
      Jim Fehlig 提交于
      No need to check if privileged when reading hostsysinfo, since
      that check was already done in libxlDriverShouldLoad().  The
      libxl driver fails to load if not privileged.
      b78e8cb2
    • J
      libxl: Check for regcomp failure · 3fed82da
      Jim Fehlig 提交于
      Change libxlGetAutoballoonConf() function to return an int
      for success/failure, and fail if regcomp fails.
      3fed82da
    • E
      virsh: fix build on mingw, which lacks termios stuff · 7e1cbd14
      Eric Blake 提交于
      Recent patches to fix handling of Ctrl-C when interacting with
      ssh are not portable to mingw, which lacks termios handling.
      The simplest solution is to just compile that code out, and
      if someone ever appears that has a serious interest in getting
      virsh fully functional even with ssh connections, they can
      provide patches at that time.
      
      * tools/virsh.h (_vshControl): Make termattr conditional.
      * tools/virsh.c (vshTTYIsInterruptCharacter)
      (vshTTYDisableInterrupt, vshTTYRestore, cfmakeraw, vshTTYMakeRaw)
      (main): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7e1cbd14
    • J
      libxl: Fix Coverity warning · 5236aed8
      Jim Fehlig 提交于
      John Ferlan reported the following Coverity warning:
      
      In libxlDomainCoreDump() Coverity has noted a FORWARD_NULL reference:
      
      2004 	    if ((flags & VIR_DUMP_CRASH) && !vm->persistent) {
      2005 	        virDomainObjListRemove(driver->domains, vm);
      
      (20) Event assign_zero: 	Assigning: "vm" = "NULL".
      Also see events: 	[var_deref_model]
      
      2006 	        vm = NULL;
      2007 	    }
      2008
      2009 	    ret = 0;
      2010
      2011 	cleanup_unpause:
      
      (21) Event var_deref_model: 	Passing null pointer "vm" to function
           "virDomainObjIsActive(virDomainObjPtr)", which dereferences it. [details]
      Also see events: 	[assign_zero]
      
      2012 	    if (virDomainObjIsActive(vm) && paused) {
      2013 	        if (libxl_domain_unpause(priv->ctx, dom->id) != 0) {
      2014 	            virReportError(VIR_ERR_INTERNAL_ERROR,
      
      Removing the vm from domain obj list and setting it to NULL can be
      done in the previous 'if (flags & VIR_DUMP_CRASH)' conditional.  Fix
      the Coverity warning by ensuring vm is not NULL before testing if it
      is still active.
      5236aed8
    • E
      spec: default vbox according to libvirtd build · c021f5ce
      Eric Blake 提交于
      Commit ba5f3c7c moved virtualBox support into libvirtd, but the spec
      file was still unconditionally requesting it even when not building
      the server side.  Thankfully there were no ill effects for a
      client_only build, as most uses of %{with_vbox} were guarded by
      %{with_libvirtd}; but we might as well avoid confusion by more
      closely matching the makefile.
      
      * libvirt.spec.in (with_vbox): Hoist to server conditionals.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c021f5ce
    • E
      build: avoid stranded polkit file in client-only build · bf3d9811
      Eric Blake 提交于
      daemon/Makefile.am installs a .policy file if WITH_LIBVIRTD and
      WITH_POLKIT are both set.  src/Makefile.am, on the other hand,
      installs a .policy file if WITH_POLKIT1 is set, but without checking
      WITH_LIBVIRTD.  When running 'make rpm' with client_only manually
      set, on a Fedora 19 box, that leads to a failure:
      
      RPM build errors:
          Installed (but unpackaged) file(s) found:
         /usr/share/polkit-1/actions/org.libvirt.api.policy
      
      Fix it by adding another conditional.
      
      * src/Makefile.am (polkitaction_DATA): Make conditional.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      bf3d9811
    • E
      build: only install nwfilter examples when building nwfilter · b420df72
      Eric Blake 提交于
      'make rpm' with client_local set to 1 (by manual modification,
      or with RHEL 5 on s390) warns:
      
      RPM build errors:
          Installed (but unpackaged) file(s) found:
         /etc/libvirt/nwfilter/allow-arp.xml
         /etc/libvirt/nwfilter/allow-dhcp-server.xml
         /etc/libvirt/nwfilter/allow-dhcp.xml
         /etc/libvirt/nwfilter/allow-incoming-ipv4.xml
         /etc/libvirt/nwfilter/allow-ipv4.xml
         /etc/libvirt/nwfilter/clean-traffic.xml
         /etc/libvirt/nwfilter/no-arp-ip-spoofing.xml
         /etc/libvirt/nwfilter/no-arp-mac-spoofing.xml
         /etc/libvirt/nwfilter/no-arp-spoofing.xml
         /etc/libvirt/nwfilter/no-ip-multicast.xml
         /etc/libvirt/nwfilter/no-ip-spoofing.xml
         /etc/libvirt/nwfilter/no-mac-broadcast.xml
         /etc/libvirt/nwfilter/no-mac-spoofing.xml
         /etc/libvirt/nwfilter/no-other-l2-traffic.xml
         /etc/libvirt/nwfilter/no-other-rarp-traffic.xml
         /etc/libvirt/nwfilter/qemu-announce-self-rarp.xml
         /etc/libvirt/nwfilter/qemu-announce-self.xml
         /usr/share/polkit-1/actions/org.libvirt.api.policy
      
      The bulk of these are fixed with this patch.
      
      * examples/xml/nwfilter/Makefile.am (install-data-local)
      (uninstall-local): Make conditional.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b420df72
    • E
      build: only run fdstreamtest when libvirtd is built · adf335f0
      Eric Blake 提交于
      An rpm build with client_only set to 1 (for example, RHEL 5 on
      s390, or by modifying libvirt.spec.in) failed with
      
      TEST: fdstreamtest
       1) Stream read blocking                                              ... OK
       2) Stream read non-blocking                                          ... Unexpected EOF block 0 want 128
      FAILED
       3) Stream write blocking                                             ... OK
       4) Stream write non-blocking                                         ... Failed to finish stream: internal error: libvirt:  error : cannot execute binary /home/eblake/rpmbuild/BUILD/libvirt-1.1.1/tests/../src/libvirt_iohelper: No such file or directory
      
      Since the test depends on something that was only built for
      WITH_LIBVIRTD (see src/Makefile.am), we must do the same for
      the test.
      
      * tests/Makefile.am (test_programs): Make fdstreamtest conditional.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      adf335f0
    • E
      spec: fix rpm build when lxc disabled · d42906fd
      Eric Blake 提交于
      'make rpm' failed if ~/.rpmmacros contains '%_without_lxc 1',
      which simulates the case of not having lxc available.
      
      RPM build errors:
          File not found: /home/eblake/rpmbuild/BUILDROOT/libvirt-1.1.1-1.fc19.x86_64/etc/libvirt/virt-login-shell.conf
          File not found by glob: /home/eblake/rpmbuild/BUILDROOT/libvirt-1.1.1-1.fc19.x86_64/usr/share/man/man1/virt-login-shell.1*
          File not found: /home/eblake/rpmbuild/BUILDROOT/libvirt-1.1.1-1.fc19.x86_64/usr/bin/virt-login-shell
      make: *** [rpm] Error 1
      
      Reported by Dan Berrange.
      
      * libvirt.spec.in: Mark virt-login-shell as conditional on lxc.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d42906fd
    • D
      virGet{User,Group}Ent() don't say success on fail · 4c7d1eab
      Doug Goldstein 提交于
      When virGetUserEnt() and virGetGroupEnt() fail due to the uid or gid not
      existing on the machine they'll print a message like:
      
      $ virsh -c vbox:///session list
      error: failed to connect to the hypervisor
      error: Failed to find user record for uid '32655': Success
      
      The success at the end is a bit confusing. This changes it to:
      
      $ virsh -c vbox:///session list
      error: failed to connect to the hypervisor
      error: Failed to find user record for uid '32655'
      4c7d1eab
  5. 04 9月, 2013 5 次提交
    • E
      build: enforce makefile conditional style · ec81852f
      Eric Blake 提交于
      Automake has builtin support to prevent botched conditional nesting,
      but only if you use:
      if FOO
      else !FOO
      endif !FOO
      
      An example error message when using the wrong name:
      
      daemon/Makefile.am:378: error: else reminder (LIBVIRT_INIT_SCRIPT_SYSTEMD_TRUE) incompatible with current conditional: LIBVIRT_INIT_SCRIPT_SYSTEMD_FALSE
      daemon/Makefile.am:381: error: endif reminder (LIBVIRT_INIT_SCRIPT_SYSTEMD_TRUE) incompatible with current conditional: LIBVIRT_INIT_SCRIPT_SYSTEMD_FALSE
      
      As our makefiles tend to have quite a bit of nested conditionals,
      it's better to take advantage of the benefits of the build system
      double-checking that our conditionals are well-nested, but that
      requires a syntax check to enforce our usage style.
      
      Alas, unlike C preprocessor and spec files, we can't use indentation
      to make it easier to see how deeply nesting goes.
      
      * cfg.mk (sc_makefile_conditionals): New rule.
      * daemon/Makefile.am: Enforce the style.
      * gnulib/tests/Makefile.am: Likewise.
      * python/Makefile.am: Likewise.
      * src/Makefile.am: Likewise.
      * tests/Makefile.am: Likewise.
      * tools/Makefile.am: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      ec81852f
    • M
      docs: Add OpenStack into references · d7d8fef4
      Martin Kletzander 提交于
      d7d8fef4
    • D
      Don't call VIR_ALLOC on def->uuid in parallels storage driver · 10b3c073
      Daniel P. Berrange 提交于
      The 'uuid' field in virDomainDefPtr is not a pointer, it is a
      fixed length array. Calling VIR_ALLOC on it is thus wrong and
      leaks memory.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      10b3c073
    • D
      Add missing 'libvirt_lxc_api' variable in pkg-config file · 7c91cb22
      Daniel P. Berrange 提交于
      The 'libvirt_lxc_api' variable is intended to allow apps to
      query the location of the API XML file for libvirt_lxc.so
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      7c91cb22
    • N
      Fix coding style issues in daemon/remote.c · de2eb66a
      Nehal J Wani 提交于
      Fixes for argument layouts of various functions in daemon/remote.c
      de2eb66a