1. 02 9月, 2011 16 次提交
    • M
      Add "redirdev" redirection device · 162efa1a
      Marc-André Lureau 提交于
      - create a new "redirdev" element for this purpose
      162efa1a
    • M
      qemu: Don't append 0 at usb id, so that it is compatible with legacy -usb · fdd14a9d
      Marc-André Lureau 提交于
      QEMU uses USB bus name "usb.0" when using the legacy -usb argument.
      If we want to allow USB devices to specify their addresses with legacy
      -usb, we should either in case of legacy bus name drop the 0 from the
      address bus, or just drop the 0 from device id. This patch does the
      later.
      
      Another solution would be to permit addressing on non-legacy USB
      controllers only.
      fdd14a9d
    • M
      qemu: don't reserve slot 1 if a PIIX3 USB controller is defined there · f35bbf7b
      Marc-André Lureau 提交于
      Applies only to piix3 and check if piix3 controller is on correct
      address, or report error
      f35bbf7b
    • M
      Modify USB port to be defined as a port path · 31710a53
      Marc-André Lureau 提交于
      So that devices can be attached to hubs. Example, to attach to first
      port of a usb-hub on port 1.
      
            <hub type='usb'>
               <address type='usb' bus='0' port='1'/>
            </hub>
      
            <input type='mouse' type='usb'>
               <address type='usb' bus='0' port='1.1'/>
            </hub>
      
      also add a test entry
      31710a53
    • M
      Add USB hub device · fdabeb3c
      Marc-André Lureau 提交于
      domain parsing and serialization code, qemu driver backend and
      a couple of test
      fdabeb3c
    • M
      Add USB companion controllers support · f3ce5962
      Marc-André Lureau 提交于
      Companion controllers take an extra 'master' attribute to associate
      them.
      
      Also add tests for this
      f3ce5962
    • M
      USB devices gain a new USB address child element · 22c0d433
      Marc-André Lureau 提交于
      Expand the domain and the QEmu driver code
      Adds a couple of tests
      22c0d433
    • M
      Add a new controller type 'usb' with optionnal 'model' · d6d54cd1
      Marc-André Lureau 提交于
      The model by default is piix3-uchi.
      
      Example:
      <controller type='usb' index='0' model='ich9-ehci'/>
      d6d54cd1
    • M
      Add various USB devices QEMU_CAPS · 329f907b
      Marc-André Lureau 提交于
      329f907b
    • E
      snapshot: fix corner case on OOM during creation · c554f6e1
      Eric Blake 提交于
      Commit 6766ff10 introduced a corner case bug with snapshot creation:
      if a snapshot is created, but then we hit OOM while trying to
      create the return value of the function, then we have polluted the
      internal directory with the snapshot metadata with no way to clean
      it up from the running libvirtd.
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): Don't
      write metadata file on OOM condition.
      c554f6e1
    • O
      Add directsync cache mode support for disk driver · 6ee52c1b
      Osier Yang 提交于
      Newer QEMU introduced cache=directsync for -drive, this patchset
      is to expose it in libvirt layer.
      
        * Introduced a new QEMU capability flag ($prefix_CACHE_DIRECTSYNC),
          As even $prefix_CACHE_V2 is set, we can't known if directsync
          is supported.
      6ee52c1b
    • E
      qemu: detect incomplete save files · 55d88def
      Eric Blake 提交于
      Several users have reported problems with 'virsh start' failing because
      it was encountering a managed save situation where the managed save file
      was incomplete.  Be more robust to this by using two different magic
      numbers, so that newer libvirt can gracefully handle an incomplete file
      differently than a complete one, while older libvirt will at least fail
      up front rather than trying to load only to have qemu fail at the end.
      
      Managed save is a convenience - it exists to preserve as much state
      as possible; if the state was not preserved, it is reasonable to just
      log that fact, then proceed with a fresh boot.  On the other hand,
      user saves are under user control, so we must fail, but by making
      the failure message distinct, the user can better decide how to handle
      the situation of an incomplete save file.
      
      * src/qemu/qemu_driver.c (QEMUD_SAVE_PARTIAL): New define.
      (qemuDomainSaveInternal): Use it to mark incomplete images.
      (qemuDomainSaveImageOpen, qemuDomainObjRestore): Add parameter
      that controls what to do with partial images.
      (qemuDomainRestoreFlags, qemuDomainSaveImageGetXMLDesc)
      (qemuDomainSaveImageDefineXML, qemuDomainObjStart): Update callers.
      Based on an initial idea by Osier Yang.
      55d88def
    • E
      qemu: refactor file opening · 449ae9c2
      Eric Blake 提交于
      In a SELinux or root-squashing NFS environment, libvirt has to go
      through some hoops to create a new file that qemu can then open()
      by name.  Snapshots are a case where we want to guarantee an empty
      file that qemu can open; also, reopening a save file to convert it
      from being marked partial to complete requires a reopen to avoid
      O_DIRECT headaches.  Refactor some existing code to make it easier
      to reuse in later patches.
      
      * src/qemu/qemu_migration.h (qemuMigrationToFile): Drop parameter.
      * src/qemu/qemu_migration.c (qemuMigrationToFile): Let cgroup do
      the stat, rather than asking caller to do it and pass info down.
      * src/qemu/qemu_driver.c (qemuOpenFile): New function, pulled from...
      (qemuDomainSaveInternal): ...here.
      (doCoreDump, qemuDomainSaveImageOpen): Use it here as well.
      449ae9c2
    • W
      reserve slot 1 on pci bus0 · deff02a3
      Wen Congyang 提交于
      After supporting multi function pci device, we only reserve function 1 on slot 1.
      The user can use the other function on slot 1 in the xml config file. We should
      detect this wrong usage.
      deff02a3
    • A
      BlockPull: Set initial bandwidth limit if specified · d4b9e062
      Adam Litke 提交于
      The libvirt BlockPull API supports the use of an initial bandwidth limit but the
      qemu block_stream API does not.  To get the desired behavior we use the two APIs
      strung together: first BlockPull, then BlockJobSetSpeed.  We can do this at the
      driver level to avoid duplicated code in each monitor path.
      Signed-off-by: NAdam Litke <agl@us.ibm.com>
      d4b9e062
    • A
      BlockJob: Bandwidth parameter is in MB when using text monitor · 78d9325d
      Adam Litke 提交于
      Due to an unfortunate precedent in qemu, the units for the bandwidth parameter
      to block_job_set_speed are different between the text monitor and the qmp
      monitor.  While the qmp monitor uses bytes/s, the text monitor expects MB/s.
      
      Correct the units for the text interface.
      Signed-off-by: NAdam Litke <agl@us.ibm.com>
      78d9325d
  2. 01 9月, 2011 1 次提交
  3. 31 8月, 2011 3 次提交
    • 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
    • E
      snapshot: forbid snapshot on autodestroy domain · 173015be
      Eric Blake 提交于
      There is no reason to forbid pausing an autodestroy domain
      (not to mention that 'virsh start --paused --autodestroy'
      succeeds in creating a paused autodestroy domain).
      
      Meanwhile, qemu was failing to enforce the API documentation that
      autodestroy domains cannot be saved.  And while the original
      documentation only mentioned save/restore, snapshots are another
      form of saving that are close enough in semantics as to make no
      sense on one-shot domains.
      
      * src/qemu/qemu_driver.c (qemudDomainSuspend): Drop bogus check.
      (qemuDomainSaveInternal, qemuDomainSnapshotCreateXML): Forbid
      saves of autodestroy domains.
      * src/libvirt.c (virDomainCreateWithFlags, virDomainCreateXML):
      Document snapshot interaction.
      173015be
    • P
      Fix error detection in device change · 4521ffab
      Philipp Hahn 提交于
      According to qemu-kvm/qerror.c all messages start with a capital
      "Device ", but the current code only scans for the lower case "device ".
      This results in "virDomainUpdateDeviceFlags()" to not detect locked
      CD-ROMs and reporting success even in the case of a failure:
      	# virsh qemu-monitor-command "$VM" change\ drive-ide0-0-0\ \"/var/lib/libvirt/images/ucs_2.4-0-sec4-20110714145916-dvd-amd64.iso\"
      	Device 'drive-ide0-0-0' is locked
      	# virsh update-device "$VM" /dev/stdin <<<"<disk type='file' device='cdrom'><driver name='qemu' type='raw'/><source file='/var/lib/libvirt/images/ucs_2.4-0-sec4-20110714145916-dvd-amd64.iso'/><target dev='hda' bus='ide'/><readonly/><alias name='ide0-0-0'/><address type='drive' controller='0' bus='0' unit='0'/></disk>"
      	Device updated successfully
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      4521ffab
  4. 30 8月, 2011 2 次提交
    • E
      start: allow discarding managed save · 27c85260
      Eric Blake 提交于
      There have been several instances of people having problems with
      a broken managed save file, and not aware that they could use
      'virsh managedsave-remove dom' to fix things.  Making it possible
      to do this as part of starting a domain makes the same functionality
      easier to find, and one less API call.
      
      * include/libvirt/libvirt.h.in (VIR_DOMAIN_START_FORCE_BOOT): New
      flag.
      * src/libvirt.c (virDomainCreateWithFlags): Document it.
      * src/qemu/qemu_driver.c (qemuDomainObjStart): Alter signature.
      (qemuAutostartDomain, qemuDomainStartWithFlags): Update callers.
      * tools/virsh.c (cmdStart): Expose it in virsh.
      * tools/virsh.pod (start): Document it.
      27c85260
    • E
      qemu: properly label outgoing pipe for tunneled migration · e6b8bc81
      Eric Blake 提交于
      Commit 32617617 made it possible to use pipes instead of sockets
      for outgoing tunneled migration; however, it caused a regression
      because the pipe was never given a SELinux label.
      
      * src/qemu/qemu_migration.c (doTunnelMigrate): Label outgoing pipe.
      e6b8bc81
  5. 26 8月, 2011 9 次提交
    • K
      Fix persistent migration config save · 709b4c50
      KAMEZAWA Hiroyuki 提交于
      When a user migrates a domain by command as
      
      libvirt saves vm's domain XML config in destination host after migration.
      But it saves vm->def. Then, the saved XML contains some garbage.
      
        <domain type='kvm' id='50'>
                           ^^^^^^^^
        ...
         <console type='pty' tty='/dev/pts/5'>
                             ^^^^^^^^^^^^^^^^^
      
      Avoid saving unnecessary things by saving persistent vm definition.
      709b4c50
    • D
      Detect errors from the 'sendkey' command · 6b434da6
      Daniel P. Berrange 提交于
      On success, the 'sendkey' command does not return any data, so
      any data in the reply should be considered to be an error
      message
      
      * src/qemu/qemu_monitor_text.c: Treat non-"" reply data as an
        error message for 'sendkey' command
      6b434da6
    • D
      Fix keymap used to talk with QEMU · ce93f64b
      Daniel P. Berrange 提交于
      The QEMU 'sendkey' command expects keys to be encoded in the same
      way as the RFB extended keycode set. Specifically it wants extended
      keys to have the high bit of the first byte set, while the Linux
      XT KBD driver codeset uses the low bit of the second byte. To deal
      with this we introduce a new keymap 'RFB' and use that in the QEMU
      driver
      
      * include/libvirt/libvirt.h.in: Add VIR_KEYCODE_SET_RFB
      * src/qemu/qemu_driver.c: Use RFB keycode set instead of XT KBD
      * src/util/virkeycode-mapgen.py: Auto-generate the RFB keycode
        set from the XT KBD set
      * src/util/virkeycode.c: Add RFB keycode entry to table. Add a
        verify check on cardinality of the codeOffset table
      ce93f64b
    • J
      qemu: Correctly label migration TCP socket · 855f7689
      Jiri Denemark 提交于
      855f7689
    • 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: track current snapshot across restarts · 6766ff10
      Eric Blake 提交于
      Audit all changes to the qemu vm->current_snapshot, and make them
      update the saved xml file for both the previous and the new
      snapshot, so that there is always at most one snapshot with
      <active>1</active> in the xml, and that snapshot is used as the
      current snapshot even across libvirtd restarts.
      
      This patch does not fix the case of virDomainSnapshotDelete(,CHILDREN)
      where one of the children is the current snapshot; that will be later.
      
      * src/conf/domain_conf.h (_virDomainSnapshotDef): Alter member
      type and name.
      * src/conf/domain_conf.c (virDomainSnapshotDefParseString)
      (virDomainSnapshotDefFormat): Update clients.
      * docs/schemas/domainsnapshot.rng: Tighten rng.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotLoad): Reload current
      snapshot.
      (qemuDomainSnapshotCreateXML, qemuDomainRevertToSnapshot)
      (qemuDomainSnapshotDiscard): Track current snapshot.
      6766ff10
    • 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
    • E
      snapshot: don't leak resources on qemu snapshot failure · 861dc84b
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=727709
      mentions that if qemu fails to create the snapshot (such as what
      happens on Fedora 15 qemu, which has qmp but where savevm is only
      in hmp, and where libvirt is old enough to not try the hmp fallback),
      then 'virsh snapshot-list dom' will show a garbage snapshot entry,
      and the libvirt internal directory for storing snapshot metadata
      will have a bogus file.
      
      This fixes the fallout bug of polluting the snapshot-list with
      garbage on failure (the root cause of the F15 bug of not having
      fallback to hmp has already been fixed in newer libvirt releases).
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): Allocate
      memory before making snapshot, and cleanup on failure.  Don't
      dereference NULL if transient domain exited during snapshot creation.
      861dc84b
    • A
      qemu: avoid dead store in doPeer2PeerMigrate3 · d69d3210
      Alex Jia 提交于
      * src/qemu/qemu_migration.c: avoid dead 'ret' assignment and silence
        clang warning.
      
      Detected by ccc-analyzer:
      
        CC     libvirt_driver_qemu_la-qemu_migration.lo
      qemu/qemu_migration.c:2046:5: warning: Value stored to 'ret' is never read
          ret = qemuMigrationConfirm(driver, sconn, vm,
          ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      d69d3210
  6. 25 8月, 2011 2 次提交
  7. 24 8月, 2011 2 次提交
    • O
      qemu: Report error if qemu monitor command not found for BlockJob · 10b10024
      Osier Yang 提交于
      * src/qemu/qemu_monitor_json.c: Handle error "CommandNotFound" and
        report the error.
      
      * src/qemu/qemu_monitor_text.c: If a sub info command is not found,
        it prints the output of "help info", for other commands,
        "unknown command" is printed.
      
      Without this patch, libvirt always report:
      
        An error occurred, but the cause is unknown
      
      This patch was adapted from a patch by Osier Yang <jyang@redhat.com> to
      break out detection of unrecognized text monitor commands into a separate
      function.
      Signed-off-by: NAdam Litke <agl@us.ibm.com>
      10b10024
    • E
      maint: fix comment typos · 3a52b864
      Eric Blake 提交于
      * src/qemu/qemu_driver.c (qemuDomainSaveInternal): Fix typo.
      * src/conf/domain_event.c (virDomainEventDispatchMatchCallback):
      Likewise.
      * daemon/libvirtd.c (daemonRunStateInit): Likewise.
      * src/lxc/lxc_container.c (lxcContainerChildMountSort): Likewise.
      * src/util/virterror.c (virCopyError, virRaiseErrorFull): Likewise.
      * src/xenxs/xen_sxpr.c (xenParseSxprSound): Likewise.
      3a52b864
  8. 23 8月, 2011 2 次提交
  9. 19 8月, 2011 3 次提交
    • E
      maint: simplify lots of libxml2 clients · d89dd42d
      Eric Blake 提交于
      Repetitive patterns should be factored.  The sign of a good
      factorization is a change that kills 5x more lines than it adds :)
      
      * src/conf/domain_conf.c (virDomainDeviceDefParse)
      (virDomainSnapshotDefParseString): Use new convenience macros.
      * src/conf/storage_conf.c (virStoragePoolDefParseSourceString):
      Likewise.
      * src/cpu/cpu.c (cpuCompareXML, cpuBaselineXML): Likewise.
      * src/esx/esx_vi.c (esxVI_Context_Execute): Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationCookieXMLParseStr):
      Likewise.
      * src/security/virt-aa-helper.c (caps_mockup): Likewise.
      * src/test/test_driver.c (testOpenFromFile): Likewise.
      * tests/cputest.c (cpuTestLoadXML, cpuTestLoadMultiXML):
      Likewise.
      * tools/virsh.c (cmdFreecell, makeCloneXML, cmdVNCDisplay)
      (cmdTTYConsole, cmdDetachInterface, cmdDetachDisk)
      (cmdSnapshotCreate, cmdSnapshotCreateAs, cmdSnapshotCurrent)
      (cmdSnapshotList, cmdSnapshotParent): Likewise.
      d89dd42d
    • O
      qemu: Allow to undefine a running domain · aaa93ab6
      Osier Yang 提交于
      aaa93ab6
    • O
      qemu: Get memory balloon info correctly for text monitor · 4ffa7530
      Osier Yang 提交于
      * src/qemu/qemu_monitor_text.c: BALLOON_PREFIX was defined as
      "balloon: actual=", which cause "actual=" is stripped early before
      the real parsing. This patch changes BALLOON_PREFIX into "balloon: ",
      and modifies related functions, also renames
      "qemuMonitorParseExtraBalloonInfo" to "qemuMonitorParseBalloonInfo",
      as after the changing, it parses all the info returned by "info balloon".
      4ffa7530