1. 16 4月, 2019 1 次提交
    • D
      network: restrict usage of port management APIs · dd52444f
      Daniel P. Berrangé 提交于
      The port allocation APIs are currently called unconditionally for all
      types of NIC, but (mostly) only do anything for NICs with type=network.
      
      The exception is the port allocate API which does some validation even
      for NICs with type!=network. Relying on this validation is flawed,
      however, since the network driver may not even be installed. IOW virt
      drivers must not delegate validation to the network driver for NICs
      with type != network.
      
      This change allows us to report errors when the virtual network driver
      is not registered.
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      dd52444f
  2. 12 4月, 2019 1 次提交
  3. 10 4月, 2019 2 次提交
  4. 14 3月, 2019 1 次提交
  5. 04 2月, 2019 1 次提交
  6. 14 12月, 2018 1 次提交
    • D
      Remove all Author(s): lines from source file headers · 60046283
      Daniel P. Berrangé 提交于
      In many files there are header comments that contain an Author:
      statement, supposedly reflecting who originally wrote the code.
      In a large collaborative project like libvirt, any non-trivial
      file will have been modified by a large number of different
      contributors. IOW, the Author: comments are quickly out of date,
      omitting people who have made significant contribitions.
      
      In some places Author: lines have been added despite the person
      merely being responsible for creating the file by moving existing
      code out of another file. IOW, the Author: lines give an incorrect
      record of authorship.
      
      With this all in mind, the comments are useless as a means to identify
      who to talk to about code in a particular file. Contributors will always
      be better off using 'git log' and 'git blame' if they need to  find the
      author of a particular bit of code.
      
      This commit thus deletes all Author: comments from the source and adds
      a rule to prevent them reappearing.
      
      The Copyright headers are similarly misleading and inaccurate, however,
      we cannot delete these as they have legal meaning, despite being largely
      inaccurate. In addition only the copyright holder is permitted to change
      their respective copyright statement.
      Reviewed-by: NErik Skultety <eskultet@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      60046283
  7. 11 12月, 2018 1 次提交
    • M
      libxl: handle external domain destroy · fa30ee04
      Marek Marczykowski-Górecki 提交于
      If domain is killed with `xl destroy`, libvirt will not notice it and
      still report the domain as running. Also trying to destroy the domain
      through libvirt will fail. The only way to recover from such a situation
      is to restart libvirt daemon. The problem is that even though libxl
      report LIBXL_EVENT_TYPE_DOMAIN_DEATH, libvirt ignore it as all the
      domain cleanup is done in a function actually destroying the domain. If
      destroy is done outside of libvirt, there is no place where it would be
      handled.
      
      Fix this by doing domain cleanup in LIBXL_EVENT_TYPE_DOMAIN_DEATH too.
      To avoid doing it twice, add a ignoreDeathEvent flag
      libxlDomainObjPrivate, set when the domain death is triggered by libvirt
      itself.
      Signed-off-by: NMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
      Reviewed-by: NJim Fehlig <jfehlig@suse.com>
      fa30ee04
  8. 07 11月, 2018 4 次提交
  9. 15 9月, 2018 1 次提交
    • J
      libxl: drop support for Xen < 4.6 · 5bdcef13
      Jim Fehlig 提交于
      Currently the libxl driver claims support for Xen >= 4.4, but
      Xen 4.4 and 4.5 are no longer supported upstream. Let's increase
      the minimum supported Xen version to 4.6 and change the defined
      LIBXL_API_VERSION to 0x040500, which is the API version defined
      when Xen 4.6 was released.
      
      Since Xen 4.6 contains a pkgconfig file, drop the now unused code
      that falls back to using LIBVIRT_CHECK_LIB in the absence of
      pkgconfig file. In addition, bumping the LIBXL_API_VERSION
      required adjusting the calls to libxl_set_vcpuaffinity to account
      for the extra parameter in the 0x040500 version of the API.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      5bdcef13
  10. 10 9月, 2018 1 次提交
  11. 13 6月, 2018 1 次提交
  12. 05 6月, 2018 1 次提交
    • J
      libxl: fix leaking logfile fds · 67c56f6e
      Jim Fehlig 提交于
      Per-domain log files were introduced in commit a30b08b7. The FILE
      objects associated with these log files are stored in a hash table
      using domid as a key. When a domain is shutdown, destroyed, or
      otherwise powered-off, the FILE object is removed from the hash table,
      where the free function will close the FILE.
      
      Unfortunately the call to remove the FILE from the hash table occurs
      after setting domid=-1 in the libxlDomainCleanup() function. The
      object is never removed from the hash table, the free function is
      never called, and the underlying fd is leaked. Fix by removing the
      FILE object from the hash table before setting domid=-1.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      67c56f6e
  13. 23 4月, 2018 1 次提交
    • J
      conf: Rework/rename virDomainObjListFindByIDRef · 86813662
      John Ferlan 提交于
      Rework the code such that virDomainObjListFindByID will always
      return a locked/ref counted object so that the callers can
      always do the same cleanup logic to call virDomainObjEndAPI.
      Makes accessing the objects much more consistent.
      
      NB:
      There were 2 callers (lxcDomainLookupByID and qemuDomainLookupByID)
      that were already using the ByID name, but not virDomainObjEndAPI -
      these were changed as well in this update/patch.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      Reviewed-by: NJim Fehlig <jfehlig@suse.com>
      86813662
  14. 18 4月, 2018 2 次提交
  15. 12 4月, 2018 1 次提交
  16. 22 2月, 2018 1 次提交
  17. 09 2月, 2018 1 次提交
  18. 09 12月, 2017 1 次提交
  19. 13 11月, 2017 1 次提交
  20. 19 10月, 2017 2 次提交
  21. 25 7月, 2017 1 次提交
  22. 05 6月, 2017 1 次提交
  23. 28 4月, 2017 1 次提交
    • W
      libxl: set nestedhvm for mode host-passthrough · c268b9ea
      Wim ten Have 提交于
      Xen feature nestedhvm is the option on Xen 4.4+ which enables
      nested virtualization when mode host-passthrough is applied.
      
      nested HVM is enabled by adding below on the target domain;
      <cpu mode='host-passthrough'/>
      
      Virtualization on target domain can be disabled by specifying
      such under feature policy rule on target name;
      
      [On Intel (VT-x) architecture]
      <feature policy='disable' name='vmx'/>
      
      or:
      
      [On AMD (AMD-V) architecture]
      <feature policy='disable' name='svm'/>
      Signed-off-by: NJoao Martins <joao.m.martins@oracle.com>
      Signed-off-by: NWim ten Have <wim.ten.have@oracle.com>
      c268b9ea
  24. 23 2月, 2017 1 次提交
  25. 10 2月, 2017 2 次提交
    • J
      libxl: fix disk detach when <driver> not specified · bd116810
      Jim Fehlig 提交于
      When a user does not explicitly set a <driver> in the disk config,
      libvirt defers selection of a default to libxl. This approach works
      fine when starting a domain with such configuration or attaching a
      disk to a running domain. But when detaching such a disk, libxl
      will fail with "unrecognized disk backend type: 0". libxl makes no
      attempt to recalculate a default backend (driver) on detach and
      simply fails when uninitialized.
      
      This patch updates the libvirt disk config with the backend selected
      by libxl when starting a domain or attaching a disk to a running
      domain. Another benefit of this approach is that the live XML is
      also updated with the backend driver selected by libxl.
      bd116810
    • J
      libxl: set default disk format in device post-parse · 321a28c6
      Jim Fehlig 提交于
      When starting a domian, a libxl_domain_config object is created from
      virDomainDef. Any virDomainDiskDef devices with a format of
      VIR_STORAGE_FILE_NONE are mapped to LIBXL_DISK_FORMAT_RAW in the
      corresponding libxl_disk_device, but the virDomainDiskDef format is
      never updated to reflect the change.
      
      A better place to set a default format for disk devices is the
      device post-parse callback, ensuring the virDomainDiskDef object
      reflects the default format.
      321a28c6
  26. 03 2月, 2017 1 次提交
    • J
      libxl: fix dom0 autoballooning with Xen 4.8 · f86a7a83
      Jim Fehlig 提交于
      xen.git commit 57f8b13c changed several of the libxl memory
      get/set functions to take 64 bit parameters. The libvirt
      libxl driver still uses uint32_t variables for these various
      parameters, which is particularly problematic for the
      libxl_set_memory_target() function.
      
      When dom0 autoballooning is enabled, libvirt (like xl) determines
      the memory needed to start a domain and the memory available. If
      memory available is less than memory needed, dom0 is ballooned
      down by passing a negative value to libxl_set_memory_target()
      'target_memkb' parameter. Prior to xen.git commit 57f8b13c,
      'target_memkb' was an int32_t. Subtracting a larger uint32 from
      a smaller uint32 and assigning it to int32 resulted in a negative
      number. After commit 57f8b13c, the same subtraction is widened
      to a int64, resulting in a large positive number. The simple
      fix taken by this patch is to assign the difference of the
      uint32 values to a temporary int32 variable, which is then
      passed to 'target_memkb' parameter of libxl_set_memory_target().
      
      Note that it is undesirable to change libvirt to use 64 bit
      variables since it requires setting LIBXL_API_VERSION to 0x040800.
      Currently libvirt supports LIBXL_API_VERSION >= 0x040400,
      essentially Xen >= 4.4.
      f86a7a83
  27. 13 1月, 2017 1 次提交
  28. 11 1月, 2017 1 次提交
    • C
      libxl: define a per-domain logger. · a30b08b7
      Cédric Bosdonnat 提交于
      libxl doesn't provide a way to write one log for each domain. Thus
      we need to demux the messages. If our logger doesn't know to which
      domain to attribute a message, then it will write it to the default
      log file.
      
      Starting with Xen 4.9 (commit f9858025 and following), libxl will
      write the domain ID in an easy to grab manner. The logger introduced
      by this commit will use it to demux the libxl log messages.
      
      Thanks to the default log file, this logger will also work with older
      versions of Xen.
      a30b08b7
  29. 22 10月, 2016 1 次提交
  30. 20 10月, 2016 1 次提交
    • J
      qemu: Introduce qemuDomainChardevPrivatePtr · 5f2a1327
      John Ferlan 提交于
      Modeled after the qemuDomainHostdevPrivatePtr (commit id '27726d8c'),
      create a privateData pointer in the _virDomainChardevDef to allow storage
      of private data for a hypervisor in order to at least temporarily store
      secret data for usage during qemuBuildCommandLine.
      
      NB: Since the qemu_parse_command (qemuParseCommandLine) code is not
      expecting to restore the secret data, there's no need to add code
      code to handle this new structure there.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      5f2a1327
  31. 14 10月, 2016 1 次提交
  32. 28 9月, 2016 1 次提交
    • J
      libxl: channels support · 719b663f
      Joao Martins 提交于
      And allow libxl to handle channel element which creates a Xen
      console visible to the guest as a low-bandwitdh communication
      channel. If type is PTY we also fetch the tty after boot using
      libxl_channel_getinfo to fetch the tty path. On socket case,
      we autogenerate a path if not specified in the XML. Path autogenerated
      is slightly different from qemu driver: qemu stores also on
      "channels/target" but it creates then a directory per domain with
      each channel target name. libxl doesn't appear to have a clear
      definition of private files associated with each domain, so for
      simplicity we do it slightly different. On qemu each autogenerated
      channel goes like:
      
      channels/target/<domain-name>/<target name>
      
      Whereas for libxl:
      
      channels/target/<domain-name>-<target name>
      
      Should note that if path is not specified it won't persist,
      existing only on live XML, unless user had initially specified it.
      Since support for libxl channels only came on Xen >= 4.5 we therefore
      need to conditionally compile it with LIBXL_HAVE_DEVICE_CHANNEL.
      
      After this patch and having a qemu guest agent:
       $ cat domain.xml | grep -a1 channel | head -n 5 | tail -n 4
       <channel type='unix'>
         <source mode='bind' path='/tmp/channel'/>
         <target type='xen' name='org.qemu.guest_agent.0'/>
       </channel>
      
       $ virsh create domain.xml
       $ echo '{"execute":"guest-network-get-interfaces"}' | socat
       stdio,ignoreeof  unix-connect:/tmp/channel
      
       {"execute":"guest-network-get-interfaces"}
       {"return": [{"name": "lo", "ip-addresses": [{"ip-address-type": "ipv4",
       "ip-address": "127.0.0.1", "prefix": 8}, {"ip-address-type": "ipv6",
       "ip-address": "::1", "prefix": 128}], "hardware-address":
       "00:00:00:00:00:00"}, {"name": "eth0", "ip-addresses":
       [{"ip-address-type": "ipv4", "ip-address": "10.100.0.6", "prefix": 24},
       {"ip-address-type": "ipv6", "ip-address": "fe80::216:3eff:fe40:88eb",
       "prefix": 64}], "hardware-address": "00:16:3e:40:88:eb"}, {"name":
       "sit0"}]}
      Signed-off-by: NJoao Martins <joao.m.martins@oracle.com>
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      719b663f
  33. 27 9月, 2016 1 次提交