Commit Graph

59 Commits

Author SHA1 Message Date
Cole Robinson
5442b6a890 createvm: Fix checking for empty KVM caps
This code path was never hit because it came after caps.guest_lookup
which errors in this case. We need to check things earlier

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-30 14:23:24 -04:00
Misono Tomohiro
8744e741d1 virtinst: Fix not to return duplicate entries from all_machine_names()
Since machine's canonical alias can be the same as other machine's
name, current all_machine_names() may return duplicates entries.
This causes the problem that the entry of "virt-5.0" appears twice in
machine selection menu when aarch64 is used.

So, fix this by just not adding the same entry twice.

Signed-off-by: Misono Tomohiro <misono.tm@gmail.com>
2020-07-24 20:12:38 +02:00
Cole Robinson
9ddf2799a8 tests: More work to make dir search test host independent
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-30 16:18:20 -05:00
Cole Robinson
f107e39989 Switch to more traditional logging structure
Init a shared log instance in virtinst/logger.py, and use that
throughout the code base, so we aren't calling directly into
'logging'. This helps protect our logging output from being
cluttered with other library output, as happens with some
'requests' usage
2019-06-17 00:12:31 -04:00
Cole Robinson
f056798918 virtinst: Add a bunch of # pragma: no cover 2019-06-11 17:51:25 -04:00
Cole Robinson
361657ad15 virtinst: Add a lot of test code coverage
* Delete dead code
* Add tests for various device default code paths
* Rework certain conditions a bit so code coverage always hits them
2019-06-09 18:59:50 -04:00
Pavel Hrdina
95d1275f57 domcapabilities: get list of CPU models from domcapabilities
Currently we just call libvirt API which will return all CPU models for
specific architecture known to libvirt and we offer all of them to users
in GUI.  Let's switch to domain capabilities where we have more details
about these CPUs such as whether each model is usable with current QEMU
binary.  If libvirt can detect the usability we will offer only CPU
models that QEMU can actually run.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-03-19 13:41:53 +01:00
Cole Robinson
2f89ecf4a9 Remove Author lines from file headers
Similar to what was done in libvirt. See these commits:

600462834f
c99e954973
2019-01-08 11:45:35 -05:00
Cole Robinson
425f599c84 device: disk: Move all path search handling to diskbackend
Simplify it slightly by combining return output and removing
an entry point. Add some additional test cases for it
2018-10-11 19:11:16 -04:00
Cole Robinson
ec69ae44b6 capabilities: Drop build_virtinst_guest
Same as lookup_virtinst_guest
2018-09-06 20:54:59 -04:00
Cole Robinson
a2fa799478 capabilities: Drop lookup_virtinst_guest
Users should just init Guest() directly, and call
set_capabilities_defaults if they need default arch data
2018-09-06 20:28:05 -04:00
Cole Robinson
5f22f41da4 guest: Absorb capabilities defaults setup
Rather than forcing API users to go through the capabilities APIs.
This lets us simplify things in virt-install quite a bit, and is
needed for smarter machine type defaults
2018-09-06 20:12:49 -04:00
Cole Robinson
e12049b114 capabilities: Drop old svm/vmx handling
We don't realisistically support these old libvirt versions anymore
2018-06-12 14:07:50 -04:00
Daniel P. Berrangé
48e32b429d Fix copyright header to specify GPLv2 or later, not GPLv2 only.
The copyright headers in every file were chjanged in this previous commit

  commit b6dcee8eb7
  Author: Cole Robinson <crobinso@redhat.com>
  Date:   Tue Mar 20 15:00:02 2018 -0400

    Use consistent and minimal license header for every file

Where before this they said "

  "either version 2 of the License, or (at your option) any later version."

Now they just say

  "GNU GPLv2"

