1. 24 6月, 2010 3 次提交
    • M
      Cleanup some LIBADD and CFLAGS · a73b389d
      Matthias Bolte 提交于
      Move libnl to libvirt_util.la, because macvtap.c requires it.
      
      Add GnuTLS to libvirt_driver.la, because libvirt.c calls gcrypt functions.
      When built without loadable driver modules, then the remote driver pulls
      in GnuTLS.
      
      Move libgnu.la from libvirt_parthelper_CFLAGS to libvirt_parthelper_LDADD.
      a73b389d
    • R
      cgroup: Enable memory.use_hierarchy of cgroup for domain · 4a4eb13e
      Ryota Ozaki 提交于
      Through conversation with Kumar L Srikanth-B22348, I found
      that the function of getting memory usage (e.g., virsh dominfo)
      doesn't work for lxc with ns subsystem of cgroup enabled.
      
      This is because of features of ns and memory subsystems.
      Ns creates child cgroup on every process fork and as a result
      processes in a container are not assigned in a cgroup for
      domain (e.g., libvirt/lxc/test1/). For example, libvirt_lxc
      and init (or somewhat specified in XML) are assigned into
      libvirt/lxc/test1/8839/ and libvirt/lxc/test1/8839/8849/,
      respectively. On the other hand, memory subsystem accounts
      memory usage within a group of processes by default, i.e.,
      it does not take any child (and descendant) groups into
      account. With the two features, virsh dominfo which just
      checks memory usage of a cgroup for domain always returns
      zero because the cgroup has no process.
      
      Setting memory.use_hierarchy of a group allows to account
      (and limit) memory usage of every descendant groups of the group.
      By setting it of a cgroup for domain, we can get proper memory
      usage of lxc with ns subsystem enabled. (To be exact, the
      setting is required only when memory and ns subsystems are
      enabled at the same time, e.g., mount -t cgroup none /cgroup.)
      4a4eb13e
    • R
      cgroup: Change virCgroupRemove to remove all descendant groups at first · 842b51ff
      Ryota Ozaki 提交于
      As same as normal directories, a cgroup cannot be removed if it
      contains sub groups. This patch changes virCgroupRemove to remove
      all descendant groups (subdirectories) of a target group before
      removing the target group.
      
      The handling is required when we run lxc with ns subsystem of cgroup.
      Ns subsystem automatically creates child cgroups on every process
      forks, but unfortunately the groups are not removed on process exits,
      so we have to remove them by ourselves.
      
      With this patch, such child (and descendant) groups are surely removed
      at lxc shutdown, i.e., lxcVmCleanup which calls virCgroupRemove.
      842b51ff
  2. 23 6月, 2010 7 次提交
    • E
      virsh: document attach-disk better · 4cc2b6d6
      Eric Blake 提交于
      http://bugzilla.redhat.com/601143, part 1 - document existing
      behavior.  Ever since Mar 2010 (commit ced154cb), the use of
      'attach-disk' or 'attach-device' to change cdrom/floppy media has been
      documented but deprecated, but the replacement to use 'update-device'
      was not documented.
      
      * tools/virsh.c (cmdAttachInterface, cmdAttachDisk): Fix bad error
      message.
      * tools/virsh.pod (attach-device, attach-disk): Refer to
      update-device for cdrom and floppy behavior.
      (update-device): Add documentation.
      4cc2b6d6
    • A
      network: allow tftp port if tftp is defined · 4efaf77b
      Alan Pevec 提交于
      add iptables rules to allow TFTP from the virtual network if <tftp>
      element is defined in the network definition.
      
      Fedora bz#580215
      
      * src/network/bridge_driver.c: open UDP port 69 for TFTP traffic if
        tftproot is defined
      4efaf77b
    • A
      bridge_driver.c: fix file description · 0c141c89
      Alan Pevec 提交于
      0c141c89
    • D
      Add '-nodefconfig' command line arg to QEMU · f310b253
      Daniel P. Berrange 提交于
      We already use the '-nodefaults' command line arg with QEMU to stop
      it adding any default devices to guests. Unfortunately, QEMU will
      load global config files from /etc/qemu that may also add default
      devices. These aren't blocked by '-nodefaults', so we need to also
      add the '-nodefconfig' arg to prevent that.
      
      Unfortunately these global config files are also used to define
      custom CPU models. So in blocking global hardware device addition
      we also block definitions of new CPU models. Libvirt doesn't know
      about these custom CPU models though, so it would never make use
      of them anyway. Thus blocking them via -nodefconfig isn't a show
      stopping problem. We would need to expand libvirt's own CPU model
      XML database to support these instead.
      
      * src/qemu/qemu_conf.c: Add '-nodefconfig' if available
      * tests/qemuxml2argvdata/: Add '-nodefconfig' to all data files which
        have '-nodefaults' present
      f310b253
    • D
      Fix reference handling leak on qemuMonitor · c2121602
      Daniel P. Berrange 提交于
      The current code pattern requires that callers of qemuMonitorClose
      check for the return value == 0, and if so, set priv->mon = NULL
      and release the reference held on the associated virDomainObjPtr
      
      The change d84bb6d6 violated that
      requirement, meaning that priv->mon never gets set to NULL, and
      a reference count is leaked on virDomainObjPtr.
      
      This design was a bad one, so remove the need to check the return
      valueof qemuMonitorClose(). Instead allow registration of a
      callback that's invoked just when the last reference on qemuMonitorPtr
      is released.
      
      Finally there was a potential reference leak in qemuConnectMonitor
      in the failure path.
      
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add a destroy
        callback invoked from qemuMonitorFree
      * src/qemu/qemu_driver.c: Use the destroy callback to release the
        reference on virDomainObjPtr when the monitor is freed. Fix other
        potential reference count leak in connecting to monitor
      c2121602
    • D
      Make checks for inactive QEMU guest more robust · 8d616dec
      Daniel P. Berrange 提交于
      Before issuing monitor commands it is neccessary to check whether
      the guest is still running. Most places use virDomainIsActive()
      correctly, but a few relied on 'priv->mon != NULL'. In theory
      these should be equivalent, but the release of the last reference
      count on priv->mon can be delayed a small amount of time until
      the event handler is finally deregistered. A further ref counting
      bug also means that priv->mon might be never released. In such a
      case, code could mistakenly issue a monitor command and wait for
      a response that will never arrive, effectively leaving the QEMU
      driver waiting on virCondWait() forever..
      
      To protect against these possibilities, make sure all code uses
      virDomainIsActive(), not 'priv->mon != NULL'
      
      * src/qemu/qemu_driver.c: Replace 'priv->mon != NULL' with
        calls to 'priv->mon != NULL'()
      8d616dec
    • D
      Improve some error messages about unsupported APIs/URIs · 9b0244ae
      Daniel P. Berrange 提交于
      If there is no driver for a URI we report
      
        "no hypervisor driver available"
      
      This is bad because not all virt drivers are hypervisors (ie container
      based virt).
      
      If there is no driver support for an API we report
      
        "this function is not supported by the hypervisor"
      
      This is bad for the same reason, and additionally because it is
      also used for the network, interface & storage drivers.
      
      * src/util/virterror.c: Improve error messages
      9b0244ae
  3. 22 6月, 2010 2 次提交
    • J
      Don't leak open fd to virsh in libvirt-guests init script · 6c267f01
      Jiri Denemark 提交于
      Running virsh while having /var/lib/libvirt/libvirt-guests file open
      makes SELinux emit messages about preventing virsh from reading that
      file. Since virsh doesn't really want to read anything, it's better to
      run it with /dev/null on stdin to prevent those messages.
      6c267f01
    • S
      nwfilter: fix loadable module support · cab5a52a
      Stefan Berger 提交于
      Following Daniel Berrange's multiple helpful suggestions for improving
      this patch and introducing another driver interface, I now wrote the
      below patch where the nwfilter driver registers the functions to
      instantiate and teardown the nwfilters with a function in
      conf/domain_nwfilter.c called virDomainConfNWFilterRegister. Previous
      helper functions that were called from qemu_driver.c and qemu_conf.c
      were move into conf/domain_nwfilter.h with slight renaming done for
      consistency. Those functions now call the function expored by
      domain_nwfilter.c, which in turn call the functions of the new driver
      interface, if available.
      cab5a52a
  4. 21 6月, 2010 6 次提交
  5. 19 6月, 2010 1 次提交
    • S
      nwfilter: extensions of docs with · 7057f39c
      Stefan Berger 提交于
      As requested, here a couple of paragraphs about the recently added statematch attribute and some advanced (and tricky) traffic filtering topics.
      7057f39c
  6. 18 6月, 2010 8 次提交
  7. 17 6月, 2010 9 次提交
    • S
      nwfilter: use match target on incoming traffic · 2dce9701
      Stefan Berger 提交于
      The following patch enables the iptables match target to be used by
      default for incoming traffic. So far it has only be used for outgoing
      traffic.
      2dce9701
    • S
      macvtap: work-around for 2.6.32 and older kernels · 045a5722
      Stefan Berger 提交于
      This patch works around a recent extension of the netlink driver I had made use of when building the netlink messages. Unfortunately older kernels don't accept IFLA_IFNAME + name of interface as a replacement for the interface's index, so this patch now gets the interface index ifindex if it's not provided (ifindex <= 0).
      045a5722
    • J
      virsh: change printf() calls to vshPrint() · 07be2403
      Justin Clift 提交于
      Trivial fix changing printf() calls to vshPrint() where the ctl
      variable is available.
      07be2403
    • J
      virsh: improve help text for vol query commands · 7d38d7b4
      Justin Clift 提交于
      Improves the help text for vol-path, vol-name, and vol-key, which
      previously referred to volume UUIDs.
      
      Addresses BZ # 598365.
      7d38d7b4
    • J
      virsh: add pool support to vol-key command · 31495ef6
      Justin Clift 提交于
      Presently the vol-key command only supports being provided with
      a volume path.
      
      This patch adds support for providing it with a pool and volume
      identifier pair as well.
      
          virsh # vol-key --pool <pool-name-or-uuid> <vol-name-or-path>
      31495ef6
    • M
      Add several missing vir*Free calls in libvirtd's remote code · 08d42b52
      Matthias Bolte 提交于
      Justin Clift reported a problem with adding virStoragePoolIsPersistent
      to virsh's pool-info command, resulting in a strange problem. Here's
      an example:
      
          virsh # pool-create-as images_dir3 dir - - - - "/home/images2"
          Pool images_dir3 created
      
          virsh # pool-info images_dir3
          Name:           images_dir3
          UUID:           90301885-94eb-4ca7-14c2-f30b25a29a36
          State:          running
          Capacity:       395.20 GB
          Allocation:     30.88 GB
          Available:      364.33 GB
      
          virsh # pool-destroy images_dir3
          Pool images_dir3 destroyed
      
      At this point the images_dir3 pool should be gone (because it was
      transient) and we should be able to create a new pool with the same name:
      
          virsh # pool-create-as images_dir3 dir - - - - "/home/images2"
          Pool images_dir3 created
      
          virsh # pool-info images_dir3
          Name:           images_dir3
          UUID:           90301885-94eb-4ca7-14c2-f30b25a29a36
          error: Storage pool not found
      
      The new pool got the same UUID as the first one, but we didn't specify
      one. libvirt should have picked a random UUID, but it didn't.
      
      It turned out that virStoragePoolIsPersistent leaks a reference to the
      storage pool object (actually remoteDispatchStoragePoolIsPersistent does).
      As a result, pool-destroy doesn't remove the virStoragePool for the
      "images_dir3" pool from the virConnectPtr's storagePools hash on libvirtd's
      side. Then the second pool-create-as get's the stale virStoragePool object
      associated with the "images_dir3" name. But this object has the old UUID.
      
      This commit ensures that all get_nonnull_* and make_nonnull_* calls for
      libvirt objects are matched properly with vir*Free calls. This fixes the
      reference leaks and the reported problem.
      
      All remoteDispatch*IsActive and remoteDispatch*IsPersistent functions were
      affected. But also remoteDispatchDomainMigrateFinish2 was affected in the
      success path. I wonder why that didn't surface earlier. Probably because
      domainMigrateFinish2 is executed on the destination host and in the common
      case this connection is opened especially for the migration and gets closed
      after the migration is done. So there was no chance to run into a problem
      because of the leaked reference.
      08d42b52
    • M
      esx: Update case insensitive .vmx tests · 02d57c2b
      Matthias Bolte 提交于
      Commit b9efc7dc made virFileHasSuffix
      case insensitive. Honor this in the tests by switching vmdk to VMDK.
      02d57c2b
    • M
      b0f414c6
    • E
      phyp: sed cleanups · 02988742
      Eric Blake 提交于
      * src/phyp/phyp_driver.c (phypNumDomainsGeneric): Avoid glob
      collision by quoting sed argument.
      (phypDomainSetCPU): Avoid non-portable \+ in sed.
      (phypGetVIOSPartitionID, phypDiskType, phypListDomainsGeneric)
      (phypListDefinedDomains): Micro-optimize anchored substitutions.
      02988742
  8. 16 6月, 2010 1 次提交
  9. 15 6月, 2010 3 次提交
    • E
      virsh: add start --paused support · cbe6ebdb
      Eric Blake 提交于
      Make 'start --paused' mirror 'create --paused'.
      
      * tools/virsh.c (cmdStart): Use new virDomainCreateWithFlags API
      when needed.
      * tools/virsh.pod (start): Document --paused.
      cbe6ebdb
    • E
      qemu: support starting persistent domain paused · d024d2ba
      Eric Blake 提交于
      Match earlier change for qemu pause support with virDomainCreateXML.
      
      * src/qemu/qemu_driver.c (qemudDomainObjStart): Add parameter; all
      callers changed.
      (qemudDomainStartWithFlags): Implement flag support.
      d024d2ba
    • E
      drivers: add virDomainCreateWithFlags if virDomainCreate exists · de3aadaa
      Eric Blake 提交于
      * src/esx/esx_driver.c (esxDomainCreate): Move guts...
      (esxDomainCreateWithFlags): ...to new function.
      (esxDriver): Trivially support the new API.
      * src/lxc/lxc_driver.c (lxcDomainStart, lxcDomainStartWithFlags)
      (lxcDriver): Likewise.
      * src/opennebula/one_driver.c (oneDomainStart)
      (oneDomainStartWithFlags, oneDriver): Likewise.
      * src/openvz/openvz_driver.c (openvzDomainCreate)
      (openvzDomainCreateWithFlags, openvzDriver): Likewise.
      * src/qemu/qemu_driver.c (qemudDomainStart)
      (qemudDomainStartWithFlags, qemuDriver): Likewise.
      * src/test/test_driver.c (testDomainCreate)
      (testDomainCreateWithFlags, testDriver): Likewise.
      * src/uml/uml_driver.c (umlDomainStart, umlDomainStartWithFlags)
      (umlDriver): Likewise.
      * src/vbox/vbox_tmpl.c (vboxDomainCreate)
      (vboxDomainCreateWithFlags, Driver): Likewise.
      * src/xen/xen_driver.c (xenUnifiedDomainCreate)
      (xenUnifiedDomainCreateWithFlags, xenUnifiedDriver): Likewise.
      * src/xenapi/xenapi_driver.c (xenapiDomainCreate)
      (xenapiDomainCreateWithFlags, xenapiDriver): Likewise.
      de3aadaa