1. 27 2月, 2015 1 次提交
  2. 26 2月, 2015 1 次提交
    • L
      qemu: fix ifindex array reported to systemd · 4bbe1029
      Laine Stump 提交于
      Commit f7afeddc added code to report to systemd an array of interface
      indexes for all tap devices used by a guest. Unfortunately it not only
      didn't add code to report the ifindexes for macvtap interfaces
      (interface type='direct') or the tap devices used by type='ethernet',
      it ended up sending "-1" as the ifindex for each macvtap or hostdev
      interface. This resulted in a failure to start any domain that had a
      macvtap or hostdev interface (or actually any type other than
      "network" or "bridge").
      
      This patch does the following with the nicindexes array:
      
      1) Modify qemuBuildInterfaceCommandLine() to only fill in the
      nicindexes array if given a non-NULL pointer to an array (and modifies
      the test jig calls to the function to send NULL). This is because
      there are tests in the test suite that have type='ethernet' and still
      have an ifname specified, but that device of course doesn't actually
      exist on the test system, so attempts to call virNetDevGetIndex() will
      fail.
      
      2) Even then, only add an entry to the nicindexes array for
      appropriate types, and to do so for all appropriate types ("network",
      "bridge", and "direct"), but only if the ifname is known (since that
      is required to call virNetDevGetIndex().
      4bbe1029
  3. 25 2月, 2015 1 次提交
    • M
      qemu: Use correct flags for ABI stability check in SaveImageUpdateDef · cf2d4c60
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1183869
      
      Soo. you've successfully started yourself a domain. And since you want
      to use it on your host exclusively you are confident enough to
      passthrough the host CPU model, like this:
      
        <cpu mode='host-passthrough'/>
      
      Then, after a while, you want to save the domain into a file (e.g.
      virsh save dom dom.save). And here comes the trouble. The file consist
      of two parts: Libvirt header (containing domain XML among other
      things), and qemu migration data. Now, the domain XML in the header is
      formatted using special flags (VIR_DOMAIN_XML_SECURE |
      VIR_DOMAIN_XML_UPDATE_CPU | VIR_DOMAIN_XML_INACTIVE |
      VIR_DOMAIN_XML_MIGRATABLE).
      
      Then, on your way back from the bar, you think of changing something
      in the XML in the saved file (we have a command for it after all), say
      listen address for graphics console. So you successfully type in the
      command:
      
        virsh save-image-edit dom.save
      
      Change all the bits, and exit the editor. But instead of success
      you're left with sad error message:
      
        error: unsupported configuration: Target CPU model <null> does not
        match source Pentium Pro
      
      Sigh. Digging into the code you see lines, where we check for ABI
      stability. The new XML you've produced is compared with the old one
      from the saved file to see if qemu ABI will break or not. Wait, what?
      We are using different flags to parse the XML you've provided so we
      were just lucky it worked in some cases? Yep, that's right.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      cf2d4c60
  4. 21 2月, 2015 2 次提交
  5. 19 2月, 2015 1 次提交
  6. 17 2月, 2015 1 次提交
  7. 12 2月, 2015 2 次提交
  8. 11 2月, 2015 1 次提交
    • 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
  9. 10 2月, 2015 4 次提交
  10. 03 2月, 2015 1 次提交
  11. 30 1月, 2015 3 次提交
    • T
      qemu: change macvtap device options in response to NIC_RX_FILTER_CHANGED · 79a87694
      Tony Krowiak 提交于
      This patch enables synchronization of the host macvtap
      device options with the guest device's in response to the
      NIC_RX_FILTER_CHANGED event.
      
      The following device options will be synchronized:
      * PROMISC
      * MULTICAST
      * ALLMULTI
      Signed-off-by: NTony Krowiak <akrowiak@linux.vnet.ibm.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      79a87694
    • J
      qemu: Don't unconditionally delete file in qemuOpenFileAs · 7879d031
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1158034
      
      If we're expecting to create a file somewhere and that fails for some
      reason during qemuOpenFileAs, then we unlink the path we're attempting
      to create leaving no way to determine what the "existing" privileges,
      protections, or labels are that caused the failure (open, change owner
      and group, change mode, etc.).
      
      Furthermore, if we fall into the path where we'll be opening / creating
      the file using VIR_FILE_OPEN_FORK, we need to first unlink/delete the file
      we created in the first path; otherwise, the attempt by the child process
      to open as some specific user:group may fail because the file was already
      created using nfsnobody:nfsnobody. Again, if we didn't create the file we
      don't want to blindly delete what already exists. Thus, a second reason for
      the original check to set need_unlink to false when we find the file with
      CREAT set, but already existing.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      7879d031
    • J
      qemu: Adjust EndAsyncJob for qemuDomainSaveInternal error path · 8ff38336
      John Ferlan 提交于
      Commit id '540c339a' to fix issues with reference counting and transient
      domains moved the qemuDomainObjEndAsyncJob call prior to the attempt to
      restart the guest CPU's resulting in an error:
      
          error: Failed to save domain rhel70 to /tmp/pl/rhel70.save
          error: internal error: unexpected async job 3
      
      when (ret != 0) - eg, the error path from qemuDomainSaveMemory.
      
      This patch will adjust the logic to call the EndAsyncJob only after
      we've tried to restart the guest CPUs. It also needs to adjust the
      test for qemuDomainRemoveInactive to add the ret == 0 condition.
      
      Additionally, if we get to endjob: because of some error earlier, then
      we need to save that error in the event the CPU restart logic fails.
      We don't want to return the error from CPU restart failure, rather we
      want to return the error from the failed save that caused us to fall
      into the retry to start the CPU logic.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      8ff38336
  12. 28 1月, 2015 1 次提交
  13. 27 1月, 2015 10 次提交
    • D
      qemu: report TAP device indexes to systemd · f7afeddc
      Daniel P. Berrange 提交于
      Record the index of each TAP device created and report them to
      systemd, so they show up in machinectl status for the VM.
      f7afeddc
    • D
      Removing probing of secondary drivers · 55ea7be7
      Daniel P. Berrange 提交于
      For stateless, client side drivers, it is never correct to
      probe for secondary drivers. It is only ever appropriate to
      use the secondary driver that is associated with the
      hypervisor in question. As a result the ESX & HyperV drivers
      have both been forced to do hacks where they register no-op
      drivers for the ones they don't implement.
      
      For stateful, server side drivers, we always just want to
      use the same built-in shared driver. The exception is
      virtualbox which is really a stateless driver and so wants
      to use its own server side secondary drivers. To deal with
      this virtualbox has to be built as 3 separate loadable
      modules to allow registration to work in the right order.
      
      This can all be simplified by introducing a new struct
      recording the precise set of secondary drivers each
      hypervisor driver wants
      
      struct _virConnectDriver {
          virHypervisorDriverPtr hypervisorDriver;
          virInterfaceDriverPtr interfaceDriver;
          virNetworkDriverPtr networkDriver;
          virNodeDeviceDriverPtr nodeDeviceDriver;
          virNWFilterDriverPtr nwfilterDriver;
          virSecretDriverPtr secretDriver;
          virStorageDriverPtr storageDriver;
      };
      
      Instead of registering the hypervisor driver, we now
      just register a virConnectDriver instead. This allows
      us to remove all probing of secondary drivers. Once we
      have chosen the primary driver, we immediately know the
      correct secondary drivers to use.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      55ea7be7
    • D
      Remove use of nwfilterPrivateData from nwfilter driver · 7b1ba956
      Daniel P. Berrange 提交于
      The nwfilter driver can rely on its global state instead
      of the connect private data.
      7b1ba956
    • P
      qemu: Fix job handling in qemuDomainSetMetadata · d13f56f0
      Peter Krempa 提交于
      The code modifies the domain configuration but doesn't take a MODIFY
      type job to do so.
      d13f56f0
    • P
      qemu: Fix job type in qemuDomainGetBlockIoTune · fb2ed975
      Peter Krempa 提交于
      The function just queries status so there's no need for a MODIFY type
      job.
      fb2ed975
    • P
      qemu: Fix job handling in qemuDomainSetSchedulerParametersFlags · c5ee5cfb
      Peter Krempa 提交于
      The code modifies the domain configuration but doesn't take a MODIFY
      type job to do so.
      c5ee5cfb
    • P
      qemu: Fix job handling in qemuDomainSetMemoryParameters · 4fd7a720
      Peter Krempa 提交于
      The code modifies the domain configuration but doesn't take a MODIFY
      type job to do so.
      4fd7a720
    • P
      qemu: Fix job handling in qemuDomainSetAutostart · e3e72743
      Peter Krempa 提交于
      The code modifies the domain configuration but doesn't take a MODIFY
      type job to do so.
      
      This patch also fixes a few very long lines of code around the touched
      parts.
      e3e72743
    • P
      qemu: Fix job handling in qemuDomainPinEmulator · 79e56033
      Peter Krempa 提交于
      The code modifies the domain configuration but doesn't take a MODIFY
      type job to do so.
      79e56033
    • P
      qemu: Fix job handling in qemuDomainPinVcpuFlags · 46d95044
      Peter Krempa 提交于
      The domain modifies the domain configuration but doesn't take a MODIFY
      type job to do it.
      46d95044
  14. 22 1月, 2015 2 次提交
  15. 19 1月, 2015 2 次提交
  16. 16 1月, 2015 1 次提交
  17. 15 1月, 2015 2 次提交
    • J
      Fix vmdef usage while in monitor in BlockStat* APIs · 3f213984
      Ján Tomko 提交于
      Make a local copy of the disk alias instead of pointing
      to the domain definition, which might get freed if
      the domain dies while we're in monitor.
      
      Also exit early if that happens.
      3f213984
    • J
      Fix vmdef usage while in monitor in qemuDomainHotplugVcpus · 051add2f
      Ján Tomko 提交于
      Exit the monitor right after we've done with it to get
      the virDomainObjPtr lock back, otherwise we might be accessing
      vm->def while it's being cleaned up by qemuProcessStop.
      
      If the domain crashed while we were in the monitor, exit
      early instead of changing vm->def which is now the persistent
      definition.
      051add2f
  18. 14 1月, 2015 3 次提交
    • P
      qemu_driver: fix setting vcpus for offline domain · e105dc98
      Pavel Hrdina 提交于
      Commit e3435caf fixed hot-plugging of vcpus with strict memory pinning
      on NUMA hosts, but unfortunately it also broke updating number of vcpus
      for offline guests using our API.
      
      The issue is that we try to create a cpu cgroup for non-running guest
      which fails as there are no cgroups for that domain. We should create
      cgroups and update cpuset.mems only if we are hot-plugging.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      e105dc98
    • S
      qemu: snapshot: inactive external snapshot can't work after libvirtd restart · 9f974858
      Shanzhi Yu 提交于
      When create inactive external snapshot, after update disk definitions,
      virDomainSaveConfig is needed, if not after restart libvirtd the new snapshot
      file definitions in xml will be lost.
      
      Reproduce steps:
      
      1. prepare a shut off guest
      $ virsh domstate rhel7 && virsh domblklist rhel7
      shut off
      
      Target     Source
      ------------------------------------------------
      vda        /var/lib/libvirt/images/rhel7.img
      
      2. create external disk snapshot
      $ virsh snapshot-create rhel7 --disk-only && virsh domblklist rhel7
      Domain snapshot 1417882967 created
      Target     Source
      ------------------------------------------------
      vda        /var/lib/libvirt/images/rhel7.1417882967
      
      3. restart libvirtd then check guest source file
      $ service  libvirtd restart && virsh domblklist rhel7
      Redirecting to /bin/systemctl restart  libvirtd.service
      Target     Source
      ------------------------------------------------
      vda        /var/lib/libvirt/images/rhel7.img
      
      This was first reported by Eric Blake
      http://www.redhat.com/archives/libvir-list/2014-December/msg00369.htmlSigned-off-by: NShanzhi Yu <shyu@redhat.com>
      9f974858
    • D
      Give virDomainDef parser & formatter their own flags · 0ecd6851
      Daniel P. Berrange 提交于
      The virDomainDefParse* and virDomainDefFormat* methods both
      accept the VIR_DOMAIN_XML_* flags defined in the public API,
      along with a set of other VIR_DOMAIN_XML_INTERNAL_* flags
      defined in domain_conf.c.
      
      This is seriously confusing & error prone for a number of
      reasons:
      
       - VIR_DOMAIN_XML_SECURE, VIR_DOMAIN_XML_MIGRATABLE and
         VIR_DOMAIN_XML_UPDATE_CPU are only relevant for the
         formatting operation
       - Some of the VIR_DOMAIN_XML_INTERNAL_* flags only apply
         to parse or to format, but not both.
      
      This patch cleanly separates out the flags. There are two
      distint VIR_DOMAIN_DEF_PARSE_* and VIR_DOMAIN_DEF_FORMAT_*
      flags that are used by the corresponding methods. The
      VIR_DOMAIN_XML_* flags received via public API calls must
      be converted to the VIR_DOMAIN_DEF_FORMAT_* flags where
      needed.
      
      The various calls to virDomainDefParse which hardcoded the
      use of the VIR_DOMAIN_XML_INACTIVE flag change to use the
      VIR_DOMAIN_DEF_PARSE_INACTIVE flag.
      0ecd6851
  19. 13 1月, 2015 1 次提交
    • E
      qemu: forbid second blockcommit during active commit · e1125ceb
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1135339 documents some
      confusing behavior when a user tries to start an inactive block
      commit in a second connection while there is already an on-going
      active commit from a first connection.  Eventually, qemu will
      support multiple simultaneous block jobs, but as of now, it does
      not; furthermore, libvirt also needs an overhaul before we can
      support simultaneous jobs.  So, the best way to avoid confusing
      ourselves is to quit relying on qemu to tell us about the situation
      (where we risk getting in weird states) and instead forbid a
      duplicate block commit ourselves.
      
      Note that we are still relying on qemu to diagnose attempts to
      interrupt an inactive commit (since we only track XML of an active
      commit), but as inactive commit is less confusing for libvirt to
      manage, there is less that can go wrong by leaving that detection
      up to qemu.
      
      * src/qemu/qemu_driver.c (qemuDomainBlockCommit): Hoist check for
      active commit to occur earlier outside of conditions.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e1125ceb