1. 22 2月, 2018 1 次提交
    • J
      libxl: add support for specifying clock offset and adjustment · c391e07e
      Jim Fehlig 提交于
      libxl supports setting the domain real time clock to local time or
      UTC via the localtime field of libxl_domain_build_info. Adjustment
      of the clock is also supported via the rtc_timeoffset field. The
      libvirt libxl driver has never supported these settings, instead
      relying on libxl's default of a UTC real time clock with adjustment
      set to 0.
      
      There is at least one user that would like the ability to change
      the defaults
      
      https://www.redhat.com/archives/libvirt-users/2018-February/msg00059.html
      
      Add support for specifying a local time clock and for specifying an
      adjustment for both local time and UTC clocks. Add a test case to
      verify the XML to libxl_domain_config conversion.
      
      Local time clock and clock adjustment is already supported by the
      XML <-> xl.cfg converter. What is missing is an explicit test for
      the conversion. There are plenty of existing tests that all use UTC
      with 0 adjustment. Hijack test-fullvirt-tsc-timer to test a local
      time clock with 1 hour adjustment.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      c391e07e
  2. 20 2月, 2018 1 次提交
    • D
      conf: add enum constants for default controller models · a302480d
      Daniel P. Berrangé 提交于
      The controller model is slightly unusual in that the default value is
      -1, not 0. As a result the default value is not covered by any of the
      existing enum cases. This in turn means that any switch() statements
      that think they have covered all cases, will in fact not match the
      default value at all. In the qemuDomainDeviceCalculatePCIConnectFlags()
      method this has caused a serious mistake where we fallthrough from the
      SCSI controller case, to the VirtioSerial controller case, and from
      the USB controller case to the IDE controller case.
      
      By adding explicit enum constant starting at -1, we can ensure switches
      remember to handle the default case.
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      a302480d
  3. 09 12月, 2017 1 次提交
  4. 13 11月, 2017 1 次提交
  5. 07 11月, 2017 1 次提交
  6. 19 10月, 2017 2 次提交
  7. 20 9月, 2017 1 次提交
  8. 24 7月, 2017 1 次提交
  9. 11 7月, 2017 1 次提交
  10. 13 6月, 2017 1 次提交
  11. 07 6月, 2017 1 次提交
  12. 05 6月, 2017 1 次提交
  13. 24 5月, 2017 1 次提交
    • J
      libxl: add default controllers for USB devices · 6de895f6
      Jim Fehlig 提交于
      Attempting to start a domain with USB hostdevs but no USB controllers
      fails with the rather cryptic error
      
      libxl: error: libxl_qmp.c:287:qmp_handle_error_response: received an
      error message from QMP server: Bus 'xenusb-0.0' not found
      
      This can be fixed by creating default USB controllers. When no USB
      controllers are defined, create the number of 8 port controllers
      necessary to accommodate the number of defined USB devices.
      
      Note that USB controllers are already created as needed in the
      domainAttachDevice code path. E.g. a USB controller will be created,
      if necessary, when attaching a USB device with
      'virsh attach-device dom usbdev.xml'.
      6de895f6
  14. 23 5月, 2017 1 次提交
    • J
      libxl: add default listen address for VNC and spice · dbb85e0c
      Jim Fehlig 提交于
      If a VNC listen address is not specified in domXML, libxl
      will default to 127.0.0.1, but this is never reflected in the domXML.
      In the case of spice, a missing listen address resulted in listening
      on all interfaces, i.e. '0.0.0.0'. If not specified, set the listen
      address in virDomainGraphicsDef struct to the libxl default when
      creating the frame buffer device. Additionally, set default spice
      listen address to 127.0.0.1.
      dbb85e0c
  15. 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
  16. 16 2月, 2017 1 次提交
    • J
      libxl: fix potential double free in libxlDriverGetDom0MaxmemConf · 2dc1cf19
      Jim Fehlig 提交于
      Commit 4ab0c959 fixed a memory leak in libxlDriverGetDom0MaxmemConf
      but introduced a potential double free of mem_tokens
      
      *** Error in `/usr/sbin/libvirtd': double free or corruption (out):
          0x00007fffc808cfd0 ***
      
      Avoid double free by setting mem_tokens to NULL after calling
      virStringListFree.
      2dc1cf19
  17. 11 2月, 2017 1 次提交
    • J
      libxl: Resolve possible resource leak in dom0 maximum memory setting · 4ab0c959
      John Ferlan 提交于
      If either the "if (STRPREFIX(mem_tokens[j], "max:"))" is never entered
      or the "if (virStrToLong_ull(mem_tokens[j] + 4, &p, 10, maxmem) < 0)" break
      is hit, control goes back to the outer loop processing 'cmd_tokens' and
      it's possible that the 'mem_tokens' would be overwritten.
      
      Found by Coverity
      4ab0c959
  18. 10 2月, 2017 3 次提交
    • J
      libxl: fix dom0 maximum memory setting · 79692c38
      Jim Fehlig 提交于
      When the libxl driver is initialized, it creates a virDomainDef
      object for dom0 and adds it to the list of domains. Total memory
      for dom0 was being set from the max_memkb field of libxl_dominfo
      struct retrieved from libxl, but this field can be set to
      LIBXL_MEMKB_DEFAULT (~0ULL) if dom0 maximum memory has not been
      explicitly set by the user.
      
      This patch adds some simple parsing of the Xen commandline,
      looking for a dom0_mem parameter that also specifies a 'max' value.
      If not specified, dom0 maximum memory is effectively all physical
      host memory.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      79692c38
    • 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
  19. 09 2月, 2017 2 次提交
    • J
      libxl: use init and dispose functions with libxl_physinfo · c89a6e78
      Jim Fehlig 提交于
      The typical pattern when calling libxl functions that populate a
      structure is
      
        libxl_foo foo;
        libxl_foo_init(&foo);
        libxl_get_foo(ctx, &foo);
        ...
        libxl_foo_dispose(&foo);
      
      Fix several instances of libxl_physinfo missing the init and
      dispose calls.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      c89a6e78
    • J
      libxl: honor autoballoon setting in libxl.conf · ff225538
      Jim Fehlig 提交于
      libxlGetAutoballoonConf is supposed to honor user-specified
      autoballoon setting in libxl.conf. As written, the user-specified
      setting could be overwritten by the subsequent logic to check
      dom0_mem parameter. If user-specified setting is present and
      correct, accept it. Only fallback to checking Xen dom0_mem
      command line parameter if user-specfied setting is not present.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      ff225538
  20. 25 1月, 2017 2 次提交
    • J
      libxl: support emulate mode of tsc timer · 87df87e0
      Jim Fehlig 提交于
      While at it, use members of libxl_tsc_mode enum instead of literal
      int values.
      87df87e0
    • J
      libxl: fix timer configuration · 6e4759d0
      Jim Fehlig 提交于
      The current logic around configuring timers in libxl based on
      virDomainDef object is a bit brain dead. Unsupported timers are
      silently ignored and tsc is only recognized if it is the first
      timer specified.
      
      Change the logic to reject unsupported timers and honor the tsc
      timer regardless of its order when multiple timers are specified.
      6e4759d0
  21. 12 1月, 2017 1 次提交
  22. 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
  23. 15 12月, 2016 2 次提交
    • J
      libxl: reverse defaults on HVM net device attach · de8607d7
      Joao Martins 提交于
      libvirt libxl picks its own default with respect to the default NIC
      to use. libxlMakeNic is the one responsible for this and on boot it
      picks LIBXL_NIC_TYPE_VIF_IOEMU for HVM domains such that it accomodates
      both PV and emulated one. The good behaving guest at boot will then
      select the pv and unplug the emulated device.
      
      Now, on HVM when attaching an interface it will pick the same default
      that is LIBXL_NIC_TYPE_VIF_IOEMU which as a result will fail the attach
      (see xen commit 32e9d0f ("libxl: nic type defaults to vif in hotplug for
      hvm guest"). Xen doesn't yet support the hotplug of emulated devices,
      but we don't want to rule out that case either, which might get support
      in the future. Hence we simply reverse the defaults when we are
      attaching the interface which allows libvirt to prefer the PV nic first
      without adding "model='netfront'" following the same pattern as above
      commit. Also to avoid ruling out the emulated one we set to
      LIBXL_NIC_TYPE_IOEMU when setting a model type that is not 'netfront'.
      Signed-off-by: NJoao Martins <joao.m.martins@oracle.com>
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      de8607d7
    • C
      libxl: add QED disk format support · 340bb6b7
      Cédric Bosdonnat 提交于
      If libxl has QED disk format support, then pass the feature
      over to the user.
      340bb6b7
  24. 22 10月, 2016 1 次提交
  25. 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
  26. 24 9月, 2016 1 次提交
  27. 03 9月, 2016 1 次提交
  28. 02 9月, 2016 1 次提交
  29. 04 8月, 2016 1 次提交
    • J
      libxl: allow libxl to calculate shadow mem requirements · c0960aab
      Jim Fehlig 提交于
      Long, long ago before libxl_get_required_shadow_memory() was
      made publicly available, its code was copied to the libxl driver
      for calculating shadow memory requirements of HVM domains.
      
      Long ago, libxl_get_required_shadow_memory() was exported in
      libxl_utils.h and included in xen-devel packages everywhere.
      
      Remove the copied code, which has become stale, and let libxl
      provode a proper shadow memory value.
      c0960aab
  30. 02 8月, 2016 1 次提交
  31. 27 7月, 2016 1 次提交
  32. 12 7月, 2016 1 次提交
  33. 27 6月, 2016 1 次提交
  34. 24 6月, 2016 1 次提交
    • J
      secret: Move virStorageSecretType and rename · 1eca5f65
      John Ferlan 提交于
      Move the enum into a new src/util/virsecret.h, rename it to be
      virSecretLookupType. Add a src/util/virsecret.h in order to perform
      a couple of simple operations on the secret XML and virSecretLookupTypeDef
      for clearing and copying.
      
      This includes quite a bit of collateral damage, but the goal is to remove
      the "virStorage*" and replace with the virSecretLookupType so that it's
      easier to to add new lookups that aren't necessarily storage pool related.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      1eca5f65