1. 13 7月, 2011 26 次提交
    • E
      storage: reject unknown flags · 64bd1b9d
      Eric Blake 提交于
      * src/storage/storage_backend.c (virStorageBackendCreateBlockFrom)
      (virStorageBackendCreateQemuImg)
      (virStorageBackendCreateQcowCreate): Reject unknown flags.
      * src/storage/storage_backend_disk.c (virStorageBackendDiskBuildPool)
      (virStorageBackendDiskDeleteVol): Likewise.
      * src/storage/storage_backend_fs.c
      (virStorageBackendFileSystemNetFindPoolSources)
      (virStorageBackendFileSystemBuild)
      (virStorageBackendFileSystemDelete, createFileDir)
      (virStorageBackendFileSystemVolBuildFrom)
      (virStorageBackendFileSystemVolDelete): Likewise.
      * src/storage/storage_backend_iscsi.c
      (virStorageBackendISCSIFindPoolSources): Likewise.
      * src/storage/storage_backend_logical.c
      (virStorageBackendLogicalFindPoolSources)
      (virStorageBackendLogicalBuildPool)
      (virStorageBackendLogicalDeletePool)
      (virStorageBackendLogicalDeleteVol): Likewise.
      * src/storage/storage_driver.c (storageOpen, storagePoolCreate)
      (storagePoolDefine, storagePoolRefresh, storagePoolGetXMLDesc)
      (storageVolumeCreateXML, storageVolumeCreateXMLFrom)
      (storageVolumeGetXMLDesc): Likewise.
      64bd1b9d
    • E
      node_device: reject unknown flags · ba78d2cf
      Eric Blake 提交于
      * src/node_device/node_device_driver.c (nodeNumOfDevices)
      (nodeListDevices, nodeDeviceGetXMLDesc, nodeDeviceCreateXML):
      Reject unknown flags.
      * src/node_device/node_device_hal.c (halNodeDrvOpen): Likewise.
      * src/node_device/node_device_udev.c (udevNodeDrvOpen): Likewise.
      ba78d2cf
    • E
      util: reject unknown flags, and prefer unsigned flags · 833fe8ab
      Eric Blake 提交于
      Silently ignored flags get in the way of new features that
      use those flags.  Also, an upcoming syntax check will favor
      unsigned flags.
      
      * src/nodeinfo.h (nodeGetCPUStats, nodeGetMemoryStats): Drop
      unused attribute.
      * src/interface/netcf_driver.c (interfaceOpenInterface)
      (interfaceDefineXML, interfaceCreate, interfaceDestroy): Reject
      unknown flags.
      * src/network/bridge_driver.c (networkOpenNetwork)
      (networkGetXMLDesc): Likewise.
      * src/nwfilter/nwfilter_driver.c (nwfilterOpen): Likewise.
      * src/secret/secret_driver.c (secretOpen, secretDefineXML)
      (secretGetXMLDesc, secretSetValue): Likewise.
      * src/util/logging.c (virLogDefineFilter, virLogDefineOutput)
      (virLogMessage): Likewise; also use unsigned flags.
      * src/util/logging.h (virLogDefineFilter, virLogDefineOutput)
      (virLogMessage): Change signature.
      * src/util/command.c (virExecWithHook): Likewise.
      833fe8ab
    • E
      libvirt-qemu: use unsigned flags · 01ed9b56
      Eric Blake 提交于
      Like commit 1740c381, but for libvirt-qemu.
      
      * src/remote/qemu_protocol.x (qemu_monitor_command_args): Adjust
      type to match API.
      * src/qemu_protocol-structs: Update accordingly.
      01ed9b56
    • E
      maint: print flags in hex during debug · 06dbfa6d
      Eric Blake 提交于
      Continuation of commit 313ac7fd, and enforce things with a syntax
      check.
      
      Technically, virNetServerClientCalculateHandleMode is not printing
      a mode_t, but rather a collection of VIR_EVENT_HANDLE_* bits;
      however, these bits are < 8, so there is no different in the
      output, and that was the easiest way to silence the new syntax check.
      
      * cfg.mk (sc_flags_debug): New syntax check.
      (exclude_file_name_regexp--sc_flags_debug): Add exemptions.
      * src/fdstream.c (virFDStreamOpenFileInternal): Print flags in
      hex, mode_t in octal.
      * src/libvirt-qemu.c (virDomainQemuMonitorCommand)
      (virDomainQemuAttach): Likewise.
      * src/locking/lock_driver_nop.c (virLockManagerNopInit): Likewise.
      * src/locking/lock_driver_sanlock.c (virLockManagerSanlockInit):
      Likewise.
      * src/locking/lock_manager.c: Likewise.
      * src/qemu/qemu_migration.c: Likewise.
      * src/qemu/qemu_monitor.c: Likewise.
      * src/rpc/virnetserverclient.c
      (virNetServerClientCalculateHandleMode): Print mode with %o.
      06dbfa6d
    • E
      maint: exclude more files from syntax check · 017b8405
      Eric Blake 提交于
      * cfg.mk (VC_LIST_ALWAYS_EXCLUDE_REGEX): Exempt
      docs/api_extension/*.patch.
      (exclude_file_name_regexp--sc_prohibit_always_true_header_tests)
      (exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF)
      (exclude_file_name_regexp--sc_prohibit_fork_wrappers)
      (exclude_file_name_regexp--sc_trailing_blank): Simplify.
      (exclude_file_name_regexp--sc_prohibit_gettext_noop): Delete.
      (exclude_file_name_regexp--sc_prohibit_close)
      (exclude_file_name_regexp--sc_prohibit_nonreentrant)
      (exclude_file_name_regexp--sc_prohibit_sprintf): Tighten.
      017b8405
    • E
      util: honor anchored names when searching for executables · 51fc5655
      Eric Blake 提交于
      I got bit in a debugging session on an uninstalled libvirtd; the
      code tried to call out to the installed $LIBEXECDIR/libvirt_iohelper
      instead of my just-built version.  So I set a breakpoint and altered
      the binary name to be "./src/libvirt_iohelper", and it still failed
      because I don't have "." on my PATH.
      
      According to POSIX, execvp only searches PATH if the name does
      not contain a slash.  Since we are trying to mimic that behavior,
      an anchored name should be relative to the current working dir.
      
      This tightens existing behavior, but most callers already pass
      an absolute name or a name with no slashes, so it probably won't
      be noticeable.
      
      * src/util/util.c (virFindFileInPath): Anchored relative names do
      not invoke a PATH search.
      51fc5655
    • D
      Ensure signal handler propagates fatal signals to default handler · 83d768fa
      Daniel P. Berrange 提交于
      When replacing the default SEGV/ABORT/BUS signal handlers you
      can't rely on the process being terminated after your custom
      handler runs. It is neccessary to manually restore the default
      handler and then re-raise the signal
      
      * src/rpc/virnetserver.c: Restore default handler and raise
        signal
      83d768fa
    • D
      Remove unused virNetServerProgramErrorHander typedef · 1a81687a
      Daniel P. Berrange 提交于
      * src/rpc/virnetserverprogram.h: Remove unused typedef for
        virNetServerProgramErrorHander function callback
      * daemon/remote.h: Remove decl for non-existant variables
      1a81687a
    • J
      qemu: Fix monitor unlocking in some error paths · a23476f0
      Jiri Denemark 提交于
      When monitor is entered with qemuDomainObjEnterMonitorWithDriver, the
      correct method for leaving and unlocking the monitor is
      qemuDomainObjExitMonitorWithDriver.
      a23476f0
    • J
      qemu: Consolidate qemuMigrationPrepare{Direct,Tunnel} · 307656b4
      Jiri Denemark 提交于
      Most of the code in these two functions is supposed to be identical but
      currently it isn't (which is natural since the code is duplicated).
      Let's move common parts of these functions into qemuMigrationPrepareAny.
      
      This also fixes qemuMigrationPrepareTunnel which didn't store received
      lockState in the domain object.
      307656b4
    • J
      qemu: Add support for job phase · 5b2d0bbc
      Jiri Denemark 提交于
      Asynchronous jobs may take long time to finish and may consist of
      several phases which we need to now about to help with recovery/rollback
      after libvirtd restarts.
      5b2d0bbc
    • J
      qemu: Recover from interrupted jobs · e6704af1
      Jiri Denemark 提交于
      Detect and react on situations when libvirtd was restarted or killed
      when a job was active.
      e6704af1
    • J
      qemu: Save job type in domain status XML · ff340a84
      Jiri Denemark 提交于
      If libvirtd is restarted when a job is running, the new libvirtd process
      needs to know about that to be able to recover and rollback the
      operation.
      ff340a84
    • J
      qemu: Allow all query commands to be run during long jobs · 36184288
      Jiri Denemark 提交于
      Query commands are safe to be called during long running jobs (such as
      migration). This patch makes them all work without the need to
      special-case every single one of them.
      
      The patch introduces new job.asyncCond condition and associated
      job.asyncJob which are dedicated to asynchronous (from qemu monitor
      point of view) jobs that can take arbitrarily long time to finish while
      qemu monitor is still usable for other commands.
      
      The existing job.active (and job.cond condition) is used all other
      synchronous jobs (including the commands run during async job).
      
      Locking schema is changed to use these two conditions. While asyncJob is
      active, only allowed set of synchronous jobs is allowed (the set can be
      different according to a particular asyncJob) so any method that
      communicates to qemu monitor needs to check if it is allowed to be
      executed during current asyncJob (if any). Once the check passes, the
      method needs to normally acquire job.cond to ensure no other command is
      running. Since domain object lock is released during that time, asyncJob
      could have been started in the meantime so the method needs to recheck
      the first condition. Then, normal jobs set job.active and asynchronous
      jobs set job.asyncJob and optionally change the list of allowed job
      groups.
      
      Since asynchronous jobs only set job.asyncJob, other allowed commands
      can still be run when domain object is unlocked (when communicating to
      remote libvirtd or sleeping). To protect its own internal synchronous
      commands, the asynchronous job needs to start a special nested job
      before entering qemu monitor. The nested job doesn't check asyncJob, it
      only acquires job.cond and sets job.active to block other jobs.
      36184288
    • J
      qemu: Consolidate {Enter,Exit}Monitor{,WithDriver} · 24f717ac
      Jiri Denemark 提交于
      EnterMonitor and ExitMonitor methods are very similar to their
      *WithDriver variants; consolidate them into EnterMonitorInternal and
      ExitMonitorInternal to avoid (mainly future) code duplication.
      24f717ac
    • J
      qemu: Consolidate BeginJob{,WithDriver} into a single method · cec1d280
      Jiri Denemark 提交于
      This avoids code duplication and also avoids relying on good luck that
      ignore_value(virDomainObjUnref(obj)) doesn't set errno.
      cec1d280
    • J
      qemu: Separate job related data into a new object · 90a422f0
      Jiri Denemark 提交于
      90a422f0
    • E
      maint: avoid incremental 'make syntax-check' failure · 0583825f
      Eric Blake 提交于
      Incrementally running 'make syntax-check' on a tree previously
      built after commit 62dee6fa but before 44036460 fails sc_po_check
      (because the generated qemu_dispatch.h gained translatable strings).
      This is a followup to commit addaa537 for that scenario.
      
      * cfg.mk (sc_po_check): Add another prereq.
      ($(srcdir)/daemon/qemu_dispatch.h): Add rule.
      0583825f
    • D
      Skip bugs which are CLOSED in todo list · 52312385
      Daniel P. Berrange 提交于
      * docs/todo.pl: Skip closed bugs
      52312385
    • D
      Add missing cleanup for transient guests in UML driver · 65d68f62
      Daniel P. Berrange 提交于
      The UML inotify handler would kill off guests when certain
      conditions arise, but it forgot to remove transient guests
      from the list of domains
      
      * src/uml/uml_driver.c: Cleanup transient guests
      65d68f62
    • D
      Add auditing to the UML driver · f0c7103d
      Daniel P. Berrange 提交于
      * src/uml/uml_driver.c: Add audit hooks
      f0c7103d
    • D
      Add auditing to the LXC driver · 7d612c30
      Daniel P. Berrange 提交于
      * src/lxc/lxc_driver.c: Add auditing hooks
      7d612c30
    • D
      Add virtualization type in audit messages · 839f47b5
      Daniel P. Berrange 提交于
      Since a host can run several different virtualization types at
      the same time, audit messages should allow domains to be identified.
      Add a 'virt={qemu,kvm,uml,lxc,...}' key to domain audit messages
      
      * src/conf/domain_audit.c: Identify virt type of guest
      839f47b5
    • D
      Add auditing of filesystems · e6e90c8d
      Daniel P. Berrange 提交于
      When passing through filesystems from the host to a guest, the
      host filesystem passed must be audited
      
      * src/conf/domain_audit.{c,h}: Add virDomainAuditFS
      e6e90c8d
    • D
      Move qemu_audit.h helpers into shared code · b43070eb
      Daniel P. Berrange 提交于
      The LXC and UML drivers can both make use of auditing. Move
      the qemu_audit.{c,h} files to src/conf/domain_audit.{c,h}
      
      * src/conf/domain_audit.c: Rename from src/qemu/qemu_audit.c
      * src/conf/domain_audit.h: Rename from src/qemu/qemu_audit.h
      * src/Makefile.am: Remove qemu_audit.{c,h}, add domain_audit.{c,h}
      * src/qemu/qemu_audit.h, src/qemu/qemu_cgroup.c,
        src/qemu/qemu_command.c, src/qemu/qemu_driver.c,
        src/qemu/qemu_hotplug.c, src/qemu/qemu_migration.c,
        src/qemu/qemu_process.c: Update for changed audit API names
      b43070eb
  2. 12 7月, 2011 14 次提交
    • M
      esx: Initialize all instances of esxVMX_Data to zero · 38ea116e
      Matthias Bolte 提交于
      To avoid using or freeing uninitialized memory or pointers.
      38ea116e
    • M
      rpc: Fix compile error due to potentially unused parameter · b2534529
      Matthias Bolte 提交于
      connectDBus is only used if HAVE_DBUS is set. Therefore mark
      it as potentially unused.
      b2534529
    • J
      Fix build when using polkit0 · b8adfcc6
      Jim Fehlig 提交于
      V2: Remove policy kit references from virNetServer and use DBus APIs
          directly, if available.
      b8adfcc6
    • D
      Implement code to attach to external QEMU instances. · 109efd79
      Daniel P. Berrange 提交于
      Given a PID, the QEMU driver reads /proc/$PID/cmdline and
      /proc/$PID/environ to get the configuration. This is fed
      into the ARGV->XML convertor to build an XML configuration
      for the process.
      
      /proc/$PID/exe is resolved to identify the full command
      binary path
      
      After checking for name/uuid uniqueness, an attempt is
      made to connect to the monitor socket. If successful
      then 'info status' and 'info kvm' are issued to determine
      whether the CPUs are running and if KVM is enabled.
      
      * src/qemu/qemu_driver.c: Implement virDomainQemuAttach
      * src/qemu/qemu_process.h, src/qemu/qemu_process.c: Add
        qemuProcessAttach to connect to the monitor of an
        existing QEMU process
      109efd79
    • D
      Add monitor API for checking whether KVM is enabled · 7760eaa0
      Daniel P. Berrange 提交于
      When attaching to an external QEMU process, it is neccessary
      to check if the process is using KVM or not. This can be done
      using a monitor command
      
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
        src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add
        API for checking if KVM is enabled
      7760eaa0
    • D
      Add a method for extracting QEMU argv from /proc · 80a4ee46
      Daniel P. Berrange 提交于
      To enable attaching to externally launched QEMU, we need
      to be able to reverse engineer a guest XML config based
      on the argv for a PID in /proc
      
      * src/qemu/qemu_command.c, src/qemu/qemu_command.h: Add
        qemuParseCommandLinePid which extracts QEMU config from
        argv in /proc, given a PID number
      80a4ee46
    • D
      Change extract pidfile & monitor config from QEMU command line · ebbae359
      Daniel P. Berrange 提交于
      When converting QEMU argv into a virDomainDefPtr, also extract
      the pidfile, monitor character device config and the monitor
      mode.
      
      * src/qemu/qemu_command.c, src/qemu/qemu_command.h: Extract
        pidfile & monitor config from QEMU argv
      * src/qemu/qemu_driver.c, tests/qemuargv2xmltest.c: Add extra
        params when calling qemuParseCommandLineString
      ebbae359
    • D
      Keep pidfile path in qemuDomainObjPrivate struct · accfe952
      Daniel P. Berrange 提交于
      Avoid re-formatting the pidfile path everytime we need it. Create
      it once when starting the guest, and preserve it until the guest
      is shutdown.
      
      * src/libvirt_private.syms, src/util/util.c,
        src/util/util.h: Add virFileReadPidPath
      * src/qemu/qemu_domain.h: Add pidfile field
      * src/qemu/qemu_process.c: Store pidfile path in qemuDomainObjPrivate
      accfe952
    • D
      Add a new 'virsh qemu-attach' command. · eb7be6a6
      Daniel P. Berrange 提交于
      This command allows libvirt to attach to an existing QEMU
      instance.
      
       $ qemu-kvm -cdrom ~/demo.iso \
           -monitor unix:/tmp/demo,server,nowait \
           -name foo \
           -uuid cece4f9f-dff0-575d-0e8e-01fe380f12ea  &
       $ QEMUPID=$!
       $ virsh qemu-attach $QEMUPID
      eb7be6a6
    • D
      Define remote wire protocol & impls for virDomainQemuAttach · 44036460
      Daniel P. Berrange 提交于
      This tweaks the RPC generator to cope with some naming
      conventions used for the QEMU specific APIs
      
      * daemon/remote.c: Server side dispatcher
      * src/remote/remote_driver.c: Client side dispatcher
      * src/remote/qemu_protocol.x: Wire protocol definition
      * src/rpc/gendispatch.pl: Use '$structprefix' in method
        names, fix QEMU flags and fix dispatcher method names
      44036460
    • D
      Define a QEMU specific API to attach to a running QEMU process · 639f8413
      Daniel P. Berrange 提交于
      Introduce a new API in libvirt-qemu.so
      
       virDomainPtr virDomainQemuAttach(virConnectPtr domain,
                                        unsigned long long pid,
                                        unsigned int flags);
      
      This allows libvirtd to attach to an existing, externally
      launched QEMU process. This is useful for QEMU developers who
      prefer to launch QEMU themselves for debugging/devel reasons,
      but still want the benefit of libvirt based tools like
      virt-top, virt-viewer, etc
      
      * include/libvirt/libvirt-qemu.h: Define virDomainQemuAttach
      * src/driver.h, src/libvirt-qemu.c, src/libvirt_qemu.syms:
        Driver glue for virDomainQemuAttach
      639f8413
    • A
      qemu: update configuration file · 9c5b1900
      Alex Jia 提交于
      * src/qemu/qemu.conf: Add blkio controller into qemu.conf.
      9c5b1900
    • E
      qemu: avoid fd leak on core dump failure · f532bfa2
      Eric Blake 提交于
      * src/qemu/qemu_driver.c (doCoreDump): Guarantee fd is closed.
      f532bfa2
    • E
      maint: rename virtaudit to match file contents · 2ceb35e1
      Eric Blake 提交于
      * src/util/virtaudit.[ch]: Rename...
      * src/util/viraudit.[ch]: ...to match virAudit* API.
      * src/Makefile.am (UTIL_SOURCES): Reflect rename.
      * daemon/libvirtd.c: Likewise.
      * po/POTFILES.in: Likewise.
      * src/libvirt_private.syms: Likewise.
      * src/qemu/qemu_audit.c: Likewise.
      2ceb35e1