1. 10 2月, 2017 3 次提交
    • J
      libxl: fix reporting of maximum memory · d2b77608
      Jim Fehlig 提交于
      The libxl driver reports different values of maximum memory depending
      on state of a domain. If inactive, maximum memory value is reported
      correctly. When active, maximum memory is derived from max_pages value
      returned by the XEN_SYSCTL_getdomaininfolist sysctl operation. But
      max_pages can be changed by toolstacks and does not necessarily
      represent the maximum memory a domain can use during its active
      lifetime.
      
      A better location for determining a domain's maximum memory is the
      /local/domain/<id>/memory/static-max node in xenstore. This value
      is set from the libxl_domain_build_info.max_memkb field when creating
      the domain. Currently it cannot be changed nor can its value be
      exceeded by a balloon operation. From libvirt's perspective, always
      reporting maximum memory with virDomainDefGetMemoryTotal() will produce
      the same results as reading the static-max node in xenstore.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      d2b77608
    • 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
  2. 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
  3. 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
  4. 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
  5. 13 1月, 2017 1 次提交
  6. 12 1月, 2017 1 次提交
  7. 11 1月, 2017 2 次提交
    • 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
    • J
      libxl: implement virDomainGetMaxVcpus · a05e2570
      Jim Fehlig 提交于
      The libxl driver already supports getting maximum vcpu count via
      libxlDomainGetVcpusFlags, allowing to trivially implement
      virDomainGetMaxVcpus.
      a05e2570
  8. 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
  9. 09 12月, 2016 2 次提交
  10. 22 11月, 2016 1 次提交
  11. 25 10月, 2016 1 次提交
    • J
      libxl: fix leaking of allocated migration ports · f830674b
      Jim Fehlig 提交于
      Although the migration port is immediately released in the
      finish phase of migration, it was never set in the domain
      private object when allocated in the prepare phase. So
      libxlDomainMigrationFinish() always released a 0-initialized
      migrationPort, leaking any allocated port. After enough
      migrations to exhaust the migration port pool, migration would
      fail with
      
      error: internal error: Unable to find an unused port in range
             'migration' (49152-49216)
      
      Fix it by setting libxlDomainObjPrivate->migrationPort to the
      port allocated in the prepare phase. While at it, also fix
      leaking an allocated port if the prepare phase fails.
      f830674b
  12. 22 10月, 2016 1 次提交
  13. 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
  14. 14 10月, 2016 1 次提交
  15. 12 10月, 2016 1 次提交
  16. 28 9月, 2016 2 次提交
    • J
      libxl: fix param assignment in domainGetSchedulerParameters · 4c600de7
      Jim Fehlig 提交于
      Due to a copy and paste error, the scheduler 'cap' parameter
      was over-writing the 'weight' parameter when preparing the
      return parameters in libxlDomainGetSchedulerParametersFlags.
      As a result, the scheduler weight was never shown when getting
      schedinfo and setting the weight failed as well
      
      virsh  schedinfo testvm
      Scheduler      : credit
      cap            : 0
      
      virsh  schedinfo testvm --cap 50 --weight 500
      Scheduler      : credit
      error: invalid scheduler option: weight
      
      The obvious fix is to assign the 'caps' parameter to the correct
      item in the parameter list.
      Reported-by: NVolo M. <vm@vovs.net>
      4c600de7
    • 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
  17. 27 9月, 2016 1 次提交
  18. 26 9月, 2016 4 次提交
  19. 24 9月, 2016 1 次提交
  20. 22 9月, 2016 2 次提交
    • J
      cpu: Rework cpuCompare* APIs · 7f127ded
      Jiri Denemark 提交于
      Both cpuCompare* APIs are renamed to virCPUCompare*. And they should now
      work for any guest CPU definition, i.e., even for host-passthrough
      (trivial) and host-model CPUs. The implementation in x86 driver is
      enhanced to provide a hint about -noTSX Broadwell and Haswell models
      when appropriate.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      7f127ded
    • J
      libxl: support VIR_MIGRATE_PERSIST_DEST migration flag · 1fc90ae9
      Jim Fehlig 提交于
      By default, virt-manager (and likely other libvirt-based apps) sets
      the VIR_MIGRATE_PERSIST_DEST flag when invoking the migrate API, which
      fails in a Xen setup since the libxl driver does not support the flag.
      
      Persisting a domain is a trivial task in the grand scheme of migration,
      so be nice to libvirt apps and add support for VIR_MIGRATE_PERSIST_DEST
      in the libxl driver.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      1fc90ae9
  21. 12 9月, 2016 4 次提交
  22. 09 9月, 2016 1 次提交
  23. 03 9月, 2016 1 次提交
  24. 02 9月, 2016 1 次提交
  25. 30 8月, 2016 1 次提交
    • J
      libxl: advertise support for migration V3 · 36f57ad7
      Jim Fehlig 提交于
      The libxl driver has long supported migration V3 but has never
      indicated so in the connectSupportsFeature API. As a result, apps
      such as virt-manager that use the more generic virDomainMigrate API
      fail with
      
      libvirtError: this function is not supported by the connection driver:
      virDomainMigrate
      
      Add VIR_DRV_FEATURE_MIGRATION_V3 to the list of features marked as
      supported in the connectSupportsFeature API.
      36f57ad7