1. 17 9月, 2013 8 次提交
    • A
      Add ftps protocol support for cdrom disk · 0f24393e
      Aline Manera 提交于
      The ftps protocol is another protocol supported by qemu/KVM while specifying
      the cdrom ISO image.
      
      The xml should be as following:
      
          <disk type='network' device='cdrom'>
            <source protocol='ftps' name='/url/path'>
              <host name='host.name' port='990'/>
            </source>
          </disk>
      Signed-off-by: NAline Manera <alinefm@br.ibm.com>
      0f24393e
    • A
      Add https protocol support for cdrom disk · d9dd9818
      Aline Manera 提交于
      The https protocol is also accepted by qemu/KVM when specifying the cdrom ISO
      image.
      
      The xml should be as following:
      
          <disk type='network' device='cdrom'>
            <source protocol='https' name='/url/path'>
              <host name='host.name' port='443'/>
            </source>
          </disk>
      Signed-off-by: NAline Manera <alinefm@br.ibm.com>
      d9dd9818
    • P
      qemu: Fix memleak after commit 59898a88 · 044e3e75
      Peter Krempa 提交于
      If the ABI compatibility check with the "migratable" user XML is
      successful, we would leak the originally parsed XML from the user that
      would not be used in this case.
      
      Reported by Ján Tomko.
      044e3e75
    • P
      qemu: Factor out body of qemuDomainSetMetadata for universal use · f87a7c67
      Peter Krempa 提交于
      The function implemented common behavior that can be reused for other
      hypervisor drivers that use the virDomainObj data structures. Factor out
      the core into a separate helper func.
      f87a7c67
    • P
      qemu: Factor out body of qemuDomainGetMetadata for universal use · 99c51af2
      Peter Krempa 提交于
      The function implemented common behavior that can be reused for other
      hypervisor drivers that use the virDomainObj data structures. Factor out
      the core into a separate helper func.
      99c51af2
    • P
      qemu: Use "migratable" XML definition when doing external checkpoints · 1b7bfa65
      Peter Krempa 提交于
      In the original implementation of external checkpoints I've mistakenly
      used the live definition to be stored in the save image. The normal
      approach is to use the "migratable" definition. This was discovered when
      commit 07966f6a changed the behavior to
      use a converted XML from the user to do the compatibility check to fix
      problem when using the regular machine saving.
      
      As the previous patch added a compatibility layer, we can now change the
      type of the XML in the image.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1008340
      1b7bfa65
    • P
      qemu: Fix checking of ABI stability when restoring external checkpoints · 59898a88
      Peter Krempa 提交于
      External checkpoints have a bug in the implementation where they use the
      normal definition instead of the "migratable" one. This causes errors
      when the snapshot is being reverted using the workaround method via
      qemuDomainRestoreFlags() with a custom XML. This issue was introduced
      when commit 07966f6a changed the code to
      compare "migratable" XMLs from the user as we should have used
      migratable in the image too.
      
      This patch adds a compatibility layer, so that fixing the snapshot code
      won't make existing snapshots fail to load.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1008340
      59898a88
    • J
      Always free network and graphics cookies · 102eb00c
      Ján Tomko 提交于
      qemuMigrationEatCookie has flags to control if these should
      be parsed, but it does not fill mig->flags. These cookies might
      get leaked if these flags are not set by qemuMigrationBakeCookie.
      
      42 (32 direct, 10 indirect) bytes in 1 blocks are definitely lost in
      loss record 361 of 662
      ==123== by 0x1BA33FCA: qemuMigrationEatCookie (qemu_migration.c:678)
      ==123== by 0x1BA34A1E: qemuMigrationRun (qemu_migration.c:3108)
      ==123== by 0x1BA3622B: doNativeMigrate (qemu_migration.c:3343)
      ==123== by 0x1BA3B408: qemuMigrationPerform (qemu_migration.c:4138)
      102eb00c
  2. 16 9月, 2013 2 次提交
  3. 12 9月, 2013 1 次提交
  4. 10 9月, 2013 1 次提交
    • E
      qemu: endjob returns a bool · 6cd15482
      Eric Blake 提交于
      Osier Yang pointed out that ever since commit 31cb030a, the
      signature of qemuDomainObjEndJob was changed to return a bool.
      While comparison against 0 or > 0 still gives the right results,
      it looks fishy; we also had one place that was comparing < 0
      which is effectively dead code.
      
      * src/qemu/qemu_migration.c (qemuMigrationPrepareAny): Fix dead
      code bug.
      (qemuMigrationBegin): Use more canonical form of bool check.
      * src/qemu/qemu_driver.c (qemuAutostartDomain)
      (qemuDomainCreateXML, qemuDomainSuspend, qemuDomainResume)
      (qemuDomainShutdownFlags, qemuDomainReboot, qemuDomainReset)
      (qemuDomainDestroyFlags, qemuDomainSetMemoryFlags)
      (qemuDomainSetMemoryStatsPeriod, qemuDomainInjectNMI)
      (qemuDomainSendKey, qemuDomainGetInfo, qemuDomainScreenshot)
      (qemuDomainSetVcpusFlags, qemuDomainGetVcpusFlags)
      (qemuDomainRestoreFlags, qemuDomainGetXMLDesc)
      (qemuDomainCreateWithFlags, qemuDomainAttachDeviceFlags)
      (qemuDomainUpdateDeviceFlags, qemuDomainDetachDeviceFlags)
      (qemuDomainBlockResize, qemuDomainBlockStats)
      (qemuDomainBlockStatsFlags, qemuDomainMemoryStats)
      (qemuDomainMemoryPeek, qemuDomainGetBlockInfo)
      (qemuDomainAbortJob, qemuDomainMigrateSetMaxDowntime)
      (qemuDomainMigrateGetCompressionCache)
      (qemuDomainMigrateSetCompressionCache)
      (qemuDomainMigrateSetMaxSpeed)
      (qemuDomainSnapshotCreateActiveInternal)
      (qemuDomainRevertToSnapshot, qemuDomainSnapshotDelete)
      (qemuDomainQemuMonitorCommand, qemuDomainQemuAttach)
      (qemuDomainBlockJobImpl, qemuDomainBlockCopy)
      (qemuDomainBlockCommit, qemuDomainOpenGraphics)
      (qemuDomainGetBlockIoTune, qemuDomainGetDiskErrors)
      (qemuDomainPMSuspendForDuration, qemuDomainPMWakeup)
      (qemuDomainQemuAgentCommand, qemuDomainFSTrim): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6cd15482
  5. 09 9月, 2013 2 次提交
    • E
      qemu: don't leak vm on failure · d047b2d9
      Eric Blake 提交于
      Failure to attach to a domain during 'virsh qemu-attach' left
      the list of domains in an odd state:
      
      $ virsh qemu-attach 4176
      error: An error occurred, but the cause is unknown
      
      $ virsh list --all
       Id    Name                           State
      ----------------------------------------------------
       2     foo                            shut off
      
      $ virsh qemu-attach 4176
      error: Requested operation is not valid: domain is already active as 'foo'
      
      $ virsh undefine foo
      error: Failed to undefine domain foo
      error: Requested operation is not valid: cannot undefine transient domain
      
      $ virsh shutdown foo
      error: Failed to shutdown domain foo
      error: invalid argument: monitor must not be NULL
      
      It all stems from leaving the list of domains unmodified on
      the initial failure; we should follow the lead of createXML
      which removes vm on failure (the actual initial failure still
      needs to be fixed in a later patch, but at least this patch
      gets us to the point where we aren't getting stuck with an
      unremovable "shut off" transient domain).
      
      While investigating, I also found a leak in qemuDomainCreateXML;
      the two functions should behave similarly.  Note that there are
      still two unusual paths: if dom is not allocated, the user will
      see an OOM error even though the vm remains registered (but oom
      errors already indicate tricky cleanup); and if the vm starts
      and then quits again all before the job ends, it is possible
      to return a non-NULL dom even though the dom will no longer be
      useful for anything (but this at least lets the user know their
      short-lived vm ran).
      
      * src/qemu/qemu_driver.c (qemuDomainCreateXML): Don't leak vm on
      failure to obtain job.
      (qemuDomainQemuAttach): Match cleanup of qemuDomainCreateXML.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d047b2d9
    • L
      qemu: avoid users specifying CPU features for non-x86 plaftorm. · 7b0ce42c
      Li Zhang 提交于
      Currently, only X86 provides users CPU features with CPUID instruction.
      If users specify the features for non-x86, it should tell users to
      remove them.
      
      This patch is to report one error if features are specified by
      users for non-x86 platform.
      Signed-off-by: NLi Zhang <zhlcindy@linux.vnet.ibm.com>
      7b0ce42c
  6. 07 9月, 2013 1 次提交
    • E
      qemu: don't leave shutdown inhibited on attach failure · 93e59975
      Eric Blake 提交于
      While debugging a failure of 'virsh qemu-attach', I noticed that
      we were leaking the count of active domains on failure.  This
      means that a libvirtd session that is supposed to quit after
      active domains disappear will hang around forever.
      
      * src/qemu/qemu_process.c (qemuProcessAttach): Undo count of
      active domains on failure.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      93e59975
  7. 06 9月, 2013 2 次提交
    • E
      qemu: recognize -machine accel=kvm when parsing native · 2b1ef11c
      Eric Blake 提交于
      In Fedora 19, 'qemu-kvm' is a simple wrapper that calls
      'qemu-system-x86_64 -machine accel=kvm'.  Attempting
      to use 'virsh qemu-attach $pid' to a machine started as:
      
      qemu-kvm -cdrom /var/lib/libvirt/images/foo.img \
       -monitor unix:/tmp/demo,server,nowait -name foo \
       --uuid cece4f9f-dff0-575d-0e8e-01fe380f12ea
      
      was failing with:
      error: XML error: No PCI buses available
      
      because we did not see 'kvm' in the executable name read from
      /proc/$pid/cmdline, and tried to assign os.machine as
      "accel=kvm" instead of "pc"; this in turn led to refusal to
      recognize the pci bus.
      
      Noticed while investigating https://bugzilla.redhat.com/995312
      although there are still other issues to fix before that bug
      will be completely solved.
      
      I've concluded that the existing parser code for native-to-xml
      is a horrendous hodge-podge of ad-hoc approaches; I basically
      rewrote the -machine section to be a bit saner.
      
      * src/qemu/qemu_command.c (qemuParseCommandLine): Don't assume
      -machine argument is always appropriate for os.machine; set
      virtType if accel is present.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      2b1ef11c
    • E
      qemu: only parse basename when determining emulator properties · 6a373fb2
      Eric Blake 提交于
      'virsh domxml-from-native' and 'virsh qemu-attach' could misbehave
      for an emulator installed in (a somewhat unlikely) location
      such as /usr/local/qemu-1.6/qemu-system-x86_64 or (an even less
      likely) /opt/notxen/qemu-system-x86_64.  Limit the strstr seach
      to just the basename of the file where we are assuming details
      about the binary based on its name.
      
      While testing, I accidentally triggered a core dump during strcmp
      when I forgot to set os.type on one of my code paths; this patch
      changes such a coding error to raise a nicer internal error instead.
      
      * src/qemu/qemu_command.c (qemuParseCommandLine): Compute basename
      earlier.
      * src/conf/domain_conf.c (virDomainDefPostParseInternal): Avoid
      NULL deref.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6a373fb2
  8. 05 9月, 2013 3 次提交
    • L
      qemu: Remove CPU features functions calling for non-x86 platform. · adf0d770
      Li Zhang 提交于
      CPU features are not supported on non-x86 and hasFeatures will be NULL.
      
      This patch is to remove CPU features functions calling to avoid errors.
      Signed-off-by: NLi Zhang <zhlcindy@linux.vnet.ibm.com>
      adf0d770
    • D
      Stop free'ing 'const char *' strings · bbcdd9b5
      Daniel P. Berrange 提交于
      The VIR_FREE() macro will cast away any const-ness. This masked a
      number of places where we passed a 'const char *' string to
      VIR_FREE. Fortunately in all of these cases, the variable was not
      in fact const data, but a heap allocated string. Fix all the
      variable declarations to reflect this.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      bbcdd9b5
    • E
      qemu: simplify list cleanup · 41b55056
      Eric Blake 提交于
      No need to open code now that we have a nice function.
      
      Interestingly, our virStringFreeList function is typed correctly
      (a malloc'd list of malloc'd strings is NOT const, whether at the
      point where it is created, or at the point where it is cleand up),
      so using it with a 'const char **' argument would require a cast
      to keep the compiler.  I chose instead to remove const from code
      even where we don't modify the argument, just to avoid the need
      to cast.
      
      * src/qemu/qemu_command.h (qemuParseCommandLine): Drop declaration.
      * src/qemu/qemu_command.c (qemuParseProcFileStrings)
      (qemuStringToArgvEnv): Don't force malloc'd result to be const.
      (qemuParseCommandLinePid, qemuParseCommandLineString): Simplify
      cleanup.
      (qemuParseCommandLine, qemuFindEnv): Drop const-correctness to
      avoid the need to cast in callers.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      41b55056
  9. 04 9月, 2013 1 次提交
  10. 03 9月, 2013 9 次提交
    • M
      qemu: Handle huge number of queues correctly · 1dc5dea7
      Michal Privoznik 提交于
      Currently, kernel supports up to 8 queues for a multiqueue tap device.
      However, if user tries to enter a huge number (e.g. one million) the tap
      allocation fails, as expected. But what is not expected is the log full
      of warnings:
      
          warning : virFileClose:83 : Tried to close invalid fd 0
      
      The problem is, upon error we iterate over an array of FDs (handlers to
      queues) and VIR_FORCE_CLOSE() over each item. However, the array is
      pre-filled with zeros. Hence, we repeatedly close stdin. Ouch.
      But there's more. The queues allocation is done in virNetDevTapCreate()
      which cleans up the FDs in case of error. Then, its caller, the
      virNetDevTapCreateInBridgePort() iterates over the FD array and tries to
      close them too. And so does qemuNetworkIfaceConnect() and
      qemuBuildInterfaceCommandLine().
      1dc5dea7
    • C
      qemu: Support virtio-mmio transport for virtio on ARM · 4fa17221
      Cole Robinson 提交于
      Starting with qemu 1.6, the qemu-system-arm vexpress-a9 model has a
      hardcoded virtio-mmio transport which enables attaching all virtio
      devices.
      
      On the command line, we have to use virtio-XXX-device rather than
      virtio-XXX-pci, thankfully s390 already set the precedent here so
      it's fairly straight forward.
      
      At the XML level, this adds a new device address type virtio-mmio.
      The controller and addressing don't have any subelements at the
      moment because we they aren't needed for this usecase, but could
      be added later if needed.
      
      Add a test case for an ARM guest with one of every virtio device
      enabled.
      4fa17221
    • C
      qemu: Fix networking for ARM guests · 54a77c6d
      Cole Robinson 提交于
      Similar to the chardev bit, ARM boards depend on the old style '-net nic'
      for actually instantiating net devices. But we can't block out
      -netdev altogether since it's needed for upcoming virtio support.
      
      And add tests for working ARM XML with console, disk, and networking.
      54a77c6d
    • C
      domain_conf: Add disk bus=sd, wire it up for qemu · 3730353f
      Cole Robinson 提交于
      This corresponds to '-sd' and '-drive if=sd' on the qemu command line.
      Needed for many ARM boards which don't provide any other way to
      pass in storage.
      3730353f
    • C
      qemu: Don't try to allocate PCI addresses for ARM · 68e5e93e
      Cole Robinson 提交于
      68e5e93e
    • C
      qemu: Fix specifying char devs for ARM · 3a2beaee
      Cole Robinson 提交于
      QEMU ARM boards don't give us any way to explicitly wire in
      a -chardev, so use the old style -serial options.
      
      Unfortunately this isn't as simple as just turning off the CHARDEV flag
      for qemu-system-arm, as upcoming virtio support _will_ use device/chardev.
      3a2beaee
    • C
      qemu: Don't add default memballoon device on ARM · 7c961764
      Cole Robinson 提交于
      And add test cases for a basic working ARM guest.
      7c961764
    • C
      domain_conf: Add default memballoon in PostParse callbacks · d40cde31
      Cole Robinson 提交于
      This should be a no-op change for now.
      d40cde31
    • C
      qemu: Set QEMU_AUDIO_DRV=none with -nographic · a216e648
      Cole Robinson 提交于
      On my machine, a guest fails to boot if it has a sound card, but not
      graphical device/display is configured, because pulseaudio fails to
      initialize since it can't access $HOME.
      
      A workaround is removing the audio device, however on ARM boards there
      isn't any option to do that, so -nographic always fails.
      
      Set QEMU_AUDIO_DRV=none if no <graphics> are configured. Unfortunately
      this has massive test suite fallout.
      
      Add a qemu.conf parameter nographics_allow_host_audio, that if enabled
      will pass through QEMU_AUDIO_DRV from sysconfig (similar to
      vnc_allow_host_audio)
      a216e648
  11. 02 9月, 2013 3 次提交
  12. 31 8月, 2013 1 次提交
    • C
      qemu: Only setup vhost if virtType == "kvm" · d962318c
      Cole Robinson 提交于
      vhost only works in KVM mode at the moment, and is infact compiled
      out if the emulator is built for non-native architecture. While it
      may work at some point in the future for plain qemu, for now it's
      just noise on the command line (and which contributes to arm cli
      breakage).
      d962318c
  13. 29 8月, 2013 2 次提交
  14. 27 8月, 2013 3 次提交
    • J
      Build QEMU command line for pcihole64 · 63ee776f
      Ján Tomko 提交于
      QEMU commit 3984890 introduced the "pci-hole64-size" property,
      to i440FX-pcihost and q35-pcihost with a default setting of 2 GB.
      
      Translate <pcihole64>x<pcihole64/> to:
      -global q35-pcihost.pci-hole64-size=x for q35 machines and
      -global i440FX-pcihost.pci-hole64-size=x for i440FX-based machines.
      
      Error out on other machine types or if the size was specified
      but the pcihost device lacks 'pci-hole64-size' property.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=990418
      63ee776f
    • A
      Add ftp protocol support for cdrom disk · 796513d7
      Aline Manera 提交于
      The ftp protocol is already recognized by qemu/KVM so add this support to
      libvirt as well.
      The xml should be as following:
      
           <disk type='network' device='cdrom'>
             <source protocol='ftp' name='/url/path'>
               <host name='host.name' port='21'/>
             </source>
           </disk>
      Signed-off-by: NAline Manera <alinefm@br.ibm.com>
      796513d7
    • A
      Add http protocol support for cdrom disk · 3485ce4e
      Aline Manera 提交于
      QEMU/KVM already allows a HTTP URL for the cdrom ISO image so add this support
      to libvirt as well.
      The xml should be as following:
      
          <disk type='network' device='cdrom'>
            <source protocol='http' name='/url/path'>
              <host name='host.name' port='80'/>
            </source>
          </disk>
      Signed-off-by: NAline Manera <alinefm@br.ibm.com>
      3485ce4e
  15. 26 8月, 2013 1 次提交