This fixes it to say "GNU GPLv2 or later" again.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-04 16:51:37 -04:00
Cole Robinson
7fb1ddbc18 virtinst: s/_XML_ROOT_NAME/XML_NAME/g
No reason for it to be privatized, could be useful in some cases
2018-03-21 11:17:36 -04:00
Cole Robinson
fe9ed2340c virtinst: move <domain> XML files to virtinst/domain
And give the classes consistent naming
2018-03-21 11:17:36 -04:00
Cole Robinson
b6dcee8eb7 Use consistent and minimal license header for every file 2018-03-21 07:29:40 -04:00
Cole Robinson
d108bbe143 Convert docstrings to standard reStructuredText param format 2018-02-14 11:08:09 -05:00
Cole Robinson
7cf0b310cc capabilities: Move machine canonicalizing to capsinfo
Rather than overright XML content on every parse
2018-02-14 11:08:09 -05:00
Chen Hanxiao
c92aade081 pycodestyle: fix all E203 warnings
Fix all E203 whitespace before ':'
   Also remove E203 ignore option of pycodestyle

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2017-08-11 00:01:38 +08:00
Cole Robinson
ca56f74ed7 capabilities: Fix model list caching for different archs (bz 1451113)
We could return cached x86_64 results for aarch64 VMs

https://bugzilla.redhat.com/show_bug.cgi?id=1451113
2017-07-17 11:47:01 -04:00
Cole Robinson
2eaf084b04 capabilities: Drop cpu_map.xml handling
We've had getCPUModelNames in libvirt for years now, and this
functionality isn't critical anyways, so drop the fallback
2017-07-17 11:47:01 -04:00
Cole Robinson
f551d7e55d Replace file() usage with open()
Same semantics, but the latter is needed for python3
2017-05-05 14:53:12 -04:00
Pavel Hrdina
de9cd87fda virtinst.capabilities: return recommended machine for XEN
This is required in order to ask for correct domcapabilities.  If you don't
specify any machine libvirt will return domcapabilities for default machine
which is xenpv.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-16 12:16:49 +02:00
Cole Robinson
f73a7e69a4 capabilities: Handle xen outputting os_type=linux
F22 libxl xen still puts old style type=linux in the XML, so we need to
handle it for caps lookup
2015-09-22 12:41:57 -04:00
Cole Robinson
b15c44923c capabilities: Handle missing cpu_map.xml
It shouldn't be a fatal issue. Hit on freebsd where they install
libvirt bits into /usr/local

https://www.redhat.com/archives/virt-tools-list/2015-September/msg00056.html
2015-09-16 16:55:37 -04:00
Pavel Hrdina
1590490fa3 capabilities: detect ACPI and APIC capabilites properly
Instead of hard-coding that ACPI and APIC are enabled by default, detect
their presence from libvirt capabilities and use it.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1215692

(crobinso: Adjust for recently added test case)

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-07-14 13:26:42 -04:00
Pavel Hrdina
3ff35898a4 refactor detection of guest type capabilities
Each guest type can have its own capabilities and we should always ask
only for those capabilities.

The old approach was to get capabilities from libvirt and then for
example cycle trough all guests and return True, if any guest type
supports kvm or pae, etc.

Now we check those capabilities only for the correct guest type
according to defaults and input from user.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-07-14 13:11:40 -04:00
Kevin Zhao
8dbe96fc01 virt-manager : add support for architecture type "s390x".
For architecture "s390x",the disk and the network device are base
on "virtio" bus.The cdrom is based on "scsi".So set the default
cdrom bus as "scsi",the default bus as "virtio".Also the default
machine type is set to "s390-ccw-virtio" as it is the only supported
in "s390x".Also add a test cast of virt-install by cdrom in s390x.

