Commit Graph

353 Commits

Author SHA1 Message Date
Cole Robinson
627bfabc32 pylint: Silence output on Fedora 29 2018-09-29 14:27:34 -04:00
Cole Robinson
4adb1c8c30 pycodestyle: fix W605 invalid escape sequence 2018-09-29 13:59:19 -04:00
Cole Robinson
4e30161f44 guest: Absorb UEFI default setup
Rather than force callers to deal with it
2018-09-12 14:02:23 -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
12a7a18be0 cli: Fix traceback detection 2018-09-06 18:39:14 -04:00
Cole Robinson
9e05c56397 guest: Drop self.domain
The only user is virt-install, make its usage explicit
2018-09-04 14:55:04 -04:00
Cole Robinson
fff3c88f9c devices: disk: Absorb Guest bus/target default setting
Simplifies cli stuff as a nice side effect
2018-09-04 14:55:04 -04:00
Cole Robinson
347143982a devices: Add set_defaults for memballon, redirdev, rng, smartcard 2018-09-04 14:55:04 -04:00
Cole Robinson
31bda5bbb6 devices: watchdog: Add set_defaults 2018-09-04 14:55:04 -04:00
Cole Robinson
fb1bb26373 support: Drop lots more checks
- Remove anything for less than qemu 0.12 or libvirt 0.10, basically
  rhel6 vintage stuff
- Open code some simple checks
- Remove some that are only used for unnecessary error reporting
2018-08-31 22:21:15 -04:00
Cole Robinson
8d45dba43d cli: Add --boot bootloader= 2018-08-22 07:38:34 -04:00
Lubomir Rintel
3a4cf07a28 virtinst: allow adding host block devices to LXC containers
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
2018-06-19 15:07:45 -04:00
Lubomir Rintel
a2a022a879 virtinst: allow adding host character devices to LXC containers
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
2018-06-19 15:07:42 -04:00
Lubomir Rintel
bba3d04558 virtinst: allow adding host network devices to LXC containers
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
2018-06-19 15:05:28 -04:00
Marc-André Lureau
fa32aea416 tpm: add TPM emulator backend
An emulated backend doesn't require any path, since libvirt will take
care of finding the emulator and managing the storage. However, the
version to emulate can be specified.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2018-06-11 12:40:28 -04:00
Anya Harter
846e2f711a cli: add --sound codec support
Add codec support to virt-install so that it can accommodate
multiple instances of codec configuration.

The commandline argument:

  --sound codec0.type=micro,codec1.type=duplex,codec2.type=output

maps to the sound XML below:

    <sound model="es1370">
      <codec type="micro"/>
      <codec type="duplex"/>
      <codec type="output"/>
    </sound>

Signed-off-by: Anya Harter <aharter@redhat.com>
2018-06-11 12:23:14 -04:00
Anya Harter
02635d3358 cli: Add --disk geometry attribute options
Attribute options are:
    - geometry.cyls=W
    - geometry.heads=X
    - geometry.secs=Y
    - geometry.trans=Z

This maps to disk XML like:

    <disk>
      <geometry cyls='W' heads='X' secs='Y' trans='Z'/>
    </disk>

Signed-off-by: Anya Harter <aharter@redhat.com>
2018-06-11 12:02:11 -04:00
Anya Harter
89c389e45a cli: Add --disk driver.copy_on_read=on option
This maps to disk XML like:

    <disk>
      <driver copy_on_read='on'/>
    </disk>

Signed-off-by: Anya Harter <aharter@redhat.com>
2018-06-11 12:00:56 -04:00
Anya Harter
8bde479112 cli: Add --network mtu.size=X option
This maps to interface XML like:

    <interface>
      <mtu size='X'/>
    </interface>

