1. 09 12月, 2015 7 次提交
  2. 08 12月, 2015 7 次提交
    • J
      Revert "libxl: implement virDomainInterfaceStats" · e4ac5919
      Jim Fehlig 提交于
      This reverts commit d2e5538b.
      
      A migration regression was introduced by this commit. When migrating
      a domain, its active XML is sent to the destination libvirtd, where
      it is parsed as inactive XML. d2e5538b copied the libxl generated
      interface name into the active config, which was being passed to the
      migration destination and being parsed into inactive config. Attempting
      to start the config could result in failure if an interface with the
      same generated name already exists.
      
      The qemu driver behaves similarly, but the parser contains a hack to
      skip interface names starting with 'vnet' when parsing inactive XML.
      We could extend the hack to skip names starting with 'vif' too, but a
      better fix would be to expose these hypervisor-specific interface name
      prefixes in capabilities. See the following discussion thread for more
      details
      
      https://www.redhat.com/archives/libvir-list/2015-December/msg00262.html
      
      For the pending 1.3.0 release, it is best to revert d2e5538b. It can
      be added again post release, after moving the prefix to capabilities.
      e4ac5919
    • D
      rpm: explicitly enable & start virtlogd on install · da054f35
      Daniel P. Berrange 提交于
      When installing the libvirt-daemon RPM, we have a %post rule to
      enable the libvirtd.service, virtlockd.socket and virtlogd.socket
      files. This is only done, however, when the RPM is first installed,
      not when upgrading RPMs. So virtlogd will not get activated on
      upgrading, which is a problem as libvirt qemu driver will expect
      it to be available by default.
      
      This adds a trigger that is run when uninstalling libvirt-daemon
      older than 1.3.0 that will enable & start virtlogd.socket if
      libvirtd is enabled and/or started. Using the trigger rather
      than %post ensures that it only runs once, allowing admins to
      disable it explicitly thereafter without future upgrades
      re-enabling it.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      da054f35
    • D
      libvirtd: enable virtlockd/virtlogd socket activation on install · 5cce775e
      Daniel P. Berrange 提交于
      When someone does 'systemctl enable libvirtd.service' we should
      also enable virtlockd.socket/virtlogd.socket, so that they can
      be auto-activated if libvirtd tries to access the sockets.
      
      Without this, people have to manually enable the units themselves
      via 'systemctl enable virtdlogd.socket'.
      
      This also ensures that if distros uses  'systemctl preset' for
      enabling 'libvirtd.service', then the virtdlogd.socket gets
      enabled without having to wait for the distro to update their
      presets file.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      5cce775e
    • D
      logging: validate flags passed from client in virtlogd · b6cbabc5
      Daniel P. Berrange 提交于
      The virtlogd RPC messages all have a flags parameter. For
      sake of future error reporting we should be verifying
      these are all 0 for now.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      b6cbabc5
    • D
      logging: change log protocol to be more reusable · 50896b28
      Daniel P. Berrange 提交于
      The current virtlogd RPC protocol provides the ability to
      handle log files associated with QEMU stdout/err. The log
      protocol messages take the virt driver, domain name and
      use that to form a log file path. This is quite restrictive
      as it prevents us re-using the same RPC protocol messages
      for logging to char device backends where the filename
      can be arbitrarily user specified. It is also bad because
      it means we have 2 separate locations which have to decide
      on logfile name.
      
      This change alters the RPC protocol so that we pass the
      desired log file path along when opening the log file
      initially. Now the virt driver is exclusively in charge
      of deciding the log filename
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      50896b28
    • D
      logging: preserve driver, dom name & uuid against log file · d4abb09d
      Daniel P. Berrange 提交于
      The virt driver, dom name and uuid associated with a log
      file are important pieces of metadata to keep around for
      sake of future enhancements to virtlogd. Currently we
      discard them after opening the log file, but we should
      preserve them, even across restarts.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d4abb09d
    • D
      qemu: fix memory leak in opening log file · 0eafe995
      Daniel P. Berrange 提交于
      The qemuDomainLogContextNew method leaks the "logfile" path
      on the non-virtlogd code path.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      0eafe995
  3. 05 12月, 2015 5 次提交
  4. 04 12月, 2015 3 次提交
    • P
      qemu: domain: Prevent overflows in memory alignment code · 64588113
      Peter Krempa 提交于
      Since libvirt for dubious historical reasons stores memory size as
      kibibytes, it's possible that the alignments done in the qemu code
      overflow the the maximum representable size in bytes. The XML parser
      code handles them in bytes in some stages. Prevent this by doing
      overflow checks when alinging the size and add a test case.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1260576
      64588113
    • P
      schema: Allow > UINT_MAX KiB of memory for NUMA nodes · e5fac009
      Peter Krempa 提交于
      Using more than 4TiB of memory per NUMA node would not be possible to
      express in the XML without violating the schema. Not that such boxes
      would be common, but we should use a longer type at this point.
      
      The pattern is not necessary since libvirt redefines the type already in
      basictypes.rng with the same pattern.
      e5fac009
    • B
      conf: Revert some code to resolve issues for hostdev hotplug · dc692438
      Boris Fiuczynski 提交于
      This patch reverts parts of commits 0d8b24f6 and 0785966d dealing with
      the addition of a controller during virDomainHostdevAssignAddress. This
      caused a regression for the hostdev hotplug path which assumes the
      qemuDomainFindOrCreateSCSIDiskController will add the new controller
      during qemuDomainAttachHostSCSIDevice to both the running domain and
      the domain def controller list when the controller doesn't yet exist
      (whether due to no SCSI controllers existing or the addition of a new
      controller because existing ones are full).
      
      Since commit id 0d8b24f6 will call virDomainHostdevAssignAddress during
      virDomainDeviceDefPostParseInternal which is called either during domain
      definition post processing (via an iterator during virDomainDefPostParse)
      or directly from virDomainDeviceDefParse during hotplug, the change
      broke the "side effect" of being able to add both a hostdev and controller
      to the running domain.
      
      The regression would only be seen if the running domain didn't have a
      SCSI controller already defined or if the existing SCSI controller was
      "full" of devices and a new controller needed to be created.
      
      This patch will also add some extra comments to the code to avoid a
      similar future change.
      Signed-off-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
      Reviewed-by: NBjoern Walk <bwalk@linux.vnet.ibm.com>
      Reviewed-by: NStefan Zimmermann <stzi@linux.vnet.ibm.com>
      dc692438
  5. 03 12月, 2015 4 次提交
    • J
      virsh: remove custom error for cpulist from cmdIOThreadPin · b15e26f9
      Ján Tomko 提交于
      Instead of the custom error:
      error: iothreadpin: invalid cpulist.
      
      use vshCommandOptStringReq and let it report a more specific error:
      error: Failed to get option 'cpulist': Option argument is empty
      b15e26f9
    • J
      virsh: report errors for empty strings · 45138725
      Ján Tomko 提交于
      Several callers were using vshCommandOptString without setting an error.
      Use vshCommandOptStringReq which sets the error.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1281707
      45138725
    • J
      bridge: check for invalid MAC in networkGetDHCPLeases · 1e6d87bd
      Ján Tomko 提交于
      Instead of comparing garbage strings against real MAC addresses,
      introduce an error mesage for unparsable ones:
      
      $ virsh net-dhcp-leases default  --mac t12
      error: Failed to get leases info for default
      error: invalid MAC address: t12
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1261432
      1e6d87bd
    • J
      libxl: implement virDomainInterfaceStats · d2e5538b
      Joao Martins 提交于
      Introduce support for domainInterfaceStats API call for querying
      network interface statistics. Consequently it also enables the
      use of `virsh domifstat <dom> <interface name>` command plus
      seeing the interfaces names instead of "-" when doing
      `virsh domiflist <dom>`.
      
      After successful guest creation we fill the network
      interfaces names based on domain, device id and append suffix
      if it's emulated in the following form: vif<domid>.<devid>[-emu].
      We extract the network interfaces info from the libxl_domain_config
      object in libxlDomainCreateIfaceNames() to generate ifname. On domain
      cleanup we also clear ifname, in case it was set by libvirt (i.e.
      being prefixed with "vif"). We also skip these two steps in case the name
      of the interface was manually inserted by the adminstrator.
      
      For getting the interface statistics we resort to virNetInterfaceStats
      and let libvirt handle the platform specific nits. Note that the latter
      is not yet supported in FreeBSD.
      Signed-off-by: NJoao Martins <joao.m.martins@oracle.com>
      d2e5538b
  6. 02 12月, 2015 1 次提交
    • I
      network: selectively disable -Wcast-align in virNetDevParseDadStatus · af2954ae
      Ian Campbell 提交于
      Commit 0f7436ca "network: wait for DAD to finish for bridge IPv6 addresses"
      results in:
      
       CC     util/libvirt_util_la-virnetdevmacvlan.lo
      util/virnetdev.c: In function 'virNetDevParseDadStatus':
      util/virnetdev.c:1319:188: error: cast increases required alignment of target type [-Werror=cast-align]
      util/virnetdev.c:1332:41: error: cast increases required alignment of target type [-Werror=cast-align]
      util/virnetdev.c:1334:92: error: cast increases required alignment of target type [-Werror=cast-align]
      cc1: all warnings being treated as errors
      
      on at least ARM platforms.
      
      The three macros involved (NLMSG_NEXT, IFA_RTA and RTA_NEXT) all appear to
      correctly take care of alignment, therefore suppress Wcast-align around their
      uses.
      Signed-off-by: NIan Campbell <ian.campbell@citrix.com>
      Cc: Maxim Perevedentsev <mperevedentsev@virtuozzo.com>
      Cc: Laine Stump <laine@laine.org>
      Cc: Dario Faggioli <dario.faggioli@citrix.com>
      Cc: Jim Fehlig <jfehlig@suse.com>
      af2954ae
  7. 01 12月, 2015 7 次提交
    • M
      log_manager: Include configmake.h last · bd205a90
      Michal Privoznik 提交于
      The problem is that in some mingw header DATADIR is used but
      gnulib defines it too. This leads to the following compile error:
      
        CC       locking/libvirt_driver_la-lock_manager.lo
      In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/objbase.h:66:0,
                       from /usr/i686-w64-mingw32/sys-root/mingw/include/ole2.h:17,
                       from /usr/i686-w64-mingw32/sys-root/mingw/include/wtypes.h:12,
                       from /usr/i686-w64-mingw32/sys-root/mingw/include/winscard.h:10,
                       from /usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:97,
                       from /usr/i686-w64-mingw32/sys-root/mingw/include/winsock2.h:23,
                       from ../gnulib/lib/unistd.h:48,
                       from ../../src/util/virutil.h:29,
                       from ../../src/logging/log_manager.c:30:
      /usr/i686-w64-mingw32/sys-root/mingw/include/objidl.h:12275:2: error: expected identifier or '(' before string constant
       } DATADIR;
        ^
      Makefile:7888: recipe for target 'logging/libvirt_driver_la-log_manager.lo' failed
      
      The fix is to include configmake.h at the end of includes.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      bd205a90
    • M
      tests: Run virnetdaemontest iff WITH_YAJL · 01f6cbcf
      Michal Privoznik 提交于
      The test itself and daemon require a JSON parsing library. If not
      present, skip the test.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      01f6cbcf
    • M
      admin: Distribute libvirt-admin.conf · 2340f3eb
      Martin Kletzander 提交于
      Commit 48cd3dfa introduced configuration
      file for libvirt-admin but forgot to distribute it.  Also the change
      made to libvirt.conf in commit dbecb87f
      should've been removed thanks to introduction of separate config file.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      2340f3eb
    • M
      admin: Rename virAdmConnect to virAdmDaemon · df8192aa
      Martin Kletzander 提交于
      virAdmConnect was named after virConnect, but after some discussions,
      most of the APIs called will be working with remote daemon and starting
      them virAdmDaemon will make more sense.  Only possibly controversal name
      is CloseCallback (de)registration, and connecting to the daemon (which
      will still be Open/Close), but even this makes sense if one thinks about
      the daemon being opened and closed, e.g. as file, etc.
      
      This way all the APIs working with the daemon will start with
      virAdmDaemon prefix, they will accept virAdmDaemonPtr as first parameter
      and that will better suit with other namings as well (virDomain*,
      virAdmServer*, etc.).
      
      Because in virt-admin, the connection name does not refer to a struct
      that would have a connect in its name, also adjust 'connname' in
      clients.  And because it is not used anywhere in the vsh code, move it
      from there into each client.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      df8192aa
    • M
      spec: Temporarily disable new admin-related files · 15b0a6d6
      Martin Kletzander 提交于
      The virt-admin binary and its man page should not yet be distributed,
      but we need libvirt-common.h.  RPM build fails without specifying these.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      15b0a6d6
    • M
      admin: Include admin_remote.c in the dist package · 524492dc
      Martin Kletzander 提交于
      Otherwise all builds from the package will fail.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      524492dc
    • W
      qemu_agent: fix deadlock in qemuProcessHandleAgentEOF · fe51174f
      Wang Yufei 提交于
      If VM A is shutdown a by qemu agent at appoximately the same time
      an agent EOF of VM A happened, there's a chance that deadlock may occur:
      
      qemuProcessHandleAgentEOF in main thread
      A)  priv->agent = NULL; //A happened before B
      
          //deadlock when we get agent lock which's held by worker thread
          qemuAgentClose(agent);
      
      qemuDomainObjExitAgent called by qemuDomainShutdownFlags in worker thread
      B)  hasRefs = virObjectUnref(priv->agent); // priv->agent is NULL,
                                                 // return false
          if (hasRefs)
              virObjectUnlock(priv->agent); //agent lock will not be released here
      
      In order to resolve, during EOF close the agent first, then set priv->agent
      to NULL to fix the deadlock.
      
      This essentially reverts commit id '1020a504'. It's also of note that commit
      id '362d0477' notes a possible/rare deadlock similar to what was seen in
      the monitor in commit id '25f582e3'. However, it seems interceding changes
      including commit id 'd960d06f' should remove the deadlock issue.
      
      With this change, if EOF is called:
      
          Get VM lock
          Check if !priv->agent || priv->beingDestroyed, then unlock VM
          Call qemuAgentClose
          Unlock VM
      
      When qemuAgentClose is called
          Get Agent lock
          If Agent->fd open, close it
          Unlock Agent
          Unref Agent
      
      qemuDomainObjEnterAgent
          Enter with VM lock
          Get Agent lock
          Increase Agent refcnt
          Unlock VM
      
      After running agent command, calling qemuDomainObjExitAgent
          Enter with Agent lock
          Unref Agent
          If not last reference, unlock Agent
          Get VM lock
      
      If we were in the middle of an EnterAgent, call Agent command, and
      ExitAgent sequence and the EOF code is triggered, then the EOF code
      can get the VM lock, make it's checks against !priv->agent ||
      priv->beingDestroyed, and call qemuAgentClose. The CloseAgent
      would wait to get agent lock. The other thread then will eventually
      call ExitAgent, release the Agent lock and unref the Agent. Once
      ExitAgent releases the Agent lock, AgentClose will get the Agent
      Agent lock, close the fd, unlock the agent, and unref the agent.
      The final unref would cause deletion of the agent.
      Signed-off-by: NWang Yufei <james.wangyufei@huawei.com>
      Reviewed-by: NRen Guannan <renguannan@huawei.com>
      fe51174f
  8. 30 11月, 2015 6 次提交