1. 20 2月, 2015 2 次提交
  2. 19 2月, 2015 8 次提交
    • M
      parallels: Set the first HDD from XML as bootable · 675fa6b3
      Mikhail Feoktistov 提交于
      1. Delete all boot devices for VM instance
      2. Find the first HDD from XML and set it as bootable
      
      Now we support only one boot device and it should be HDD.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      675fa6b3
    • M
      6783cf63
    • M
      parallels: code aligment · 0268eabd
      Mikhail Feoktistov 提交于
      0268eabd
    • J
      Search for schemas and cpu_map.xml in source tree · bc6e2063
      Jiri Denemark 提交于
      Not all files we want to find using virFileFindResource{,Full} are
      generated when libvirt is built, some of them (such as RNG schemas) are
      distributed with sources. The current API was not able to find source
      files if libvirt was built in VPATH.
      
      Both RNG schemas and cpu_map.xml are distributed in source tarball.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      bc6e2063
    • M
      qemuMigrationDriveMirror: Listen to events · 80c5f10e
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1179678
      
      When migrating with storage, libvirt iterates over domain disks and
      instruct qemu to migrate the ones we are interested in (shared, RO and
      source-less disks are skipped). The disks are migrated in series. No
      new disk is transferred until the previous one hasn't been quiesced.
      This is checked on the qemu monitor via 'query-jobs' command. If the
      disk has been quiesced, it practically went from copying its content
      to mirroring state, where all disk writes are mirrored to the other
      side of migration too. Having said that, there's one inherent error in
      the design. The monitor command we use reports only active jobs. So if
      the job fails for whatever reason, we will not see it anymore in the
      command output. And this can happen fairly simply: just try to migrate
      a domain with storage. If the storage migration fails (e.g. due to
      ENOSPC on the destination) we resume the host on the destination and
      let it run on partly copied disk.
      
      The proper fix is what even the comment in the code says: listen for
      qemu events instead of polling. If storage migration changes state an
      event is emitted and we can act accordingly: either consider disk
      copied and continue the process, or consider disk mangled and abort
      the migration.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      80c5f10e
    • M
      qemuProcessHandleBlockJob: Take status into account · 76c61cdc
      Michal Privoznik 提交于
      Upon BLOCK_JOB_COMPLETED event delivery, we check if the job has
      completed (in qemuMonitorJSONHandleBlockJobImpl()). For better image,
      the event looks something like this:
      
      "timestamp": {"seconds": 1423582694, "microseconds": 372666}, "event":
      "BLOCK_JOB_COMPLETED", "data": {"device": "drive-virtio-disk0", "len":
      8412790784, "offset": 409993216, "speed": 8796093022207, "type":
      "mirror", "error": "No space left on device"}}
      
      If "len" does not equal "offset" it's considered an error, and we can
      clearly see "error" field filled in. However, later in the event
      processing this case was handled no differently to case of job being
      aborted via separate API. It's time that we start differentiate these
      two because of the future work.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      76c61cdc
    • M
      qemuProcessHandleBlockJob: Set disk->mirrorState more often · c37943a0
      Michal Privoznik 提交于
      Currently, upon BLOCK_JOB_* event, disk->mirrorState is not updated
      each time. The callback code handling the events checks if a blockjob
      was started via our public APIs prior to setting the mirrorState.
      However, some block jobs may be started internally (e.g. during
      storage migration), in which case we don't bother with setting
      disk->mirror (there's nothing we can set it to anyway), or other
      fields. But it will come handy if we update the mirrorState in these
      cases too. The event wasn't delivered just for fun - we've started the
      job after all.
      
      So, in this commit, the mirrorState is set to whatever job status
      we've obtained. Of course, there are some actions on some statuses
      that we want to perform. But instead of if {} else if {} else {} ...
      enumeration, let's move to switch().
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      c37943a0
    • P
      qemu: Exit job on error path of qemuDomainSetVcpusFlags() · 0df2f040
      Peter Krempa 提交于
      Commit e105dc98 moved some code but
      didn't adjust the jump labels so that the job would be terminated.
      0df2f040
  3. 17 2月, 2015 6 次提交
  4. 14 2月, 2015 5 次提交
    • J
      libxl: Resolve Coverity CHECKED_RETURN · 4438646c
      John Ferlan 提交于
      Periodically my Coverity scan will return a checked_return failure
      for libxlDomainShutdownThread call to libxlDomainStart. Followed the
      libxlAutostartDomain example in order to check the status, emit a
      message, and continue on.
      4438646c
    • J
      security: Resolve Coverity RESOURCE_LEAK · 5a36cdbc
      John Ferlan 提交于
      Introduced by commit id 'c3d9d3bb' - return from virSecurityManagerCheckModel
      wasn't VIR_FREE()'ing the virSecurityManagerGetNested allocated memory.
      5a36cdbc
    • L
      lxc: Fix container cleanup for LXCProcessStart · 8e6492f2
      Luyao Huang 提交于
      Jumping to the cleanup label prior to starting the container failed to
      properly clean everything up that is handled by the virLXCProcessCleanup
      which is called if virLXCProcessStop is called on failure after the
      container properly starts. Most importantly is prior to this patch none
      of the stop/release hooks, host device reattachment, and network cleanup
      (that is reverse of virLXCProcessSetupInterfaces).
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      8e6492f2
    • J
      lxc: Modify/add some debug messages · 2b8e018a
      John Ferlan 提交于
      Modify the VIR_DEBUG message in virLXCProcessCleanup to make it clearer
      about the path.  Also add some more VIR_DEBUG messages in virLXCProcessStart
      in order to help debug error flow.
      2b8e018a
    • L
      lxc: Move console checks in LXCProcessStart · 72129907
      Luyao Huang 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1176503
      
      Move the two console checks - one for zero nconsoles present and the
      other for an invalid console type to earlier in the processing rather than
      getting after performing some setup that has to be undone for what amounts
      to an invalid configuration.
      
      This resolves the above bug since it's not not possible to have changed
      the security labels when we cause the configuration check failure.
      72129907
  5. 13 2月, 2015 6 次提交
  6. 12 2月, 2015 11 次提交
    • D
      Allow shrinking of file based volumes · aa9aa6a9
      Daniel P. Berrange 提交于
      While the main storage driver code allows the flag
      VIR_STORAGE_VOL_RESIZE_SHRINK to be set, none of the backend
      drivers are supporting it. At the very least this can work
      for plain file based volumes since we just ftruncate() them
      to the new size. It does not work with qcow2 volumes, but we
      can arguably delegate to qemu-img for error reporting for that
      instead of second guessing this for ourselves:
      
      $ virsh vol-resize --shrink /home/berrange/VirtualMachines/demo.qcow2 2G
      error: Failed to change size of volume 'demo.qcow2' to 2G
      
      error: internal error: Child process (/usr/bin/qemu-img resize /home/berrange/VirtualMachines/demo.qcow2 2147483648) unexpected exit status 1: qemu-img: qcow2 doesn't support shrinking images yet
      qemu-img: This image does not support resize
      
      See also https://bugzilla.redhat.com/show_bug.cgi?id=1021802
      aa9aa6a9
    • D
      qemu: do upfront check for vcpupids being null when querying pinning · 9358b63a
      Daniel P. Berrange 提交于
      The qemuDomainHelperGetVcpus attempted to report an error when the
      vcpupids info was NULL. Unfortunately earlier code would clamp the
      value of 'maxinfo' to 0 when nvcpupids was 0, so the error reporting
      would end up being skipped.
      
      This lead to 'virsh vcpuinfo <dom>' just returning an empty list
      instead of giving the user a clear error.
      9358b63a
    • D
      qemu: fix setting of VM CPU affinity with TCG · a103bb10
      Daniel P. Berrange 提交于
      If a previous commit I fixed the incorrect handling of vcpu pids
      for TCG mode QEMU:
      
        commit b07f3d82
        Author: Daniel P. Berrange <berrange@redhat.com>
        Date:   Thu Dec 18 16:34:39 2014 +0000
      
          Don't setup fake CPU pids for old QEMU
      
          The code assumes that def->vcpus == nvcpupids, so when we setup
          fake CPU pids for old QEMU with nvcpupids == 1, we cause the
          later code to read off the end of the array. This has fun results
          like sche_setaffinity(0, ...) which changes libvirtd's own CPU
          affinity, or even better sched_setaffinity($RANDOM, ...) which
          changes the affinity of a random OS process.
      
      The intent was that this would merely disable the ability to set
      per-vCPU affinity. It should still have been possible to set VM
      level host CPU affinity.
      
      Unfortunately, when you set  <vcpu cpuset='0-1'>4</vcpu>, the XML
      parser will internally take this & initialize an entry in the
      def->cputune.vcpupin array for every VCPU. IOW this is implicitly
      being treated as
      
        <cputune>
          <vcpupin cpuset='0-1' vcpu='0'/>
          <vcpupin cpuset='0-1' vcpu='1'/>
          <vcpupin cpuset='0-1' vcpu='2'/>
          <vcpupin cpuset='0-1' vcpu='3'/>
        </cputune>
      
      Even more fun, the faked cputune elements are hidden from view when
      querying the live XML, because their cpuset mask is the same as the
      VM default cpumask.
      
      The upshot was that it was impossible to set VM level CPU affinity.
      
      To fix this we must update qemuProcessSetVcpuAffinities so that it
      only reports a fatal error if the per-VCPU cpu mask is different
      from the VM level cpu mask.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      a103bb10
    • M
      libxl: disable VNC and SDL until explicitly enabled · 98780c6b
      Marek Marczykowski-Górecki 提交于
      When initializing a libxl_domain_build_info struct with
      libxl_domain_build_info_init(), VNC is enabled by default.  As a
      result, VMs configured with no graphics still have VNC enabled.
      This behavior is a regression wrt to the legacy Xen driver.
      Signed-off-by: NMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
      98780c6b
    • M
      libxl: pass ipaddr to libxl toolstack · 8703ee58
      Marek Marczykowski-Górecki 提交于
      Do not silently ignore its value. LibXL support only one address, so
      refuse multiple IPs.
      Signed-off-by: NMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
      8703ee58
    • M
    • M
      docs, schema, conf: Add support for setting scheduler parameters of guest threads · 8680ea97
      Martin Kletzander 提交于
      In order for QEMU vCPU (and other) threads to run with RT scheduler,
      libvirt needs to take care of that so QEMU doesn't have to run privileged.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1178986Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      8680ea97
    • M
      util: Add virProcessSetScheduler() function for scheduler settings · b6a2828e
      Martin Kletzander 提交于
      This function uses sched_setscheduler() function so it works with
      processes and threads as well (even threads not created by us, which is
      what we'll need in the future).
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      b6a2828e
    • L
      domain: include portgroup in interface status xml · 89d26890
      Laine Stump 提交于
      Prior to commit 7d5bf484 (first appearing in libvirt 1.2.2), the
      status XML of a domain's interface was missing a lot of important
      information; mainly it just output the config of the interface, plus
      the name of the tap device and qemu device alias. Commit 7d5bf484
      changed the status XML to include many important bits of information
      that were required to make network "hook" scripts useful - bandwidth
      information, vlan tag, the name of the bridge (or physical device in
      the case of macvtap) that the tap/macvtap device was attached to - the
      commit log for 7d5bf484 has a very detailed explanation of the
      change. For quick reference - in the example given there, prior to the
      change, status XML looked like figure [C]:
      
            <interface type='network'>
              <source network='testnet' portgroup='admin'/>
              <target dev='macvtap0'/>
              <alias name='net0'/>
              <address type='pci' domain='0x0000' bus='0x00'
                       slot='0x03' function='0x0'/>
            </interface>
      
      and after the change, it looked like figure [E]:
      
            <interface type='direct'>
              <source dev='p4p1_0' mode='bridge'/>
              <bandwidth>
                  <inbound average='1000' peak='5000' burst='1024'/>
                  <outbound average='128' peak='256' burst='256'/>
              </bandwidth>
              <target dev='macvtap0'/>
              <alias name='net0'/>
              <address type='pci' domain='0x0000' bus='0x00'
                       slot='0x03' function='0x0'/>
            </interface>
      
      You'll notice that bandwidth info, physdev, and macvtap mode have been
      added, but the network and portgroup names are now missing - I didn't
      think that this information was of any use once the needed
      bandwidth/vlan/etc config had been pulled from the network/portgroup.
      
      I was wrong.
      
      A few months after that change a user on IRC asked what happened to
      portgroup in the status XML and described how he used it (more or less
      as a tag to decide what external information to use in a hook script
      that was run at startup/migration time - see
      http://wiki.libvirt.org/page/OVS_and_PVLANS ). At that time I planned
      to make a patch to re-add portgroup, but life intervened as that was
      just prior to a transatlantic move involving several weeks of
      "vacation". During this time I somehow forgot to make the patch, and
      also mistakenly remembered that I *had* made it.
      
      Subsequent to this, as a part of mprivozn's work to add support for
      network-specific hooks, I did re-add the output of the network name in
      status XML, but once again completely forgot about portgroup. This was
      in commit a3609121 (first appearing in libvirt 1.2.11). This made the
      status XML from the above example look like this:
      
            <interface type='direct'>
              <source network='testnet' dev='p4p1_0' mode='bridge'/>
              <bandwidth>
                  <inbound average='1000' peak='5000' burst='1024'/>
                  <outbound average='128' peak='256' burst='256'/>
              </bandwidth>
              <target dev='macvtap0'/>
              <alias name='net0'/>
              <address type='pci' domain='0x0000' bus='0x00'
                       slot='0x03' function='0x0'/>
            </interface>
      
      *This* patch just adds the portgroup back to the status XML, so the
       same example interface will look like this:
      
            <interface type='direct'>
              <source network='testnet' portgroup='admin'
                      dev='p4p1_0' mode='bridge'/>
              <bandwidth>
                  <inbound average='1000' peak='5000' burst='1024'/>
                  <outbound average='128' peak='256' burst='256'/>
              </bandwidth>
              <target dev='macvtap0'/>
              <alias name='net0'/>
              <address type='pci' domain='0x0000' bus='0x00'
                       slot='0x03' function='0x0'/>
            </interface>
      
      The result is that the status XML now contains all information about
      how the interface is setup (bandwidth, physical device, tap device,
      etc), in addition to pointers to its origin (the network and
      portgroup).
      89d26890
    • L
      domain: avoid potential memory leak in virDomainGraphicsListenSet*() · 6d1194ff
      Laine Stump 提交于
      virDomainGraphicsListenSetAddress() and
      virDomainGraphicsListenSetNetwork() both set their respective char* to
      NULL directly when asked to set it to NULL, which is okay as long as
      it's already set to NULL. If these functions are ever called to clear
      a listen object that has a valid string in address or network, it will
      end up leaking the old value. Currently that doesn't happen, so this
      is just a preemptive strike.
      6d1194ff
    • L
      domain: backfill listen address to parent <graphics> listen attribute · 69929941
      Laine Stump 提交于
      Prior to 0.9.4, libvirt only supported a single listen, and it had to
      be an IP address:
      
         <graphics listen='1.2.3.4' ..../>
      
      Starting with 0.9.4, a graphics element could have a <listen>
      subelement (actually the grammar supports multiples, but all of the
      drivers only support a single <listen> per <graphics>), and that
      listen element can be of type='address' or type='network'. For
      type='address', <listen> also has an attribute called 'address' which
      contains the IP address for listening:
      
          <graphics ....>
            <listen type='address' address='1.2.3.4' .../>
          </graphics>
      
      type can also be "network", and in that case listen will have a
      "network" attribute which will contain the name of a libvirt
      network:
      
          <graphics ....>
            <listen type='network' network='testnet' .../>
          </graphics>
      
      At domain start (or migrate) time, libvirt will attempt to
      find an IP address associated with that network (e.g. the IP address
      of the bridge device used by the network, or the physical device
      listed in <forward dev='physdev'/>) and fill in that address in the
      status XML:
      
          <graphics ....>
            <listen type='network' network='testnet' address='1.2.3.4' .../>
          </graphics>
      
      In the case that a <graphics> element has a <listen> subelement of
      type='address', that listen subelement's "address" attribute is
      backfilled into the parent graphics element's "listen" *attribute* for
      backward compatibility (so that a management application unaware of
      the separate <listen> element can still learn the listen
      address). This backfill should be done with the IP learned from
      type='network' as well, and that's what this patch does:
      
          <graphics listen='1.2.3.4' ....>
            <listen type='network' network='testnet' address='1.2.3.4' .../>
          </graphics>
      
      This is a continuation of the fix for:
      
         https://bugzilla.redhat.com/show_bug.cgi?id=1191016
      69929941
  7. 11 2月, 2015 2 次提交
    • J
      qemu: qemuOpenFileAs - set flag VIR_FILE_OPEN_FORCE_MODE · 92f09dab
      John Ferlan 提交于
      In the event we're falling into the code that tries to create the file
      in a forked environment (VIR_FILE_OPEN_FORK) we pass different mode bits,
      but those are never set because the virFileOpenForceOwnerMode has a check
      if the OPEN_FORCE_MODE bit is set before attempting to change the mode.
      
      Since this is a special case it seems reasonable to set u+rw,g+rw,o
      92f09dab
    • J
      virfile: Adjust error path for virFileOpenForked · 92d9114e
      John Ferlan 提交于
      Rather than have a dummy waitpid loop and return of the failure status
      from recvfd, adjust the logic to save the recvfd error & fd and then
      in priority order:
      
      - if waitpid failed, use that errno value
      - waitpid succeeded, but if the child exited abnormally, report failure
      (use EACCES to report as return failure, since either EACCES or EPERM is
      what caused us to fall into the fork+setuid path)
      - waitpid succeeded, but if the child reported non-zero status, report
      failure (use the errno value that the child encoded into exit status)
      - waitpid succeeded, but if recvfd failed, report recvfd_errno
      - waitpid and recvfd succeeded, use the fd
      
      NOTE: Original logic to retry the open and force owner mode was
      "documented" as only being attempted if we had already tried opening
      with the fork+setuid, but checked flags vs. VIR_FILE_OPEN_NOFORK which
      is counter to how we would get to that point. So that code was removed.
      92d9114e