1. 03 5月, 2017 3 次提交
    • M
      qemuDomainCreateDeviceRecursive: Don't try to create devices under preserved mount points · e30dbf35
      Michal Privoznik 提交于
      While the code allows devices to already be there (by some
      miracle), we shouldn't try to create devices that don't belong to
      us. For instance, we shouldn't try to create /dev/shm/file
      because /dev/shm is a mount point that is preserved. Therefore if
      a file is created there from an outside (e.g. by mgmt application
      or some other daemon running on the system like vhostmd), it
      exists in the qemu namespace too as the mount point is the same.
      It's only /dev and /dev only that is different. The same
      reasoning applies to all other preserved mount points.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NCedric Bosdonnat <cbosdonnat@suse.com>
      e30dbf35
    • M
      qemuDomainCreateDeviceRecursive: pass a structure instead of bare path · 26c14be8
      Michal Privoznik 提交于
      Currently, all we need to do in qemuDomainCreateDeviceRecursive() is to
      take given @device, get all kinds of info on it (major & minor numbers,
      owner, seclabels) and create its copy at a temporary location @path
      (usually /var/run/libvirt/qemu/$domName.dev), if @device live under
      /dev. This is, however, very loose condition, as it also means
      /dev/shm/* is created too. Therefor, we will need to pass more arguments
      into the function for better decision making (e.g. list of mount points
      under /dev). Instead of adding more arguments to all the functions (not
      easily reachable because some functions are callback with strictly
      defined type), lets just turn this one 'const char *' into a 'struct *'.
      New "arguments" can be then added at no cost.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NCedric Bosdonnat <cbosdonnat@suse.com>
      26c14be8
    • M
      qemuDomainBuildNamespace: Move /dev/* mountpoints later · a7cc039d
      Michal Privoznik 提交于
      When setting up mount namespace for a qemu domain the following
      steps are executed:
      
      1) get list of mountpoints under /dev/
      2) move them to /var/run/libvirt/qemu/$domName.ext
      3) start constructing new device tree under /var/run/libvirt/qemu/$domName.dev
      4) move the mountpoint of the new device tree to /dev
      5) restore original mountpoints from step 2)
      
      Note the problem with this approach is that if some device in step
      3) requires access to a mountpoint from step 2) it will fail as
      the mountpoint is not there anymore. For instance consider the
      following domain disk configuration:
      
          <disk type='file' device='disk'>
            <driver name='qemu' type='raw'/>
            <source file='/dev/shm/vhostmd0'/>
            <target dev='vdb' bus='virtio'/>
            <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
          </disk>
      
      In this case operation fails as we are unable to create vhostmd0
      in the new device tree because after step 2) there is no /dev/shm
      anymore. Leave aside fact that we shouldn't try to create devices
      living in other mountpoints. That's a separate bug that will be
      addressed later.
      
      Currently, the order described above is rearranged to:
      
      1) get list of mountpoints under /dev/
      2) start constructing new device tree under /var/run/libvirt/qemu/$domName.dev
      3) move them to /var/run/libvirt/qemu/$domName.ext
      4) move the mountpoint of the new device tree to /dev
      5) restore original mountpoints from step 3)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NCedric Bosdonnat <cbosdonnat@suse.com>
      a7cc039d
  2. 28 4月, 2017 5 次提交
  3. 27 4月, 2017 1 次提交
  4. 24 4月, 2017 1 次提交
  5. 21 4月, 2017 1 次提交
    • M
      conf, docs: Add support for coalesce setting(s) · 523c9960
      Martin Kletzander 提交于
      We are currently parsing only rx/frames/max because that's the only
      value that makes sense for us.  The tun device just added support for
      this one and the others are only supported by hardware devices which
      we don't need to worry about as the only way we'd pass those to the
      domain is using <hostdev/> or <interface type='hostdev'/>.  And in
      those cases the guest can modify the settings itself.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      523c9960
  6. 20 4月, 2017 1 次提交
    • P
      qemu_domain: use correct default USB controller on ppc64 · 90acbc76
      Pavel Hrdina 提交于
      The history of USB controller for ppc64 guest is complex and goes
      back to libvirt 1.3.1 where the fun started.
      
      Prior Libvirt 1.3.1 if no model for USB controller was specified
      we've simply passed "-usb" on QEMU command line.
      
      Since Libvirt 1.3.1 there is a patch (8156493d) that fixes this
      issue by using "-device pci-ohci,..." but it breaks migration with
      older Libvirts which was agreed that's acceptable.  However this
      patch didn't reflect this change in the domain XML and the model
      was still missing.
      
      Since Libvirt 2.2.0 there is a patch (f55eaccb) that fixes the
      issue with not setting the USB model into domain XML which we need
      to know about to not break the migration and since the default
      model was *pci-ohci* it was used as default in this patch as well.
      
      This patch tries to take all the previous changes into account and
      also change the default for newly defined domains that don't specify
      any model for USB controller.
      
      The VIR_DOMAIN_DEF_PARSE_ABI_UPDATE is set only if new domain is
      defined or new device is added into a domain which means that in
      all other cases we will use the old *pci-ohci* model instead of the
      better and not broken *nec-usb-xhci* model.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1373184Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      90acbc76
  7. 18 4月, 2017 1 次提交
    • P
      qemu: refactor qemuDomainMachine* functions · ac97658d
      Pavel Hrdina 提交于
      Introduce new wrapper functions without *Machine* in the function
      name that take the whole virDomainDef structure as argument and
      call the existing functions with *Machine* in the function name.
      
      Change the arguments of existing functions to *machine* and *arch*
      because they don't need the whole virDomainDef structure and they
      could be used in places where we don't have virDomainDef.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      ac97658d
  8. 10 4月, 2017 1 次提交
  9. 03 4月, 2017 2 次提交
    • A
      qemu: Enforce ACPI, UEFI requirements · 396ca36c
      Andrea Bolognani 提交于
      Depending on the architecture, requirements for ACPI and UEFI can
      be different; more specifically, while on x86 UEFI requires ACPI,
      on aarch64 it's the other way around.
      
      Enforce these requirements when validating the domain, and make
      the error message more accurate by mentioning that they're not
      necessarily applicable to all architectures.
      
      Several aarch64 test cases had to be tweaked because they would
      have failed the validation step otherwise.
      396ca36c
    • M
      Introduce and use virDomainDiskEmptySource · 462c4b66
      Michal Privoznik 提交于
      Currently, if we want to zero out disk source (e,g, due to
      startupPolicy when starting up a domain) we use
      virDomainDiskSetSource(disk, NULL). This works well for file
      based storage (storage type file, dir, or block). But it doesn't
      work at all for other types like volume and network.
      
      So imagine that you have a domain that has a CDROM configured
      which source is a volume from an inactive pool. Because it is
      startupPolicy='optional', the CDROM is empty when the domain
      starts. However, the source element is not cleared out in the
      status XML and thus when the daemon restarts and tries to
      reconnect to the domain it refreshes the disks (which fails - the
      storage pool is still not running) and thus the domain is killed.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      462c4b66
  10. 29 3月, 2017 1 次提交
  11. 28 3月, 2017 3 次提交
  12. 27 3月, 2017 6 次提交
  13. 25 3月, 2017 1 次提交
    • J
      qemu: Set up the migration TLS objects for target · 1a6b6d9a
      John Ferlan 提交于
      If the migration flags indicate this migration will be using TLS,
      then set up the destination during the prepare phase once the target
      domain has been started to add the TLS objects to perform the migration.
      
      This will create at least an "-object tls-creds-x509,endpoint=server,..."
      for TLS credentials and potentially an "-object secret,..." to handle the
      passphrase response to access the TLS credentials. The alias/id used for
      the TLS objects will contain "libvirt_migrate".
      
      Once the objects are created, the code will set the "tls-creds" and
      "tls-hostname" migration parameters to signify usage of TLS.
      
      During the Finish phase we'll be sure to attempt to clear the
      migration parameters and delete those objects (whether or not they
      were created). We'll also perform the same reset during recovery
      if we've reached FINISH3.
      
      If the migration isn't using TLS, then be sure to check if the
      migration parameters exist and clear them if so.
      1a6b6d9a
  14. 17 3月, 2017 1 次提交
  15. 16 3月, 2017 1 次提交
  16. 15 3月, 2017 2 次提交
    • M
      qemu: Implement NVDIMM · 1bc17319
      Michal Privoznik 提交于
      So, majority of the code is just ready as-is. Well, with one
      slight change: differentiate between dimm and nvdimm in places
      like device alias generation, generating the command line and so
      on.
      
      Speaking of the command line, we also need to append 'nvdimm=on'
      to the '-machine' argument so that the nvdimm feature is
      advertised in the ACPI tables properly.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      1bc17319
    • M
      Introduce NVDIMM memory model · b4e8a49f
      Michal Privoznik 提交于
      NVDIMM is new type of memory introduced into QEMU 2.6. The idea
      is that we have a Non-Volatile memory module that keeps the data
      persistent across domain reboots.
      
      At the domain XML level, we already have some representation of
      'dimm' modules. Long story short, NVDIMM will utilize the
      existing <memory/> element that lives under <devices/> by adding
      a new attribute 'nvdimm' to the existing @model and introduce a
      new <path/> element for <source/> while reusing other fields. The
      resulting XML would appear as:
      
          <memory model='nvdimm'>
            <source>
              <path>/tmp/nvdimm</path>
            </source>
            <target>
              <size unit='KiB'>523264</size>
              <node>0</node>
            </target>
            <address type='dimm' slot='0'/>
          </memory>
      
      So far, this is just a XML parser/formatter extension. QEMU
      driver implementation is in the next commit.
      
      For more info on NVDIMM visit the following web page:
      
          http://pmem.io/Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      b4e8a49f
  17. 13 3月, 2017 1 次提交
  18. 10 3月, 2017 1 次提交
    • M
      qemuProcessHandleMonitorEOF: Disable namespace for domain · e915942b
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1430634
      
      If a qemu process has died, we get EOF on its monitor. At this
      point, since qemu process was the only one running in the
      namespace kernel has already cleaned the namespace up. Any
      attempt of ours to enter it has to fail.
      
      This really happened in the bug linked above. We've tried to
      attach a disk to qemu and while we were in the monitor talking to
      qemu it just died. Therefore our code tried to do some roll back
      (e.g. deny the device in cgroups again, restore labels, etc.).
      However, during the roll back (esp. when restoring labels) we
      still thought that domain has a namespace. So we used secdriver's
      transactions. This failed as there is no namespace to enter.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      e915942b
  19. 09 3月, 2017 4 次提交
    • P
      conf: store "autoGenerated" for graphics listen in status XML · cd4a8b93
      Pavel Hrdina 提交于
      When libvirtd is started we call qemuDomainRecheckInternalPaths
      to detect whether a domain has VNC socket path generated by libvirt
      based on option from qemu.conf.  However if we are parsing status XML
      for running domain the existing socket path can be generated also if
      the config XML uses the new <listen type='socket'/> element without
      specifying any socket.
      
      The current code doesn't make difference how the socket was generated
      and always marks it as "fromConfig".  We need to store the
      "autoGenerated" value in the status XML in order to preserve that
      information.
      
      The difference between "fromConfig" and "autoGenerated" is important
      for migration, because if the socket is based on "fromConfig" we don't
      print it into the migratable XML and we assume that user has properly
      configured qemu.conf on both hosts.  However if the socket is based
      on "autoGenerated" it means that a new feature was used and therefore
      we need to leave the socket in migratable XML to make sure that if
      this feature is not supported on destination the migration will fail.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      cd4a8b93
    • J
      qemu: Rename variable · b2e5de96
      John Ferlan 提交于
      Rename 'secretUsageType' to 'usageType' since it's superfluous in an
      API qemu*Secret*
      b2e5de96
    • J
      qemu: Introduce qemuDomainSecretInfoTLSNew · 7c2b7891
      John Ferlan 提交于
      Building upon the qemuDomainSecretInfoNew, create a helper which will
      build the secret used for TLS.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      7c2b7891
    • J
      qemu: Introduce qemuDomainSecretInfoNew · c9a7b7b6
      John Ferlan 提交于
      Create a helper which will create the secinfo used for disks, hostdevs,
      and chardevs.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      c9a7b7b6
  20. 07 3月, 2017 2 次提交
  21. 06 3月, 2017 1 次提交
    • M
      qemu: Enforce qemuSecurity wrappers · 4da534c0
      Michal Privoznik 提交于
      Now that we have some qemuSecurity wrappers over
      virSecurityManager APIs, lets make sure everybody sticks with
      them. We have them for a reason and calling virSecurityManager
      API directly instead of wrapper may lead into accidentally
      labelling a file on the host instead of namespace.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      4da534c0