1. 18 7月, 2013 33 次提交
    • J
      ae951e72
    • J
      Clarify virDomainDetachDeviceFlags documentation · 1f71de59
      Jiri Denemark 提交于
      1f71de59
    • J
      ee023f6c
    • J
      Add VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED event · 4421e257
      Jiri Denemark 提交于
      4421e257
    • J
      d077cda4
    • P
      qemu: Cleanup coding style nits in qemu_cgroup.c · bac21820
      Peter Krempa 提交于
      bac21820
    • O
      qemu: Set cpuset.cpus for domain process · a39f69d2
      Osier Yang 提交于
      When either "cpuset" of <vcpu> is specified, or the "placement" of
      <vcpu> is "auto", only setting the cpuset.mems might cause the guest
      starting to fail. E.g. ("placement" of both <vcpu> and <numatune> is
      "auto"):
      
      1) Related XMLs
        <vcpu placement='auto'>4</vcpu>
        <numatune>
          <memory mode='strict' placement='auto'/>
        </numatune>
      
      2) Host NUMA topology
        % numactl --hardware
        available: 8 nodes (0-7)
        node 0 cpus: 0 4 8 12 16 20 24 28
        node 0 size: 16374 MB
        node 0 free: 11899 MB
        node 1 cpus: 32 36 40 44 48 52 56 60
        node 1 size: 16384 MB
        node 1 free: 15318 MB
        node 2 cpus: 2 6 10 14 18 22 26 30
        node 2 size: 16384 MB
        node 2 free: 15766 MB
        node 3 cpus: 34 38 42 46 50 54 58 62
        node 3 size: 16384 MB
        node 3 free: 15347 MB
        node 4 cpus: 3 7 11 15 19 23 27 31
        node 4 size: 16384 MB
        node 4 free: 15041 MB
        node 5 cpus: 35 39 43 47 51 55 59 63
        node 5 size: 16384 MB
        node 5 free: 15202 MB
        node 6 cpus: 1 5 9 13 17 21 25 29
        node 6 size: 16384 MB
        node 6 free: 15197 MB
        node 7 cpus: 33 37 41 45 49 53 57 61
        node 7 size: 16368 MB
        node 7 free: 15669 MB
      
      4) cpuset.cpus will be set as: (from debug log)
      
      2013-05-09 16:50:17.296+0000: 417: debug : virCgroupSetValueStr:331 :
      Set value '/sys/fs/cgroup/cpuset/libvirt/qemu/toy/cpuset.cpus'
      to '0-63'
      
      5) The advisory nodeset got from querying numad (from debug log)
      
      2013-05-09 16:50:17.295+0000: 417: debug : qemuProcessStart:3614 :
      Nodeset returned from numad: 1
      
      6) cpuset.mems will be set as: (from debug log)
      
      2013-05-09 16:50:17.296+0000: 417: debug : virCgroupSetValueStr:331 :
      Set value '/sys/fs/cgroup/cpuset/libvirt/qemu/toy/cpuset.mems'
      to '0-7'
      
      I.E, the domain process's memory is restricted on the first NUMA node,
      however, it can use all of the CPUs, which will likely cause the domain
      process to fail to start because of the kernel fails to allocate
      memory with the the memory policy as "strict".
      
      % tail -n 20 /var/log/libvirt/qemu/toy.log
      ...
      2013-05-09 05:53:32.972+0000: 7318: debug : virCommandHandshakeChild:377 :
      Handshake with parent is done
      char device redirected to /dev/pts/2 (label charserial0)
      kvm_init_vcpu failed: Cannot allocate memory
      ...
      Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
      a39f69d2
    • P
      caps: Add helpers to convert NUMA nodes to corresponding CPUs · b8b38321
      Peter Krempa 提交于
      These helpers use the remembered host capabilities to retrieve the cpu
      map rather than query the host again. The intended usage for this
      helpers is to fix automatic NUMA placement with strict memory alloc. The
      code doing the prepare needs to pin the emulator process only to cpus
      belonging to a subset of NUMA nodes of the host.
      b8b38321
    • M
      Add virtio-scsi to fallback models of scsi controller · b7f1c0c3
      Martin Kletzander 提交于
      When user does not specify any model for scsi controller, or worse, no
      controller at all, but libvirt automatically adds scsi controller with
      no model, we are not searching for virtio-scsi and thus this can fail
      for example on qemu which doesn't support lsi logic adapter.
      
      This means that when qemu on x86 doesn't support lsi53c895a and the
      user adds the following to an XML without any scsi controller:
      
      <disk ...>
        ...
        <target dev='sda'>
      </disk>
      
      libvirt fails like this:
       # virsh define asdf.xml
       error: Failed to define domain from asdf.xml
       error: internal error Unable to determine model for scsi controller
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=974943
      b7f1c0c3
    • M
      Introduce lxcDomObjFromDomain · dbeb04a6
      Michal Privoznik 提交于
      Similarly to qemu driver, we can use a helper function to
      lookup a domain instead of copying multiple lines around.
      dbeb04a6
    • M
      Remove lxcDriverLock from almost everywhere · eb150c86
      Michal Privoznik 提交于
      With the majority of fields in the virLXCDriverPtr struct
      now immutable or self-locking, there is no need for practically
      any methods to be using the LXC driver lock. Only a handful
      of helper APIs now need it.
      eb150c86
    • M
      lxc: Make activeUsbHostdevs use locks · 2a82171a
      Michal Privoznik 提交于
      The activeUsbHostdevs item in LXCDriver are lockable, but the lock has
      to be called explicitly. Call the virObject(Un)Lock() in order to
      achieve mutual exclusion once lxcDriverLock is removed.
      2a82171a
    • M
      Stop accessing driver->caps directly in LXC driver · 64ec738e
      Michal Privoznik 提交于
      The 'driver->caps' pointer can be changed on the fly. Accessing
      it currently requires the global driver lock. Isolate this
      access in a single helper, so a future patch can relax the
      locking constraints.
      64ec738e
    • M
      lxc: switch to virCloseCallbacks API · c8695053
      Michal Privoznik 提交于
      c8695053
    • M
      Introduce annotations for virLXCDriverPtr fields · 4deeb74d
      Michal Privoznik 提交于
      Annotate the fields in virLXCDriverPtr to indicate the locking
      rules for their use.
      4deeb74d
    • M
      lxc: Use atomic ops for driver->nactive · 29bed27e
      Michal Privoznik 提交于
      29bed27e
    • M
      Introduce a virLXCDriverConfigPtr object · 7fca3755
      Michal Privoznik 提交于
      Currently the virLXCDriverPtr struct contains an wide variety
      of data with varying access needs. Move all the static config
      data into a dedicated virLXCDriverConfigPtr object. The only
      locking requirement is to hold the driver lock, while obtaining
      an instance of virLXCDriverConfigPtr. Once a reference is held
      on the config object, it can be used completely lockless since
      it is immutable.
      
      NB, not all APIs correctly hold the driver lock while getting
      a reference to the config object in this patch. This is safe
      for now since the config is never updated on the fly. Later
      patches will address this fully.
      7fca3755
    • M
      virLXCDriver: Drop unused @cgroup · 7e94a1a4
      Michal Privoznik 提交于
      It is not used anywhere, so it makes no sense to have it there.
      7e94a1a4
    • M
    • M
      qemuhotplugtest: Resolve some memleaks · 166db595
      Michal Privoznik 提交于
      If testQemuHotplugAttach succeeds, the vm->def steals the dev pointer.
      However, not the envelope, which needs to be freed. In addition,
      driver.config is allocated, but never freed.
      166db595
    • M
      qemuDomainDetachChrDevice: Don't leak @charAlias · b7658f62
      Michal Privoznik 提交于
      Moreover, since virAsprintf now does report OOM error, there's no need
      to call virReportOOMError in error path.
      b7658f62
    • J
      virAsprintf: correctly check return value · 23e938ee
      Ján Tomko 提交于
      When virAsprintf was changed from a function to a macro
      reporting OOM error in dc6f2dad, it was documented as returning
      0 on success. This is incorrect, it returns the number of bytes
      written as asprintf does.
      
      Some of the functions were converted to use virAsprintf's return
      value directly, changing the return value on success from 0 to >= 0.
      
      For most of these, this is not a problem, but the change in
      virPCIDriverDir breaks PCI passthrough.
      
      The return value check in virhashtest pre-dates virAsprintf OOM
      conversion.
      
      vmwareMakePath seems to be unused.
      23e938ee
    • D
      Merge virCommandPreserveFD / virCommandTransferFD · 040d9963
      Daniel P. Berrange 提交于
      Merge the virCommandPreserveFD / virCommandTransferFD methods
      into a single virCommandPasFD method, and use a new
      VIR_COMMAND_PASS_FD_CLOSE_PARENT to indicate their difference
      in behaviour
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      040d9963
    • D
      Enable FD passing when starting guests with virsh · afb50d79
      Daniel P. Berrange 提交于
      Add a "--pass-fds N,M,..." arg to the virsh start/create
      methods. This allows pre-opened file descriptors from the
      shell to be passed on into the guest
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      afb50d79
    • D
      LXC: Wire up the virDomainCreate{XML}WithFiles methods · 11693bc6
      Daniel P. Berrange 提交于
      Wire up the new virDomainCreate{XML}WithFiles methods in the
      LXC driver, so that FDs get passed down to the init process.
      
      The lxc_container code needs to do a little dance in order
      to renumber the file descriptors it receives into linear
      order, starting from STDERR_FILENO + 1.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      11693bc6
    • D
      Fix impl of virDomainCreateWithFlags remote client helper · ddaf15d7
      Daniel P. Berrange 提交于
      In the following commit:
      
        commit 03d813bb
        Author: Marek Marczykowski <marmarek@invisiblethingslab.com>
        Date:   Thu May 23 02:01:30 2013 +0200
      
          remote: fix dom->id after virDomainCreateWithFlags
      
      The virDomainCreateWithFlags remote client helper was made to
      invoke REMOTE_PROC_DOMAIN_LOOKUP_BY_UUID to refresh the 'id'
      of the domain, following the pattern used in the previous
      virDomainCreate method impl.
      
      The remote protocol for virDomainCreateWithFlags though did
      actually fix the design flaw in virDomainCreate, by directly
      returning the new domain info. For some reason, this data was
      never used. So we can just use that data now instead.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      ddaf15d7
    • D
      Introduce remote protocol support for virDomainCreate{XML}WithFiles · bfd663ef
      Daniel P. Berrange 提交于
      Since they make use of file descriptor passing, the remote protocol
      methods for virDomainCreate{XML}WithFiles must be written by hand.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      bfd663ef
    • D
      Introduce new domain create APIs to pass pre-opened FDs to LXC · d76227be
      Daniel P. Berrange 提交于
      With container based virt, it is useful to be able to pass
      pre-opened file descriptors to the container init process.
      This allows for containers to be auto-activated from incoming
      socket connections, passing the active socket into the container.
      
      To do this, introduce a pair of new APIs, virDomainCreateXMLWithFiles
      and virDomainCreateWithFiles, which accept an array of file
      descriptors. For the LXC driver, UNIX file descriptor passing
      will be used to send them to libvirtd, which will them pass
      them down to libvirt_lxc, which will then pass them to the container
      init process.
      
      This will only be implemented for LXC right now, but the design
      is generic enough it could work with other hypervisors, hence
      I suggest adding this to libvirt.so, rather than libvirt-lxc.so
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d76227be
    • J
      maint: Make ctags work out of the box · d9301a9a
      Jiri Denemark 提交于
      The .ctags file specifies default options for ctags so that it does not
      ignore libvirt.h.in and ignores uninteresting files. As a result, you
      can just run "ctags" and navigating to a public API won't get you to a
      useless entry in api.html.
      d9301a9a
    • G
      esx: Support for disk-only and quiescing snapshots. · 6c8adeb4
      Geoff Hickey 提交于
      Add support for creating disk-only (no memory) snapshots in esx, and
      for quiescing the VM before taking the snapshot. The VMware API
      supports these operations directly, so adding support to libvirt is
      just a matter of setting the flags correctly when calling
      VMware. VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY and
      VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE are now valid flags for esx.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6c8adeb4
    • D
      libxl: implement virDomainGetNumaParameters · 261c4f5f
      Dario Faggioli 提交于
      Although, having it depending on Xen >= 4.3 (by using the proper
      libxl feature flag).
      
      Xen currently implements a NUMA placement policy which is basically
      the same as the 'interleaved' policy of `numactl', although it can
      be applied on a subset of the available nodes. We therefore hardcode
      "interleave" as 'numa_mode', and we use the newly introduced libxl
      interface to figure out what nodes a domain spans ('numa_nodeset').
      
      With this change, it is now possible to query the NUMA node
      affinity of a running domain:
      
      [raistlin@Zhaman ~]$ sudo virsh --connect xen:/// list
       Id    Name                           State
      ----------------------------------------------------
       23    F18_x64                        running
      
      [raistlin@Zhaman ~]$ sudo virsh --connect xen:/// numatune 23
      numa_mode      : interleave
      numa_nodeset   : 1
      Signed-off-by: NDario Faggioli <dario.faggioli@citrix.com>
      261c4f5f
    • D
      libxl: advertise the support for VIR_TYPED_PARAM_STRING · 98984b71
      Dario Faggioli 提交于
      domainGetNumaParameters has a string typed parameter, hence it
      is necessary for the libxl driver to support this.
      
      This change implements the connectSupportsFeature hook for the
      libxl driver, advertising that VIR_DRV_FEATURE_TYPED_PARAM_STRING
      is supported.
      Signed-off-by: NDario Faggioli <dario.faggioli@citrix.com>
      Cc: Eric Blake <eblake@redhat.com>
      98984b71
    • S
      xen: Add interface versions for Xen 4.3 · fd2e3c4c
      Stefan Bader 提交于
      Xen 4.3 changes sysctl version to 10 and domctl version to 9. Update
      the hypervisor driver to work with those.
      Signed-off-by: NStefan Bader <stefan.bader@canonical.com>
      fd2e3c4c
  2. 17 7月, 2013 7 次提交
    • M
      lxc_container: Don't call virGetGroupList during exec · 192a86ca
      Michal Privoznik 提交于
      Commit 75c12564 states that virGetGroupList must not be called
      between fork and exec, then commit ee777e99 promptly violated
      that for lxc.
      
      Patch originally posted by Eric Blake <eblake@redhat.com>.
      192a86ca
    • J
      cgroup: reuse buffer for getline · cc732931
      Ján Tomko 提交于
      Reuse the buffer for getline and track buffer allocation
      separately from the string length to prevent unlikely
      out-of-bounds memory access.
      
      This fixes the following leak that happened when zero bytes were read:
      
      ==404== 120 bytes in 1 blocks are definitely lost in loss record 1,344 of 1,671
      ==404==    at 0x4C2C71B: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==404==    by 0x906F862: getdelim (iogetdelim.c:68)
      ==404==    by 0x52A48FB: virCgroupPartitionNeedsEscaping (vircgroup.c:1136)
      ==404==    by 0x52A0FB4: virCgroupPartitionEscape (vircgroup.c:1171)
      ==404==    by 0x52A0EA4: virCgroupNewDomainPartition (vircgroup.c:1450)
      cc732931
    • M
      qemuDomainGetSchedulerType: Prefer qemuDomObjFromDomain · e80e07f6
      Michal Privoznik 提交于
      In all qemu APIs we tend to prefer qemuDomObjFromDomain over
      virDomainObjListFindByUUID. But somehow the
      qemuDomainGetSchedulerType left unattended.
      e80e07f6
    • M
      virSecurityManagerGenLabel: Skip seclabels without model · ba44dd24
      Michal Privoznik 提交于
      While generating seclabels, we check the seclabel stack if required
      driver is in the stack. If not, an error is returned. However, it is
      possible for a seclabel to not have any model set (happens with LXC
      domains that have just <seclabel type='none'>). If that's the case,
      we should just skip the iteration instead of calling STREQ(NULL, ...)
      and SIGSEGV-ing subsequently.
      ba44dd24
    • M
      lxcCapsInit: Allocate primary security driver unconditionally · 37d96498
      Michal Privoznik 提交于
      Currently, if the primary security driver is 'none', we skip
      initializing caps->host.secModels. This means, later, when LXC domain
      XML is parsed and <seclabel type='none'/> is found (see
      virSecurityLabelDefsParseXML), the model name is not copied to the
      seclabel. This leads to subsequent crash in virSecurityManagerGenLabel
      where we call STREQ() over the model (note, that we are expecting model
      to be !NULL).
      37d96498
    • J
      53f3739a
    • J
      ac68a785