1. 16 9月, 2011 2 次提交
    • J
      qemu: Fix shutoff reason when domain crashes · 3acb664c
      Jiri Denemark 提交于
      Commit 4454a9ef changed shutoff reason
      from VIR_DOMAIN_SHUTOFF_CRASHED to VIR_DOMAIN_SHUTOFF_FAILED in case we
      see an unexpected EOF on monitor connection. But FAILED reason is
      dedicated for domains that fail to start. CRASHED reason is the right
      one to use in this situation.
      3acb664c
    • S
      Fix buzzilla 738778 · 3f2cb3ab
      Stefan Berger 提交于
      This patch fixes the bug shown in bugzilla 738778. It's not an nwfilter problem but a connection sharing / closure issue.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=738778
      
      Depending on the speed / #CPUs of the machine you are using you may not see this bug all the time.
      3f2cb3ab
  2. 06 9月, 2011 3 次提交
    • P
      link-state: qemu: Add net intf modification to virUpdateDeviceFlags · e0a07bb1
      Peter Krempa 提交于
      This patch enables modifying network device configuration using the
      virUpdateDeviceFlags API method. Matching of devices is accomplished
      using MAC addresses.
      
      While updating live configuration of a running domain, the user is
      allowed only to change link state of the interface. Additional
      modifications may be added later. For now the code checks for
      unsupported changes and thereafter changes the link state, if
      applicable.
      
      When updating persistent configuration of guest's network interface the
      whole configuration (except for the MAC address) may be modified and
      is stored for the next startup.
      
      * src/qemu/qemu_driver.c   - Add dispatching of virUpdateDevice for
                                   network devices update (live/config)
      * src/qemu/qemu_hotplug.c  - add setting of initial link state on live
                                   device addition
                                 - add function to change network device
                                   configuration. By now it supports only
                                   changing of link state
      * src/qemu/qemu_hotplug.h  - Headers to above functions
      * src/qemu/qemu_process.c  - set link states before virtual machine
                                   start. Qemu does not support setting of
                                   this on the command line.
      e0a07bb1
    • M
      qemu: Deal with stucked qemu on daemon startup · d38897a5
      Michal Privoznik 提交于
      If libvirt daemon gets restarted and there is (at least) one
      unresponsive qemu, the startup procedure hangs up. This patch creates
      one thread per vm in which we try to reconnect to monitor. Therefore,
      blocking in one thread will not affect other APIs.
      d38897a5
    • M
      daemon: Create priority workers pool · 597fe3ce
      Michal Privoznik 提交于
      This patch annotates APIs with low or high priority.
      In low set MUST be all APIs which might eventually access monitor
      (and thus block indefinitely). Other APIs may be marked as high
      priority. However, some must be (e.g. domainDestroy).
      
      For high priority calls (HPC), there are some high priority workers
      (HPW) created in the pool. HPW can execute only HPC, although normal
      worker can process any call regardless priority. Therefore, only those
      APIs which are guaranteed to end in reasonable small amount of time
      can be marked as HPC.
      
      The size of this HPC pool is static, because HPC are expected to end
      quickly, therefore jobs assigned to this pool will be served quickly.
      It can be configured in libvirtd.conf via prio_workers variable.
      Default is set to 5.
      
      To mark API with low or high priority, append priority:{low|high} to
      it's comment in src/remote/remote_protocol.x. This is similar to
      autogen|skipgen. If not marked, the generator assumes low as default.
      597fe3ce
  3. 05 9月, 2011 1 次提交
    • E
      snapshot: also support disks by path · 89b6284f
      Eric Blake 提交于
      I got confused when 'virsh domblkinfo dom disk' required the
      path to a disk (which can be ambiguous, since a single file
      can back multiple disks), rather than the unambiguous target
      device name that I was using in disk snapshots.  So, in true
      developer fashion, I went for the best of both worlds - all
      interfaces that operate on a disk (aka block) now accept
      either the target name or the unambiguous path to the backing
      file used by the disk.
      
      * src/conf/domain_conf.h (virDomainDiskIndexByName): Add
      parameter.
      (virDomainDiskPathByName): New prototype.
      * src/libvirt_private.syms (domain_conf.h): Export it.
      * src/conf/domain_conf.c (virDomainDiskIndexByName): Also allow
      searching by path, and decide whether ambiguity is okay.
      (virDomainDiskPathByName): New function.
      (virDomainDiskRemoveByName, virDomainSnapshotAlignDisks): Update
      callers.
      * src/qemu/qemu_driver.c (qemudDomainBlockPeek)
      (qemuDomainAttachDeviceConfig, qemuDomainUpdateDeviceConfig)
      (qemuDomainGetBlockInfo, qemuDiskPathToAlias): Likewise.
      * src/qemu/qemu_process.c (qemuProcessFindDomainDiskByPath):
      Likewise.
      * src/libxl/libxl_driver.c (libxlDomainAttachDeviceDiskLive)
      (libxlDomainDetachDeviceDiskLive, libxlDomainAttachDeviceConfig)
      (libxlDomainUpdateDeviceConfig): Likewise.
      * src/uml/uml_driver.c (umlDomainBlockPeek): Likewise.
      * src/xen/xend_internal.c (xenDaemonDomainBlockPeek): Likewise.
      * docs/formatsnapshot.html.in: Update documentation.
      * tools/virsh.pod (domblkstat, domblkinfo): Likewise.
      * docs/schemas/domaincommon.rng (diskTarget): Tighten pattern on
      disk targets.
      * docs/schemas/domainsnapshot.rng (disksnapshot): Update to match.
      * tests/domainsnapshotxml2xmlin/disk_snapshot.xml: Update test.
      89b6284f
  4. 31 8月, 2011 1 次提交
    • D
      Fix sanlock socket security labelling · 64bdec38
      Daniel P. Berrange 提交于
      It is not possible to change the label of a TCP socket once it
      has been opened. When creating a TCP socket care must be taken
      to ensure the socket creation label is set & then cleared.
      Remove the bogus call to virSecurityManagerSetProcessFDLabel
      from the lock driver guest setup code and instead make use of
      virSecurityManagerSetSocketLabel
      64bdec38
  5. 26 8月, 2011 2 次提交
    • J
      security: Rename SetSocketLabel APIs to SetDaemonSocketLabel · 4c85d96f
      Jiri Denemark 提交于
      The APIs are designed to label a socket in a way that the libvirt daemon
      itself is able to access it (i.e., in SELinux the label is virtd_t based
      as opposed to svirt_* we use for labeling resources that need to be
      accessed by a vm). The new name reflects this.
      4c85d96f
    • E
      snapshot: only pass snapshot to qemu command line when reverting · 5e47785b
      Eric Blake 提交于
      Changing the current vm, and writing that change to the file
      system, all before a new qemu starts, is risky; it's hard to
      roll back if starting the new qemu fails for some reason.
      Instead of abusing vm->current_snapshot and making the command
      line generator decide whether the current snapshot warrants
      using -loadvm, it is better to just directly pass a snapshot all
      the way through the call chain if it is to be loaded.
      
      This frees up the last use of snapshot->def->active for qemu's
      use, so the next patch can repurpose that field for tracking
      which snapshot is current.
      
      * src/qemu/qemu_command.c (qemuBuildCommandLine): Don't use active
      field of snapshot.
      * src/qemu/qemu_process.c (qemuProcessStart): Add a parameter.
      * src/qemu/qemu_process.h (qemuProcessStart): Update prototype.
      * src/qemu/qemu_migration.c (qemuMigrationPrepareAny): Update
      callers.
      * src/qemu/qemu_driver.c (qemudDomainCreate)
      (qemuDomainSaveImageStartVM, qemuDomainObjStart)
      (qemuDomainRevertToSnapshot): Likewise.
      (qemuDomainSnapshotSetCurrentActive)
      (qemuDomainSnapshotSetCurrentInactive): Delete unused functions.
      5e47785b
  6. 23 8月, 2011 1 次提交
    • O
      qemu: Cleanup improper VIR_ERR_NO_SUPPORT use · 4340b3ba
      Osier Yang 提交于
      * src/qemu/qemu_command.c: s/VIR_ERR_NO_SUPPORT/VIR_ERR_CONFIG_UNSUPPORTED/
      
      * src/qemu/qemu_driver.c: s/VIR_ERR_NO_SUPPORT/VIR_ERR_OPERATION_INVALID/
      
      * src/qemu/qemu_process.c: s/VIR_ERR_NO_SUPPORT/VIR_ERR_OPERATION_INVALID/
      4340b3ba
  7. 13 8月, 2011 1 次提交
    • D
      Move pidfile functions into util/virpidfile.{c,h} · f80a4ed7
      Daniel P. Berrange 提交于
      The functions for manipulating pidfiles are in util/util.{c,h}.
      We will shortly be adding some further pidfile related functions.
      To avoid further growing util.c, this moves the pidfile related
      functions into a dedicated virpidfile.{c,h}. The functions are
      also all renamed to have 'virPidFile' as their name prefix
      
      * util/util.h, util/util.c: Remove all pidfile code
      * util/virpidfile.c, util/virpidfile.h: Add new APIs for pidfile
        handling.
      * lxc/lxc_controller.c, lxc/lxc_driver.c, network/bridge_driver.c,
        qemu/qemu_process.c: Add virpidfile.h include and adapt for API
        renames
      f80a4ed7
  8. 05 8月, 2011 1 次提交
    • E
      qemu: avoid crash on process attach · 5ef1b6c5
      Eric Blake 提交于
      Detected by ccc-analyzer, reported by Alex Jia.
      
      qemuProcessStart always calls qemuProcessWaitForMonitor with a
      non-negative position, but qemuProcessAttach always calls with -1.
      In the latter case, there is no log file we can scrape, so we
      also should not be trying to scrape the logs if the qemu process
      died at the very end.
      
      * src/qemu/qemu_process.c (qemuProcessWaitForMonitor): Don't try
      to read from log in qemuProcessAttach case.
      5ef1b6c5
  9. 04 8月, 2011 1 次提交
  10. 01 8月, 2011 1 次提交
    • E
      qemu: fix crash when mixing sync and async monitor jobs · 193cd0f3
      Eric Blake 提交于
      Currently, we attempt to run sync job and async job at the same time. It
      means that the monitor commands for two jobs can be run in any order.
      
      In the function qemuDomainObjEnterMonitorInternal():
          if (priv->job.active == QEMU_JOB_NONE && priv->job.asyncJob) {
              if (qemuDomainObjBeginNestedJob(driver, obj) < 0)
      We check whether the caller is an async job by priv->job.active and
      priv->job.asynJob. But when an async job is running, and a sync job is
      also running at the time of the check, then priv->job.active is not
      QEMU_JOB_NONE. So we cannot check whether the caller is an async job
      in the function qemuDomainObjEnterMonitorInternal(), and must instead
      put the burden on the caller to tell us when an async command wants
      to do a nested job.
      
      Once the burden is on the caller, then only async monitor enters need
      to worry about whether the VM is still running; for sync monitor enter,
      the internal return is always 0, so lots of ignore_value can be dropped.
      
      * src/qemu/THREADS.txt: Reflect new rules.
      * src/qemu/qemu_domain.h (qemuDomainObjEnterMonitorAsync): New
      prototype.
      * src/qemu/qemu_process.h (qemuProcessStartCPUs)
      (qemuProcessStopCPUs): Add parameter.
      * src/qemu/qemu_migration.h (qemuMigrationToFile): Likewise.
      (qemuMigrationWaitForCompletion): Make static.
      * src/qemu/qemu_domain.c (qemuDomainObjEnterMonitorInternal): Add
      parameter.
      (qemuDomainObjEnterMonitorAsync): New function.
      (qemuDomainObjEnterMonitor, qemuDomainObjEnterMonitorWithDriver):
      Update callers.
      * src/qemu/qemu_driver.c (qemuDomainSaveInternal)
      (qemudDomainCoreDump, doCoreDump, processWatchdogEvent)
      (qemudDomainSuspend, qemudDomainResume, qemuDomainSaveImageStartVM)
      (qemuDomainSnapshotCreateActive, qemuDomainRevertToSnapshot):
      Likewise.
      * src/qemu/qemu_process.c (qemuProcessStopCPUs)
      (qemuProcessFakeReboot, qemuProcessRecoverMigration)
      (qemuProcessRecoverJob, qemuProcessStart): Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationToFile)
      (qemuMigrationWaitForCompletion, qemuMigrationUpdateJobStatus)
      (qemuMigrationJobStart, qemuDomainMigrateGraphicsRelocate)
      (doNativeMigrate, doTunnelMigrate, qemuMigrationPerformJob)
      (qemuMigrationPerformPhase, qemuMigrationFinish)
      (qemuMigrationConfirm): Likewise.
      * src/qemu/qemu_hotplug.c: Drop unneeded ignore_value.
      193cd0f3
  11. 27 7月, 2011 3 次提交
  12. 26 7月, 2011 1 次提交
    • L
      util: change virFile*Pid functions to return < 0 on failure · d6354c16
      Laine Stump 提交于
      Although most functions in libvirt return 0 on success and < 0 on
      failure, there are a few functions lingering around that return errno
      (a positive value) on failure, and sometimes code calling those
      functions incorrectly assumes the <0 standard. I noticed one of these
      the other day when auditing networkStartDhcpDaemon after Guido Gunther
      found a place where success was improperly returned on failure (that
      patch has been acked and is pending a push). The problem was that it
      expected the return value from virFileReadPid to be < 0 on failure,
      but it was actually positive (it was also neglected to set the return
      code in this case, similar to the bug found by Guido).
      
      This all led to the fact that *all* of the virFile*Pid functions in
      util.c are returning errno on failure. This patch remedies that
      problem by changing them all to return -errno on failure, and makes
      any necessary changes to callers of the functions. (In the meantime, I
      also properly set the return code on failure of virFileReadPid in
      networkStartDhcpDaemon).
      d6354c16
  13. 22 7月, 2011 5 次提交
    • A
      Asynchronous event for BlockJob completion · d489b046
      Adam Litke 提交于
      When an operation started by virDomainBlockPull completes (either with
      success or with failure), raise an event to indicate the final status.
      This API allow users to avoid polling on virDomainGetBlockJobInfo if
      they would prefer to use an event mechanism.
      
      * daemon/remote.c: Dispatch events to client
      * include/libvirt/libvirt.h.in: Define event ID and callback signature
      * src/conf/domain_event.c, src/conf/domain_event.h,
        src/libvirt_private.syms: Extend API to handle the new event
      * src/qemu/qemu_driver.c: Connect to the QEMU monitor event
        for block_stream completion and emit a libvirt block pull event
      * src/remote/remote_driver.c: Receive and dispatch events to application
      * src/remote/remote_protocol.x: Wire protocol definition for the event
      * src/remote_protocol-structs: structure definitions for protocol verification
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c: Watch for BLOCK_STREAM_COMPLETED event
        from QEMU monitor
      d489b046
    • L
      network: internal API functions to manage assignment of physdev to guest · 04711a0f
      Laine Stump 提交于
      The network driver needs to assign physical devices for use by modes
      that use macvtap, keeping track of which physical devices are in use
      (and how many instances, when the devices can be shared). Three calls
      are added:
      
      networkAllocateActualDevice - finds a physical device for use by the
      domain, and sets up the virDomainActualNetDef accordingly.
      
      networkNotifyActualDevice - assumes that the domain was already
      running, but libvirtd was restarted, and needs to be notified by each
      already-running domain about what interfaces they are using.
      
      networkReleaseActualDevice - decrements the usage count of the
      allocated physical device, and frees the virDomainActualNetDef to
      avoid later accidentally using the device.
      
      bridge_driver.[hc] - the new APIs. When WITH_NETWORK is false, these
      functions are all #defined to be "0" in the .h file (effectively
      becoming a NOP) to prevent link errors.
      
      qemu_(command|driver|hotplug|process).c - add calls to the above APIs
          in the appropriate places.
      
      tests/Makefile.am - we need to include libvirt_driver_network.la
          whenever libvirt_driver_qemu.la is linked, to avoid unreferenced
          symbols (in functions that are never called by the test
          programs...)
      04711a0f
    • L
      qemu: use virDomainNetGetActual*() functions where appropriate · 03caa988
      Laine Stump 提交于
      The qemu driver accesses fields in the virDomainNetDef directly, but
      with the advent of the virDomainActualNetDef, some pieces of
      information may be found in a different place (the ActualNetDef) if
      the network connection is of type='network' and that network is of
      forward type='bridge|private|vepa|passthrough'. The previous patch
      added functions to mask this difference from callers - they hide the
      decision making process and just pick the value from the proper place.
      
      This patch uses those functions in the qemu driver as a first step in
      making qemu work with the new network types. At this point, the
      virDomainActualNetDef is guaranteed always NULL, so the GetActualX()
      function will return exactly what the def->X that's being replaced
      would have returned (ie bisecting is not compromised).
      
      There is one place (in qemu_driver.c) where the internal details of
      the NetDef are directly manipulated by the code, so the GetActual
      functions cannot be used there without extra additional code; that
      file will be treated in a separate patch.
      03caa988
    • L
      conf: virDomainNetDef points to (rather than contains) virtPortProfile · 524655ee
      Laine Stump 提交于
      The virtPortProfile in the domain interface struct is now a separately
      allocated object *pointed to by* (rather than contained in) the main
      virDomainNetDef object. This is done to make it easier to figure out
      when a virtualPortProfile has/hasn't been specified in a particular
      config.
      524655ee
    • E
      build: rename files.h to virfile.h · 8e22e089
      Eric Blake 提交于
      In preparation for a future patch adding new virFile APIs.
      
      * src/util/files.h, src/util/files.c: Move...
      * src/util/virfile.h, src/util/virfile.c: ...here, and rename
      functions to virFile prefix.  Macro names are intentionally
      left alone.
      * *.c: All '#include "files.h"' uses changed.
      * src/Makefile.am (UTIL_SOURCES): Reflect rename.
      * cfg.mk (exclude_file_name_regexp--sc_prohibit_close): Likewise.
      * src/libvirt_private.syms: Likewise.
      * docs/hacking.html.in: Likewise.
      * HACKING: Regenerate.
      8e22e089
  14. 21 7月, 2011 1 次提交
  15. 19 7月, 2011 1 次提交
    • E
      libvirt: do not mix internal flags into public API · 33ba6e68
      Eric Blake 提交于
      There were two API in driver.c that were silently masking flags
      bits prior to calling out to the drivers, and several others
      that were explicitly masking flags bits.  This is not
      forward-compatible - if we ever have that many flags in the
      future, then talking to an old server that masks out the
      flags would be indistinguishable from talking to a new server
      that can honor the flag.  In general, libvirt.c should forward
      _all_ flags on to drivers, and only the drivers should reject
      unknown flags.
      
      In the case of virDrvSecretGetValue, the solution is to separate
      the internal driver callback function to have two parameters
      instead of one, with only one parameter affected by the public
      API.  In the case of virDomainGetXMLDesc, it turns out that
      no one was ever mixing VIR_DOMAIN_XML_INTERNAL_STATUS with
      the dumpxml path in the first place; that internal flag was
      only used in saving and restoring state files, which happened
      to be in functions internal to a single file, so there is no
      mixing of the internal flag with a public flags argument.
      Additionally, virDomainMemoryStats passed a flags argument
      over RPC, but not to the driver.
      
      * src/driver.h (VIR_DOMAIN_XML_FLAGS_MASK)
      (VIR_SECRET_GET_VALUE_FLAGS_MASK): Delete.
      (virDrvSecretGetValue): Separate out internal flags.
      (virDrvDomainMemoryStats): Provide missing flags argument.
      * src/driver.c (verify): Drop unused check.
      * src/conf/domain_conf.h (virDomainObjParseFile): Delete
      declaration.
      (virDomainXMLInternalFlags): Move...
      * src/conf/domain_conf.c: ...here.  Delete redundant include.
      (virDomainObjParseFile): Make static.
      * src/libvirt.c (virDomainGetXMLDesc, virSecretGetValue): Update
      clients.
      (virDomainMemoryPeek, virInterfaceGetXMLDesc)
      (virDomainMemoryStats, virDomainBlockPeek, virNetworkGetXMLDesc)
      (virStoragePoolGetXMLDesc, virStorageVolGetXMLDesc)
      (virNodeNumOfDevices, virNodeListDevices, virNWFilterGetXMLDesc):
      Don't mask unknown flags.
      * src/interface/netcf_driver.c (interfaceGetXMLDesc): Reject
      unknown flags.
      * src/secret/secret_driver.c (secretGetValue): Update clients.
      * src/remote/remote_driver.c (remoteSecretGetValue)
      (remoteDomainMemoryStats): Likewise.
      * src/qemu/qemu_process.c (qemuProcessGetVolumeQcowPassphrase):
      Likewise.
      * src/qemu/qemu_driver.c (qemudDomainMemoryStats): Likewise.
      * daemon/remote.c (remoteDispatchDomainMemoryStats): Likewise.
      33ba6e68
  16. 14 7月, 2011 1 次提交
    • J
      qemu: Save domain status ASAP after creating qemu process · 5169e5ea
      Jiri Denemark 提交于
      When creating new qemu process we saved domain status XML only after the
      process was fully setup and running. In case libvirtd was killed before
      the whole process finished, once libvirtd started again it didn't know
      anything about the new process and we end up with an orphaned qemu
      process. Let's save the domain status XML as soon as we know the PID so
      that libvirtd can kill the process on restart.
      5169e5ea
  17. 13 7月, 2011 5 次提交
    • 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: Separate job related data into a new object · 90a422f0
      Jiri Denemark 提交于
      90a422f0
    • 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
  18. 12 7月, 2011 2 次提交
    • 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
      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
  19. 06 7月, 2011 1 次提交
    • M
      Fix return value semantic of virFileMakePath · e123e1ee
      Matthias Bolte 提交于
      Some callers expected virFileMakePath to set errno, some expected
      it to return an errno value. Unify this to return 0 on success and
      -1 on error. Set errno to report detailed error information.
      
      Also optimize virFileMakePath if stat fails with an errno different
      from ENOENT.
      e123e1ee
  20. 04 7月, 2011 2 次提交
    • D
      Allow for resource relabelling with static labels · 6321fd97
      Daniel P. Berrange 提交于
      Add a new attribute to the <seclabel> XML to allow resource
      relabelling to be enabled with static label usage.
      
        <seclabel model='selinux' type='static' relabel='yes'>
          <label>system_u:system_r:svirt_t:s0:c392,c662</label>
        </seclabel>
      
      * docs/schemas/domain.rng: Add relabel attribute
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Parse
        the 'relabel' attribute
      * src/qemu/qemu_process.c: Unconditionally clear out the
        'imagelabel' attribute
      * src/security/security_apparmor.c: Skip based on 'relabel'
        attribute instead of label type
      * src/security/security_selinux.c: Skip based on 'relabel'
        attribute instead of label type and fill in <imagelabel>
        attribute if relabel is enabled.
      6321fd97
    • D
      Allow a base label to be specified in dynamic labelling mode · 4ebfc427
      Daniel P. Berrange 提交于
      Normally the dynamic labelling mode will always use a base
      label of 'svirt_t' for VMs. Introduce a <baselabel> field
      in the <seclabel> XML to allow this base label to be changed
      
      eg
      
         <seclabel type='dynamic' model='selinux'>
           <baselabel>system_u:object_r:virt_t:s0</baselabel>
         </seclabel>
      
      * docs/schemas/domain.rng: Add <baselabel>
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Parsing
        of base label
      * src/qemu/qemu_process.c: Don't reset 'model' attribute if
        a base label is specified
      * src/security/security_apparmor.c: Refuse to support base label
      * src/security/security_selinux.c: Use 'baselabel' when generating
        label, if available
      4ebfc427
  21. 28 6月, 2011 2 次提交
    • D
      Ensure sanlock socket is labelled with the VM process label · 5247b069
      Daniel P. Berrange 提交于
      The libvirt sanlock plugin is intentionally leaking a file
      descriptor to QEMU. To enable QEMU to use this FD under
      SELinux, it must be labelled correctly. We dont want to use
      the svirt_image_t for this, since QEMU must not be allowed
      to actually use the FD. So instead we label it with svirt_t
      using virSecurityManagerSetProcessFDLabel
      
      * src/locking/domain_lock.c, src/locking/domain_lock.h,
        src/locking/lock_driver.h, src/locking/lock_driver_nop.c,
        src/locking/lock_driver_sanlock.c, src/locking/lock_manager.c,
        src/locking/lock_manager.h: Optionally pass an FD back to
        the hypervisor for security driver labelling
      * src/qemu/qemu_process.c: label the lock manager plugin
        FD with the process label
      5247b069
    • D
      Rename virSecurityManagerSetFDLabel method · 4438c63e
      Daniel P. Berrange 提交于
      The virSecurityManagerSetFDLabel method is used to label
      file descriptors associated with disk images. There will
      shortly be a need to label other file descriptors in a
      different way. So the current name is ambiguous. Rename
      the method to virSecurityManagerSetImageFDLabel to clarify
      its purpose
      
      * src/libvirt_private.syms,
        src/qemu/qemu_migration.c, src/qemu/qemu_process.c,
        src/security/security_apparmor.c, src/security/security_dac.c,
        src/security/security_driver.h, src/security/security_manager.c,
        src/security/security_manager.h, src/security/security_selinux.c,
        src/security/security_stack.c: s/FDLabel/ImageFDLabel/
      4438c63e
  22. 27 6月, 2011 1 次提交
  23. 24 6月, 2011 1 次提交