(crobinso: Tweak test suite and minor formatting stuff)
2015-07-14 12:45:32 -04:00
Cole Robinson
6fd3983f6d tests: Clean up capabilities test data
Make it clear which ones are used for the caps unit tests, and which
are for cli/UI testing and can be updated at will. And drop a bunch
of outdated stuff.
2015-04-22 19:05:06 -04:00
Cole Robinson
070664b9e7 tests: Enable property checking for all objects
And loosen restrictions a bit so any read/write will trigger the
tracking.
2015-04-22 16:26:03 -04:00
Cole Robinson
36e46d0276 capabilities: Use _CapsInfo to simplife recommended_machine 2015-04-03 17:37:08 -04:00
Cole Robinson
97259c4d9b capabilities: Store results of guest_lookup together
Simplifies API users lives to not have to remember whether caps guest
or caps domain contains a particular value.
2015-04-03 17:37:08 -04:00
Cole Robinson
81a1910d90 capabilities: Rename no_install_options -> has_install_options
It's easier to visually parse the wording
2015-04-03 17:25:29 -04:00
Cole Robinson
fe9ffe86f6 capabilities: Drop xen-only bios virt checks
These only work for xen x86, and are less relevant nowadays since HW
virt has been around for a very long time. Also it's tough to be sure
that we aren't giving a bogus warning.
2015-04-03 17:25:29 -04:00
Cole Robinson
4e9f70f9b3 Drop all references to kqemu, it's long dead 2015-04-03 16:45:43 -04:00
Cole Robinson
f5b13a6e19 Drop all references to xenner, it's long dead 2015-04-03 16:45:43 -04:00
Cole Robinson
d4dfbd41b5 capabilities: Use XMLBuilder for cpu_map parsing
And clean up the internal bits a little
2015-04-03 16:45:43 -04:00
Cole Robinson
cac4ac1401 capabilities: Switch to use XMLBuilder
Just a cleanup to finally unify all the XML objects around the same
API, and drop a bunch of old cruft.
2015-04-03 16:45:42 -04:00
Prerna Saxena
232507b4e9 Add support for PowerPC Little Endian (ppc64le) architecture.
This enables virt-install to create VMs based on ppc64le architecture.

(crobinso: fix minor pylint)

Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
2015-01-09 10:47:52 -05:00
Cole Robinson
c4162f6708 Use -M virt as default machine for arm/aarch64
Centralize the default machine logic in caps and use it consistently
2014-09-23 16:05:48 -04:00
Cole Robinson
eb7612356e virtinst: Switch to relative imports, fix cyclic import warnings 2014-09-12 16:28:38 -04:00
Cole Robinson
196ff823b3 Fix warnings with latest pep8 2014-05-02 10:20:59 -04:00
Chen Hanxiao
35c9afad45 test: fix a pylint
After commit 7594cef35f,
pylint show a "access to a protected member" warning.
This patch introduces a static method to solve it.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2014-04-10 23:15:55 +08:00
Roman Bogorodskiy
7594cef35f tests: fix TestCapabilities.testCPUMap
testCPUMap() tries to open /usr/share/libvirt/cpu_map.xml file
and that fails if libvirt is not installed on the system
or cpu_map.xml path is different.

Force it to use tests/capabilities-xml/cpu_map.xml file instead.
2014-04-08 18:13:03 +02:00
Cole Robinson
a99da363a4 capabilities: Handle arch=none for CPU lookup 2014-03-20 14:04:29 -04:00
Cole Robinson
1f5b07bea8 capabilities: Handle broken return value of failed CPUModelNames 2014-03-20 14:04:29 -04:00
Cole Robinson
994b1fa4f4 connection: Add explicit API for getting virConnect object 2014-03-20 14:04:29 -04:00
Giuseppe Scrivano
81696a5144 virtinst: use libvirt getCPUModelNames when available
Read the list of CPU models trough getCPUModelNames instead of
accessing directly the file cpu_map.xml.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1060316

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-03-13 19:00:54 +01:00
Giuseppe Scrivano
6c2645f0d2 virtinst: drop parsing of cpu features
As for the previous patch, this information is not used anywhere and
this information should be retrieved using the libvirt baselineCPU
API.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-03-13 16:50:40 +01:00