1. 01 12月, 2010 4 次提交
    • H
      Fall back to QEMUD_SAVE_FORMAT_RAW if compression method fails. · 1b6f13bb
      Hu Tao 提交于
      When dumping a domain, it's reasonable to save dump-file in raw format
      if dump format is misconfigured or the corresponding compress program
      is not available rather then fail dumping.
      1b6f13bb
    • S
      802.1Qbg: use pre-associate state at beginning of inc. migr · c2b38277
      Stefan Berger 提交于
      This patch introduces the usage of the pre-associate state of the IEEE 802.1Qbg standard on incoming VM migration on the target host. It is in response to bugzilla entry 632750.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=632750
      
      For being able to differentiate the exact reason as to why a macvtap device is being created, either due to a VM creation or an incoming VM migration, I needed to pass that reason as a parameter from wherever qemudStartVMDaemon is being called in order to determine whether to send an ASSOCIATE (VM creation) or a PRE-ASSOCIATE (incoming VM migration) towards lldpad.
      
      I am also fixing a problem with the virsh domainxml-to-native call on the way.
      
      Gerhard successfully tested the patch with a recent blade network 802.1Qbg-compliant switch.
      
      The patch should not have any side-effects on the 802.1Qbh support in libvirt, but Roopa (cc'ed) may want to verify this.
      c2b38277
    • G
      OpenVZ: Fix some overwritten error codes · 2d626c7d
      Guido Günther 提交于
      Don't overwrite errors during domain creation/definition to ease
      tracking down problems.
      2d626c7d
    • G
      OpenVZ: take veid from vmdef->name when defining new domains · 50a7c59b
      Guido Günther 提交于
      We currently use the next free veid although there's one given in the
      domain xml. This currently breaks defining new domains since vmdef->name
      and veid don't match leading to the following error later on:
      
          error: Failed to define domain from 110.xml
          error: internal error Could not set UUID
      
      Since silently ignoring vmdef->name is not nice respect it instead. We
      avoid veid collisions in the upper levels already.
      50a7c59b
  2. 30 11月, 2010 2 次提交
    • M
      Log client errors in libvirtd at debug priority · abff683f
      Matthias Bolte 提交于
      This reverts commit
      
       Log all errors at level INFO to stop polluting syslog
       04bd0360.
      
      and makes virRaiseErrorFull() log errors at debug priority
      when called from inside libvirtd. This stops libvirtd from
      polluting it's own log with client errors at error priority
      that'll be reported and logged on the client side anyway.
      abff683f
    • W
      correct the arguments of migrate_speed · 4f7162d1
      Wen Congyang 提交于
      When we set migrate_speed by json, we receive the following
      error message:
      libvirtError: internal error unable to execute QEMU command
      'migrate_set_speed': Invalid parameter type, expected: number
      
      The reason is that: the arguments of migrate_set_speed
      by json is json number, not json string.
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      4f7162d1
  3. 29 11月, 2010 1 次提交
  4. 25 11月, 2010 8 次提交
    • J
      Fix host CPU counting on unusual NUMA topologies · ac9dd4a6
      Jiri Denemark 提交于
      The nodeinfo structure includes
      
          nodes   : the number of NUMA cell, 1 for uniform mem access
          sockets : number of CPU socket per node
          cores   : number of core per socket
          threads : number of threads per core
      
      which does not work well for NUMA topologies where each node does not
      consist of integral number of CPU sockets.
      
      We also have VIR_NODEINFO_MAXCPUS macro in public libvirt.h which
      computes maximum number of CPUs as (nodes * sockets * cores * threads).
      
      As a result, we can't just change sockets to report total number of
      sockets instead of sockets per node. This would probably be the easiest
      since I doubt anyone is using the field directly. But because of the
      macro, some apps might be using sockets indirectly.
      
      This patch leaves sockets to be the number of CPU sockets per node (and
      fixes qemu driver to comply with this) on machines where sockets can be
      divided by nodes. If we can't divide sockets by nodes, we behave as if
      there was just one NUMA node containing all sockets. Apps interested in
      NUMA should consult capabilities XML, which is what they probably do
      anyway.
      
      This way, the only case in which apps that care about NUMA may break is
      on machines with funky NUMA topology. And there is a chance libvirt
      wasn't able to start any guests on those machines anyway (although it
      depends on the topology, total number of CPUs and kernel version).
      Nothing changes at all for apps that don't care about NUMA.
      ac9dd4a6
    • E
      security, storage: plug memory leaks for security_context_t · d95488dc
      Eric Blake 提交于
      security_context_t happens to be a typedef for char*, and happens to
      begin with a string usable as a raw context string.  But in reality,
      it is an opaque type that may or may not have additional information
      after the first NUL byte, where that additional information can
      include pointers that can only be freed via freecon().
      
      Proof is from this valgrind run of daemon/libvirtd:
      
      ==6028== 839,169 (40 direct, 839,129 indirect) bytes in 1 blocks are definitely lost in loss record 274 of 274
      ==6028==    at 0x4A0515D: malloc (vg_replace_malloc.c:195)
      ==6028==    by 0x3022E0D48C: selabel_open (label.c:165)
      ==6028==    by 0x3022E11646: matchpathcon_init_prefix (matchpathcon.c:296)
      ==6028==    by 0x3022E1190D: matchpathcon (matchpathcon.c:317)
      ==6028==    by 0x4F9D842: SELinuxRestoreSecurityFileLabel (security_selinux.c:382)
      
      800k is a lot of memory to be leaking.
      
      * src/storage/storage_backend.c
      (virStorageBackendUpdateVolTargetInfoFD): Avoid leak on error.
      * src/security/security_selinux.c
      (SELinuxReserveSecurityLabel, SELinuxGetSecurityProcessLabel)
      (SELinuxRestoreSecurityFileLabel): Use correct function to free
      security_context_t.
      d95488dc
    • E
      network: plug memory leak · d90babe9
      Eric Blake 提交于
      * src/conf/network_conf.c (virNetworkDHCPRangeDefParseXML): Free
      xml strings when no longer referenced.
      d90babe9
    • E
      maint: prohibit most uses of xmlGetProp · 416c09bc
      Eric Blake 提交于
      Making this change makes it easier to spot the memory leaks
      that will be fixed in the next patch.
      
      * cfg.mk (sc_prohibit_xmlGetProp): New rule.
      * .x-sc_prohibit_xmlGetProp: New exception.
      * Makefile.am (EXTRA_DIST): Ship exception file.
      * tools/virsh.c (cmdDetachInterface, cmdDetachDisk): Adjust
      offenders.
      * src/conf/storage_conf.c (virStoragePoolDefParseSource):
      Likewise.
      * src/conf/network_conf.c (virNetworkDHCPRangeDefParseXML)
      (virNetworkIPParseXML): Likewise.
      416c09bc
    • E
      qemu: plug memory leak · 117246e0
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=656795
      
      * src/qemu/qemu_monitor.c (qemuMonitorFree): Also free the buffer.
      117246e0
    • E
      build: enforce files.h usage · f1fe9671
      Eric Blake 提交于
      * cfg.mk (sc_prohibit_close): New syntax-check rule.
      * src/util/pci.c (pciWaitForDeviceCleanup): Fix violation.
      * .x-sc_prohibit_close: New exceptions.
      * Makefile.am (EXTRA_DIST): Distribute new file.
      f1fe9671
    • M
      Always close drivers when a virConnectPtr is released · d8b36749
      Matthias Bolte 提交于
      virConnectClose calls virUnrefConnect which in turn closes
      all open drivers when the refcount of that connection dropped
      to zero. This works fine when you free all other objects that
      hold a ref to the connection before you close it, because in
      this case virUnrefConnect is the one that removes the last
      ref to the connection.
      
      But it doesn't work when you close the connection first before
      freeing the other objects. This is because the other virUnref*
      functions call virReleaseConnect when they detect that the
      connection's refcount dropped to zero. In this case another
      virUnref* function (different from virUnrefConnect) removes the
      last ref to the connection. This results in not closing the
      open drivers and leaking things that should have been cleaned
      up in the driver close functions.
      
      To fix this move the driver close calls to virReleaseConnect.
      d8b36749
    • O
      Implementations of virDomainIsUpdated for drivers except qemu · f3605b33
      Osier Yang 提交于
      Except LXC and UML driver, implementations of all other drivers
      simply return 0, because these drivers doesn't have config both
      in memory and on disk, no need to track if the domain of these
      drivers updated or not.
      
      Rename "xenUnifiedDomainisPersistent" to "xenUnifiedDomainIsPersistent"
      
      * esx/esx_driver.c
      * lxc/lxc_driver.c
      * opennebula/one_driver.c
      * openvz/openvz_driver.c
      * phyp/phyp_driver.c
      * test/test_driver.c
      * uml/uml_driver.c
      * vbox/vbox_tmpl.c
      * xen/xen_driver.c
      * xenapi/xenapi_driver.c
      f3605b33
  5. 24 11月, 2010 7 次提交
    • O
      implement callback function for qemu driver · c1fb9166
      Osier Yang 提交于
      * src/qemu/qemu_driver.c (add function qemuDomainIsUpdated)
      c1fb9166
    • O
      implement the remote protocol · 313215e1
      Osier Yang 提交于
      * daemon/remote.c
      * daemon/remote_dispatch_args.h
      * daemon/remote_dispatch_prototypes.h
      * daemon/remote_dispatch_ret.h
      * daemon/remote_dispatch_table.h
      * src/remote/remote_driver.c
      * src/remote/remote_protocol.c
      * src/remote/remote_protocol.h
      * src/remote/remote_protocol.x
      * src/remote_protocol-structs
      313215e1
    • O
      implement public API virDomainIsUpdated · 20a017df
      Osier Yang 提交于
      * src/libvirt.c
      20a017df
    • O
      define internal driver API · 37a02efd
      Osier Yang 提交于
      * src/driver.h (new typedef, new callback member for "_virDriver")
      * src/esx/esx_driver.c
      * src/lxc/lxc_driver.c
      * src/opennebula/one_driver.c
      * src/openvz/openvz_driver.c
      * src/phyp/phyp_driver.c
      * src/qemu/qemu_driver.c
      * src/remote/remote_driver.c
      * src/test/test_driver.c
      * src/uml/uml_driver.c
      * src/vbox/vbox_tmpl.c
      * src/xen/xen_driver.c
      * src/xenapi/xenapi_driver.c
      37a02efd
    • O
      virDomainIsUpdated: define the new public API · 347d73f2
      Osier Yang 提交于
      introduce new public API "virDomainIsUpdated"
      
      * src/conf/domain_conf.h (new member "updated" for "virDomainObj")
      * src/libvirt_public.syms
      * include/libvirt/libvirt.h.in
      347d73f2
    • E
      maint: sort exports · 2ed149a6
      Eric Blake 提交于
      * src/libvirt_private.syms (buf.h): Sort.
      2ed149a6
    • M
      remote: Fix TLS transport on Windows · 9abe1e43
      Matthias Bolte 提交于
      gnulib wraps Windows' SOCKET handle based send() and recv() functions
      into file descriptor based ones that are used in libvirt.
      
      Even though GnuTLS is using gnulib too, it explicitly doesn't use
      gnulib's replacement functions on Windows. By default GnuTLS uses the
      SOCKET handle based send() and recv(). This makes gnutls_handshake()
      fail internally with a WSAENOTSOCK error because libvirt passes a
      file descriptor; GnuTLS needs the SOCKET handle.
      
      To avoid this mismatch make sure that GnuTLS uses gnulib's replacment
      functions, by setting custom pull() and push() functions for GnuTLS.
      9abe1e43
  6. 23 11月, 2010 18 次提交
    • D
      Rename 'remove' param to 'toremove' to avoid clash with stdio.h · c73bd6f3
      Daniel P. Berrange 提交于
      The stdio.h header has a function called 'remove' declared. This
      clashes with the 'remove' parameter in virShrinkN
      
      * src/util/memory.c: Rename 'remove' to 'toremove'
      c73bd6f3
    • D
      Fix 32-bit int truncation in QED header check · f86c7801
      Daniel P. Berrange 提交于
      * src/util/memory.c: Avoid 32-bit truncation extracting a 64bit int
      f86c7801
    • D
      Improve SCSI volume name generation · 174d737d
      Daniel P. Berrange 提交于
      The SCSI volumes currently get a name like '17:0:0:1' based
      on $host:$bus:$target:$lun. The names are intended to be unique
      per pool and stable across pool restarts. The inclusion of the
      $host component breaks this, because the $host number for iSCSI
      pools is dynamically allocated by the kernel at time of login.
      This changes the name to be 'unit:0:0:1', ie removes the leading
      host component. The 'unit:' prefix is just to ensure the volume
      name doesn't start with a number and make it clearer when seen
      out of context.
      
      * src/storage/storage_backend_scsi.c: Improve volume name
        field value stability and uniqueness
      174d737d
    • D
      Fix error codes returned when a storage pool is inactive · e4c97a10
      Daniel P. Berrange 提交于
      Many operations are not valid on inactive storage pools. The
      storage driver is currently returning VIR_ERR_INTERNAL_ERROR
      in these cases, rather than the more suitable error code
      VIR_ERR_OPERATION_INVALID
      
      * src/storage/storage_driver.c: Fix error code when pool
        is not active
      e4c97a10
    • D
      Check whether pools are already active upon libvirtd startup · 1b7e0b1a
      Daniel P. Berrange 提交于
      When libvirt starts up all storage pools default to the inactive
      state, even if the underlying storage is already active on the
      host. This introduces a new API into the internal storage backend
      drivers that checks whether a storage pool is already active. If
      the pool is active at libvirtd startup, the volume list will be
      immediately populated.
      
      * src/storage/storage_backend.h: New internal API for checking
        storage pool state
      * src/storage/storage_driver.c: Check whether a pool is active
        upon driver startup
      * src/storage/storage_backend_fs.c, src/storage/storage_backend_iscsi.c,
        src/storage/storage_backend_logical.c, src/storage/storage_backend_mpath.c,
        src/storage/storage_backend_scsi.c: Add checks for pool state
      1b7e0b1a
    • D
      Add support for iSCSI target auto-discovery · 1da8c567
      Daniel P. Berrange 提交于
      Since the previous patch added support for parsing the output of
      the 'sendtargets' command, it is now trivial to support the
      storage pool discovery API.
      
      Given a hostname and optional portnumber and initiator IQN,
      the code can return a full list of storage pool source docs,
      each one representing a iSCSI target.
      
      * src/storage/storage_backend_iscsi.c: Wire up target
        auto-discovery
      1da8c567
    • D
      Stop iSCSI targets automatically logging back in after logout · 3c12b654
      Daniel P. Berrange 提交于
      The Linux iSCSI initiator toolchain has the dubious feature that
      if you ever run the 'sendtargets' command to merely query what
      targets are available from a server, the results will be recorded
      in /var/lib/iscsi. Any time the '/etc/init.d/iscsi' script runs
      in the future, it will then automatically login to all those
      targets. /etc/init.d/iscsi is automatically run whenever a NIC
      comes online.
      
      So from the moment you ask a server what targets are available,
      your client will forever more automatically try to login to all
      targets without ever asking if you actually want it todo this.
      
      To stop this stupid behaviour, we need to run
      
        iscsiadm --portal $PORTAL --target $TARGET
         --op update --name node.startup --value manual
      
      For every target on the server.
      
      * src/storage/storage_backend_iscsi.c: Disable automatic login
        for targets found as a result of a 'sendtargets' command
      3c12b654
    • D
      Refactor iSCSI driver code to facilitate future changes · 59446096
      Daniel P. Berrange 提交于
      The following series of patches are adding significant
      extra functionality to the iSCSI driver. THe current
      internal helper methods are not sufficiently flexible
      to cope with these changes. This patch refactors the
      code to avoid needing to have a virStoragePoolObjPtr
      instance as a parameter, instead passing individual
      target, portal and initiatoriqn parameters.
      
      It also removes hardcoding of port 3260 in the portal
      address, instead using the XML value if any.
      
      * src/storage/storage_backend_iscsi.c: Refactor internal
        helper methods
      59446096
    • D
      Fix parsing of port attribute in storage XML configuration · b6e5a0a2
      Daniel P. Berrange 提交于
      The XML docs describe a 'port' attribute for the
      storage source <host> element, but the parser never
      handled it.
      
      * docs/schemas/storagepool.rng: Define port attribute
      * src/conf/storage_conf.c: Add missing parsing/formatting
        of host port number
      * src/conf/storage_conf.h: Remove bogus/unused 'protocol' field
      b6e5a0a2
    • D
      Ensure logfile isn't truncated by shutdown message. · 7f9cebc0
      Daniel P. Berrange 提交于
      When running non-root, the QEMU log file is usually opened with
      truncation, since there is no logrotate for non-root usage.
      This means that when libvirt logs the shutdown timestamp, the
      log is accidentally truncated
      
      * src/qemu/qemu_driver.c: Never truncate log file with shutdown
        message
      7f9cebc0
    • D
      Remove trailing ':' from timestamp · dbf405bf
      Daniel P. Berrange 提交于
      The QEMU logger appends a ':' to the timestamp when it deems
      it neccessary, so the virTimestamp API should not duplicate
      this
      
      * src/util/util.c: Remove trailing ':' from timestamp
      dbf405bf
    • D
      Log all errors at level INFO to stop polluting syslog · 04bd0360
      Daniel P. Berrange 提交于
      Everytime a public API returns an error, libvirtd pollutes
      syslog with that error message. Reduce the error logging
      level to INFO so these don't appear by default.
      
      * src/util/virterror.c: Log all errors at INFO
      04bd0360
    • D
      Ensure virExec preserves logging environment · 882f78c3
      Daniel P. Berrange 提交于
      The virFork call resets all logging handlers that may have been
      set. Re-enable them after fork in virExec, so that env variables
      fir LIBVIRT_LOG_OUTPUTS and LIBVIRT_LOG_FILTERS take effect
      until the execve()
      
      * src/util/util.c: Preserve logging in child in virExec
      882f78c3
    • D
      Include a thread identifier in log messages · 9288c31b
      Daniel P. Berrange 提交于
      To allow messages from different threads to be untangled,
      include an integer thread identifier in log messages.
      
      * src/util/logging.c: Include thread ID
      * src/util/threads.h, src/util/threads.h, src/util/threads-pthread.c:
        Add new virThreadSelfID() function
      * configure.ac: Check for sys/syscall.h
      9288c31b
    • C
      qemu: setvcpus: Save config changes to disk · 388fa625
      Cole Robinson 提交于
      Currently changes to the persistent config aren't flushed to disk, meaning
      they are lost if the domain is redefined or libvirtd is restarted.
      388fa625
    • C
      qemu: setvcpus: Simplify altering the persistent config · 39b62654
      Cole Robinson 提交于
      Do this by adding a helper function to get the persistent domain config. This
      should be useful for other functions that may eventually want to alter
      the persistent domain config (attach/detach device). Also make similar changes
      to the test drivers setvcpus command.
      
      A caveat is that the function will return the running config for a transient
      domain, rather than error. This simplifies callers, as long as they use
      other methods to ensure the guest is persistent.
      39b62654
    • C
      qemu: setvcpus: Fix maxvcpus check · d7520291
      Cole Robinson 提交于
      Doing 'virsh setvcpus $vm --config 10' doesn't check the value against the
      domains maxvcpus value. A larger value for example will prevent the guest
      from starting.
      
      Also make a similar change to the test driver.
      d7520291
    • C
      conf: domain: Improve vcpus validation reporting · 81e6f68d
      Cole Robinson 提交于
      81e6f68d