Signed-off-by: Anya Harter <aharter@redhat.com>
2018-06-06 10:44:03 -04:00
Stefan Weil
633534c8b8 Fix some typos in comments and documentation (found by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-05 14:27:29 -04:00
Cole Robinson
ffab20782f connection: Handle more openauth cred types
Like ECHOPROMPT which is needed for libssh hosts file management.
Sync the two implementations a bit
2018-05-03 06:16:28 -04:00
Cole Robinson
a33ac92040 cli: Fix --boot smbios_mode=sysinfo (bz 1570549)
Not sure how this was expected to work, just make it do the simple
thing and set the value in the XML. Add a test case for it
2018-04-24 12:32:18 -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
8d0b1f80f1 cli: Have parser classes reference property names, not xmlbuilders
propertys already give us ways to access the backing class, and
switching to this method lets us drop some infrastructure in
xmlbuilder
2018-03-21 11:17:36 -04:00
Cole Robinson
3b88bfb1ee cli: Drop clear_attr property
It slightly complicates the generic machinery, and the one usage we
can handle directly
2018-03-21 11:17:36 -04:00
Cole Robinson
f69b823fad devices: Switch to normal _XML_PROP_ORDER
Drop the register_device stuff, rename virtual_device_type
2018-03-21 11:17:36 -04:00
Cole Robinson
7b61c45d3b guest: Move all_devices to guest.devices.X
The way we enumerate devices doesn't conform with the way all
other XMLBuilder instances expose child objects. Move more towards
that direction.

This requires some virt-xml and cli.py hacks but we will remove those
in future patches
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
3909c10441 virtinst: Move all devices to virtinst/devices/ 2018-03-21 07:29:40 -04:00
Cole Robinson
1c911ce567 virtinst: Give device classes consistent DeviceX naming
Previous state was inconsistenty and needlessly wordy. Fix up
a few other class namings that have redundant Virtual in the name
2018-03-21 07:29:40 -04:00
Cole Robinson
6969066b9f cli: Don't double print uncaught exceptions with --debug
We have an excepthook that logs uncaught exceptions for good
reason, but if printing --debug to stdout this exception gets
printed twice when we invoke the stock __excepthook__. Skip that
in the debug_stdout case.
2018-03-16 17:56:05 -04:00
Marc-André Lureau
0a62ae0b7a virtinst: add <vmcoreinfo/> feature
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2018-02-22 16:23:40 -05:00
Cole Robinson
8917305a6e Don't use count() for substring checking
Use the idiomatic 'X in Y'
2018-02-14 11:08:09 -05:00
Cole Robinson
8e7b5ed2d8 Drop __future__ imports, no longer needed 2018-02-08 14:08:23 -05:00
Cole Robinson
dae8642bb1 xmlbuilder: centralize adding child new child prop instances
Currently the domain CPU class has a child property like:

  siblings = XMLChildProperty(_CPUCellSibling)

If a user wants to add a new sibling, we add a convenience function:

    def add_sibling(self):
        obj = _CPUCellSibling(self.conn)
        self.add_child(obj)
        return obj

Rather than require every child property to define a similar matching
helper function, this adds infrastructure in xmlbuilder to do this
generically for every child property. Now callers can do

    obj = guest.cpu.siblings.add_new()
2018-02-08 14:03:47 -05:00
Radostin Stoyanov
15bd408570 Replace raw_input() with input()
raw_input() was renamed to input() in Python 3

See https://www.python.org/dev/peps/pep-3111/
2018-02-06 18:49:17 -05:00
Radostin Stoyanov
e3d35b2fb9 tests: cli: Handle UnicodeError when logging 2018-02-06 18:49:17 -05:00
Radostin Stoyanov
978fb25ac7 Wrap keys(), values() in a list
In Python 3 dict.values() [1] , dict.keys() [2] and dict.items() [3]
return a view [4] of the dictionary’s values, keys and items.

In Python 2 these functions return a list. [5] [6] [7]

To resolve this we can convert the result of these function to a list.

[1] https://docs.python.org/3/library/stdtypes.html#dict.values
[2] https://docs.python.org/3/library/stdtypes.html#dict.keys
[3] https://docs.python.org/3/library/stdtypes.html#dict.items
[4] https://docs.python.org/3/library/stdtypes.html#dict-views
[5] https://docs.python.org/2/library/stdtypes.html#dict.items
[6] https://docs.python.org/2/library/stdtypes.html#dict.keys
[7] https://docs.python.org/2/library/stdtypes.html#dict.values
2018-02-06 18:49:17 -05:00
Wim ten Have
708516c39e virtinst: add vcpupin support
Add vcpupin support to virt-install so that it can create guest
domains with statically allocated vcpu pinning towards a given cpuset.

Syntax: to pin vcpu=0 to cpuset="1,3" and vcpu=1 to cpuset=2

  --cputune vcpupin0.vcpu=0,vcpupin0.cpuset=1,3,vcpupin1.vcpu=1,vcpupin1.cpuset=2

generates below XML description for the guest domain.

  <cputune>
    <vcpupin vcpu="0" cpuset="1,3"/>
    <vcpupin vcpu="1" cpuset="2"/>
  </cputune>

Signed-off-by: Wim ten Have <wim.ten.have@oracle.com>
Signed-off-by: Menno Lageman <menno.lageman@oracle.com>
2018-02-06 10:21:56 -05:00
Menno Lageman
ae5239358a virtinst: Add NUMA distance support
Now that libvirt has support for administration of distances between NUMA cells
it would be nice to be able to set those with virt-install directly instead of
having to 'virsh edit' the domain XML manually after installation.

For example

--cpu cell0.memory=1234,cell0.cpus=0-3,cell1.memory=5678,cell1.cpus=4-7,\
      cell0.distances.sibling0.id=0,cell0.distances.sibling0.value=10,\
      cell0.distances.sibling1.id=1,cell0.distances.sibling1.value=21,\
      cell1.distances.sibling0.id=0,cell1.distances.sibling0.value=21,\
      cell1.distances.sibling1.id=1,cell1.distances.sibling1.value=10

would generate the following XML:

     <cpu>
       <numa>
         <cell cpus="0-3" memory="1234">
           <distances>
             <sibling id="0" value="10"/>
             <sibling id="1" value="21"/>
           </distances>
         </cell>
         <cell cpus="4-7" memory="5678">
           <distances>
             <sibling id="0" value="21"/>
             <sibling id="1" value="10"/>
           </distances>
         </cell>
       </numa>
     </cpu>

Signed-off-by: Menno Lageman <menno.lageman@oracle.com>

(crobinso: rework cli format, drop some validation, drop man changes)
2018-01-30 11:19:54 -05:00
Cole Robinson
cb6fc20210 cli: Drop python2ism with OSError 2018-01-27 16:27:41 -05:00
Cole Robinson
d66a438ae3 cli: Share find_inst_cb logic
All users follow a similar pattern, so generalize it
2018-01-26 14:09:06 -05:00
Pavel Hrdina
bc8c5b0778 cli: append "--attach" to virt-viewer if graphics has listen type none
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1527834

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2018-01-07 08:59:43 +01:00
Chen Hanxiao
7f1b4cee82 pycodestyle: fix all E125 warnings
Fix all E125:
     Continuation line with same indent as next logical line

   Also remove ignore options of E125

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2017-10-21 23:26:16 +08:00
Cole Robinson
999dbb3665 cli: Make _VirtCLIArgument instantiation less crazy
Motivation is that the other way had changed behavior with python3
which breaks things
2017-10-20 17:07:19 -04:00
Cole Robinson
91c0669cf6 cli: Fix OrderedDict mutated during iteration on python3 2017-10-20 16:13:04 -04:00
Radostin Stoyanov
63fce081ed pycodestyle: Use isinstance() for type checking
This is E721 in pycodestyle [1]:
   "do not compare types, use ‘isinstance()’"

The main differece between "type() is" and "isinstance()" is that
isinstance() supports inheritance. [1]

This can be seen in the example below:
    >>> type(True) is int
    False
    >>> isinstance(True, int)
    True

As we can see in python 'bool' a subclass of 'int'.

[1] https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
[2] https://docs.python.org/2/library/functions.html#isinstance
2017-10-20 11:49:13 -04:00
Lin Ma
40f70d4fe5 virt-install: add param cache.mode and cache.level for option '--cpu'
libvirt supports guest CPU cache by commit df13c0b, So add this feature
to virt-install to configure cpu L3 cache mode.

Currently, The valid values are 'passthrough', 'emulate' or 'disable'.
say:
  --cpu host-passthrough,cache.mode=passthrough
or
  --cpu $CPU,cache.mode=emulate,cache.level=3
or
  --cpu $CPU,cache.mode=disable

Signed-off-by: Lin Ma <lma@suse.com>
2017-09-14 18:54:01 -04:00
Lin Ma
8034748c22 virt-install: add a host cpu passthrough example to the -help output
Signed-off-by: Lin Ma <lma@suse.com>
2017-09-14 18:49:59 -04:00