Commit Graph

471 Commits

Author SHA1 Message Date
Lin Ma
2d38e22943 cli: Add auto complete support about sub options
With this patchset, the sub options completion is available. ex:

$ virt-install --disk <TAB><TAB>
...
bus=    cache=      format=     path=   serial=     size=
...

$ virt-install --disk path=test.qcow2,cache=none,<TAB><TAB>
...
bus=    format=     serial=     size=
...

$ virt-install --disk bu<TAB><TAB>
Then the sub option 'bus' will be auto completed with a '='
$ virt-install --disk bus=

Signed-off-by: Lin Ma <lma@suse.com>
2018-12-18 11:20:35 -05:00
Lin Ma
d68f0f8867 cli: Add the generic completer function and validator function
The patch adds the generic completer and validator, Further patches use
them as completer/validator. The completer won't add already specified
options to the list.

Signed-off-by: Lin Ma <lma@suse.com>
2018-12-18 11:20:35 -05:00
Cole Robinson
a8d4c7cb79 cli: Fix --security baselabel=X 2018-12-17 09:06:03 -05:00
Cole Robinson
6fb81aeb65 cli: Another searchdata.user fix 2018-10-12 18:34:42 -04: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
Lin Ma
eb1a67a595 cli: disk: Add options to support SCSI persistent reservation
Create the managed or the unmanaged PR object to enable SCSI persistent
reservation for LUN Passthrough

Signed-off-by: Lin Ma <lma@suse.com>
2018-10-11 16:00:28 -04:00
Cole Robinson
42a96cfd59 virt-install: add --destroy-on-exit
This makes the console window behave like a raw qemu command line:
when the user closes it, the VM is hard powered off.
2018-10-11 15:24:16 -04:00
Cole Robinson
3e55e89453 tests: Add better virt-install console testing 2018-10-11 12:19:48 -04:00
Yossi Ovadia
215d296b61 cli: add --boot rebootTimout
virt-install -n blah -r 1024 --vcpu=1 --disk=/root/vm/blah.qcow2,size=10\
 --network=bridge:br-public --pxe --boot=network,rebootTimeout=3

By default, in case of (first) pxe boot failure the VM will simply
stop trying.
By adding the above, VM will re-try pxe boot. ( useful when DHCP not
replys on first attempt.

Libvirt support it and VM XML will look as follow : ( 'bios rebootTimeout'
will be created under OS section. )

  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.5.0'>hvm</type>
    <boot dev='network'/>
    <bios rebootTimeout='3'/>
  </os>

(crobinso: fix it, add test case)
2018-10-11 11:24:07 -04:00
Cole Robinson
be628ad54f cli: Log openauth callback prompts 2018-10-08 09:15:06 -04:00
Cole Robinson
a4097b7691 cli: Merge multiple instances of single use opts
So --memory 123,maxmem=456 --memory 555 is equivalent to
--memory 555,maxmem=45
2018-10-05 13:23:20 -04:00
Cole Robinson
03439dd9a3 cli: Remove some --sysinfo examples
This is a sufficiently uncommon option, it doesn't need 5 examples
2018-10-04 20:52:32 -04:00
Cole Robinson
945c0125db cli: Remove VirtStreamHandler
This was needed at one point to make our logging not throw
exceptions when passed non-ascii text, like logging translated
errors. pretty sure python 3 and probably python2.7 fixed all
those issues, so lets drop it
2018-10-04 19:45:06 -04:00
Cole Robinson
9edca3486a virt-manager: Wire up support for default mode=host-model
Simplify things a long the way
2018-10-04 14:43:44 -04:00
Cole Robinson
35dd99f172 cli: Don't hardcode nec-xhci for --controller usb3
Use our helper function to choose the optimal model
2018-10-04 09:24:43 -04:00
Cole Robinson
c539f06eeb cli: Give better --controller examples
ich9-ehci1 isn't a recommended configuration
2018-10-03 18:52:33 -04:00
Marc-André Lureau
4ad74278ca cli: add memory backing access_mode & source_type
Allow to set some memory backing options, ex:
--memorybacking access_mode=shared,source_type=anonymous

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2018-10-02 11:12:13 -04:00
Cole Robinson
757910a1bb cli: Add --metadata os_name= and os_full_id=
Allows changing the libosinfo metadata for an existing vm via virt-xml
2018-09-30 20:55:32 -04:00
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
Pavel Hrdina
af91d51fc8 cli: introduce snapshot_policy parameter for disk device
This allows to configure snapshot behavior for each disk.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-12 08:58:31 +02:00
Pavel Hrdina
d718f1a516 graphics: introduce listens.socket parameter
Add support to configure socket path for socket listen type.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-09 10:11:42 +02:00
Pavel Hrdina
fe6c5067c0 graphics: introduce listens.{type|address|network} parameters
Using "listens.*" allows better configuration of listen elements for
graphics devices.  Currently the only way how to configure a listen
type is to abuse "listen" parameter and there is no way how to configure
exact "network".

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-09 10:11:42 +02:00
Pavel Hrdina
36230c9a18 devicepanic: use model instead of address.type
There are multiple models of the panic device, the address type is only
one and is valid only for "isa" model.

To not break the virt-install/virt-xml the command line parser needs to
be updated.  Before this patch there was only one parameter that
configured the "iobase".  Now the first parameter configures a model
but to keep it backward compatible it follows these rules:

1. there is only one parameter and it matches known model:

  --panic isa

  <panic model='isa'>
    <address iobase='0x505' type='isa'/>
  </panic>

2. there is only one parameter and it doesn't match any model:

  --panic 0x505

  <panic model='isa'>
    <address iobase='0x505' type='isa'/>
  </panic>

3. there are two parameters:

  --panic isa,iobase=0x505

  <panic model='isa'>
    <address iobase='0x505' type='isa'/>
  </panic>

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-09 10:09:46 +02:00
Pavel Hrdina
5f819aff97 virtinst: remove address configuration from panic device
The panic device has an address element but it's not the same as for
other devices.  Panic device can have only one address type "isa" with
only one additional attribute "iobase".  That attribute is configured
by separate argument.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-09 10:09:46 +02: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
Radostin Stoyanov
b93cc3bbc9 pycodestyle: Do not use bare 'except:'
A bare 'except:' catches all exceptions [1], including SystemExit,
KeyboardInterrupt, and GeneratorExit (which is not an error and should
not normally be caught by user code). In situations where you need to
catch all “normal” errors, you can catch the base class for all normal
exceptions, Exception [2].

[1] https://docs.python.org/2/howto/doanddont.html#except
[2] https://docs.python.org/2/library/exceptions.html#Exception
2017-08-02 13:57:43 -04:00
Cole Robinson
98b5ea8b2c connection: Drop disabling of cache_object_fetch
All cases we care about either provide their own callbacks, or
explicitly want this caching, so enable it unconditionally
2017-07-19 12:57:36 -04:00
Cole Robinson
c6fdfbf3c3 cli: disk: add driver_detect_zeroes= support 2017-07-15 13:39:04 -04:00
Cole Robinson
8d8b353b28 virtinst: Fix bare python3 style print()
We want a newline, so pass it ""
2017-07-10 09:34:22 -04:00
Cole Robinson
251ba27fe3 cli: Advertise --random /dev/urandom in help
Instead of /dev/random, since the latter is the preferred setting
these days.
2017-06-28 11:47:55 -04:00
Yuri Arabadji
4be3d030b5 cli: Add --disk logical/physical_block_size 2017-06-16 13:28:25 -04:00
Cole Robinson
4e7a6ad728 tests: pylint: Silence/fix a bunch of new warnings 2017-06-16 12:54:56 -04:00
Pavel Hrdina
24f9d05329 virt-install: add support for loader secure attribute
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-01 09:58:46 +02:00
Pavel Hrdina
f38c56c971 virt-install: add support for SMM feature
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-01 09:58:46 +02:00
Cole Robinson
a90d675394 Switch deprecating log.warn to log.warning
Same semantics, but the alias is deprecated
2017-05-05 14:53:28 -04:00
Cole Robinson
55288c4551 Convert to python3 style print() syntax
Use __future__ imports to keep this working for python2
2017-05-05 14:52:37 -04:00
Cole Robinson
34c193108c Use python3 compatible octal notation 2017-05-05 14:52:11 -04:00
Cole Robinson
62feeb02a8 Switch to python3 style 'except X as Y' notation
Which also works with python2.7
2017-05-05 14:52:11 -04:00
Pavel Hrdina
a2985f07e6 virtinst: add support for memory device
This is the actual memory device that is used to hot(un)plug memory
to(from) a guest.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-05-05 12:20:52 +02:00
Pavel Hrdina
3ebbeef80e virtinst: introduce support for <maxMemory> element
This element controls hot(un)plugable memory for the guest in
addition to the initial memory configured by <memory> element.

One has to configure <maxMemory> and guest numa nodes using <numa>
element to enable hot(un)plug of memory modules.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-05-05 11:49:27 +02:00
Cole Robinson
7aee124d9a cli: Don't double warn when skipping disk size warning (bz 1433239) 2017-04-27 12:19:53 -04:00
Venkat Datta N H
66435cb03d virt-install:support --features hyperv_synic=(on/off) 2017-03-30 14:19:06 -04:00
venkat
935c93812f virt-install: support --features hyperv_reset=(on/off) 2017-03-27 17:50:35 -04:00
Cole Robinson
d62e975568 guest: Add default virtio-rng /dev/urandom (bz 1212082)
For guests that support it, per libosinfo, and new enough libvirt
to handle /dev/urandom. See the bug for discussion

https://bugzilla.redhat.com/show_bug.cgi?id=1212082
2017-03-08 17:26:19 -05:00
Cole Robinson
dff27a298e cli: Default to ignoring 'none' strings
If the parsed option string is just 'none', make it a no-op.
This helps us be backwards compatible: for example, --rng none is
a no-op, but one day we decide to add an rng device by default to
certain VMs, and --rng none is extended to handle that. --rng none
can be added to users command lines and it will give the expected
results regardless of the virt-install version.

Options that already have special 'none' handling need to opt out
of the default behavior.
2017-03-08 17:05:36 -05:00
Cole Robinson
191896d0dc cli: Add --qemu-commandline option 2017-03-06 22:15:46 -05:00
Cole Robinson
d056508d71 cli: --sysinfo: Set type=smbios by default
Libvirt requires it, so don't force users to manually specify it if
they pass any other --sysinfo params.
2017-03-05 21:18:26 -05:00
Cole Robinson
7a8f756a42 sysinfo: Validate in shared code, not at cli parse time 2017-03-05 20:55:21 -05:00
Cole Robinson
1757e394bb virt-install: Support --video vram64= (bz 1377080) 2017-03-05 14:51:25 -05:00
Cole Robinson
d31e933f24 virt-install: support --network trustGuestRxFilters= (bz 1427600) 2017-03-05 14:43:31 -05:00
Marc-André Lureau
dffb2aaa2d virtinst/cli: add spice rendernode argument
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2017-02-23 18:31:43 -05:00
Pavel Hrdina
b1c0a1c2d9 virtinst/cli: set default value for disk sparse to "yes"
Commit 41a84bae9 reworked CLI parsing, but lost the default value disk
sparse option.  Man page also states that the default value is "yes".

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-01-17 12:54:12 +01:00
Chen Hanxiao
e77c98ae1b virtinst: fix a typo
s/appened/appended

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2016-10-25 23:35:47 +08:00
Charles Arnold
a3206f89c8 virtinst: Add the --sysinfo option
Allow passing SMBios information to the guest using the new sysinfo
option. Also update the appropriate files with test cases.
2016-09-08 11:36:59 -04:00
Chen Hanxiao
c859d39428 virt-install: introduce vhostuser interface
Add support to interface type 'vhostuser' by:

--network vhostuser,source_type=unix,source_path=/tmp/vhost1.sock,source_mode=server,model=virtio

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2016-09-02 18:58:47 -04:00
Cole Robinson
c84c2cfd58 devicechar: Support source_master and source_slave
Needed for type=nvdm for *bsd

https://bugzilla.redhat.com/show_bug.cgi?id=1369803
2016-08-24 16:37:36 -04:00
Cole Robinson
4727b31e61 cli: Ignore virt-viewer checks in test suite
Otherwise we can end up hanging with the default --wait behavior
2016-07-20 18:14:37 -04:00
Cole Robinson
d70fccd296 cli: Add helper for checking if we are in the test suite 2016-07-20 18:14:37 -04:00
Cole Robinson
322d212516 cli: Add --serial log.file= and log.append=
And for other character devices --console, --parallel, --channel
2016-07-18 15:04:40 -04:00
Cole Robinson
0e8d4007cf tests: Add some virt-install autoconsole tests 2016-06-17 12:13:21 -04:00
Cole Robinson
8d4e58c501 cli: Add --disk backing_format= option 2016-06-16 20:09:37 -04:00
Cole Robinson
19b4cf026e cli: Support --cpu cellX.id (and cpus, and memory)
This allows configuring <cpu><numa><cell> bits via the command line.
This uses the optional numbering scheme described in the previous
commit.
2016-06-14 19:07:55 -04:00
Cole Robinson
b785f3f594 cli: Support --disk seclabelX.model (and relabel, and label)
This adds support for setting VirtualDisk <seclabel> XML. This
invents a new command line scheme for cases like this where there
are possibly multiple child elements that we want to specify
on the command line. So if you just want to specify one <seclabel>
block, you can do the expected

  --disk ...,seclabel.model=dac,relabel=no

However if you want to specify 2 <seclabel> blocks you need to do:

  --disk ...,seclabel0.model=dac,seclabel0.relabel=no,seclabel1.model=selinux,seclabel1.relabel=no
2016-06-14 19:05:30 -04:00
Cole Robinson
7ec97400a5 cli: Only instantiate VirtCLIArguments at parse time
We register the VirtCLIArgument classes with the static parse
instructions, but instantiate it with the actual key=val pair
from the command line. This fixes some layering violations, and
gives callers access to the actual command line key that we
are parsing, if that's interesting.
2016-06-14 16:26:56 -04:00
Cole Robinson
dc49d46f62 cli: Separate out can_comma handling
Clarify things by taking it out of the main parse loop
2016-06-14 14:08:50 -04:00
Cole Robinson
8532dacde0 cli: Pass virtarg and parser to setter callback
This should provide access to every bit of info we could possibly
want from the setter callbacks
2016-06-14 13:54:17 -04:00
Cole Robinson
984b368725 cli: Rework VirtCLIParser instantiation
Only initialize VirtCLIParser at actual parse time. The data that's
passed to __init__ is the particular data for that parse task, like
the option string, and the Guest object we are editing.

As a result we can drop the whole parsermap handling, since the
parserlist is immutable.

There's a bunch of other reworks mixed in like dropping the
VirtOptionString abstraction...
2016-06-14 10:51:50 -04:00
Cole Robinson
8a0fd7927f cli: Improve comments for _VirtCLIArgument 2016-06-14 07:38:59 -04:00
Cole Robinson
3ce5af712b cli: Drop unused VirtCLIParser.option_variable_name 2016-06-13 19:15:35 -04:00
Cole Robinson
7018904959 cli: Move introspection checking out of Parser class
We can do that at the cli entry point, and only have the parser
print its subargs
2016-06-13 19:15:19 -04:00
Cole Robinson
7cd04a9f86 cli: Register VirtCLIArguments at class definition time
The VirtCLIArguments, (for example, path=, size=, etc. for --disk)
are only registered when a VirtCLIParser is actually initialized.
This seems backwards, since those arguments are really more immutable
factors of the actual command line parsing, so make more sense only
initializing them once, at class definition time.

This switches to use that pattern. This makes the parsing flow a bit
cleaner and can be a basis for future improvements.
2016-06-13 18:37:30 -04:00
Cole Robinson
4db0cd2eab cli: Tweak clearxml argument setup
Just unnest the callback to make it a little easier to follow
2016-06-13 18:37:30 -04:00
Cole Robinson
cb6853eea6 cli: More shared 'address.*' handling output VirtCLIParser
Make it a global function rather than complicating VirtCLIParser any
further with irrelevant functions
2016-06-13 18:37:30 -04:00
Cole Robinson
7bee927276 conn: Stop using VirtOptionParser
It only needs a minimal portion of the functionality, so separate
that out and use it explicitly. Clean up some of the surrounding
cli.py bits as well
2016-06-13 18:37:30 -04:00
Cole Robinson
efad67aab2 cli: Separate param parse and lookup
Makes the code a bit easier to follow
2016-06-12 19:48:16 -04:00
Cole Robinson
31b8051525 cli: Rename opts.opts -> opts.optdict
To make it more clear to callers what type of structure they are
dealing with
2016-06-12 10:32:23 -04:00
Cole Robinson
0663e52a62 cli: Use OrderedDict for tracking cli values
Allows us to drop the single 'orderedopts' usage
2016-06-12 10:11:11 -04:00
Cole Robinson
263a35fe7a cli: Wrap setter_cb bits in a class
Will make it less churny if we want to add new bits in the future
2016-06-11 17:22:27 -04:00
Cole Robinson
14fd99255b cli: add --graphics listen=socket support
This is the new style socket support, where we request libvirt to
allocate a socket path for us. Plus this is the only way to enable
socket support for type=spice
2016-06-11 16:56:41 -04:00
Cole Robinson
4c0b761cfb virtinst: graphics: Add listen=none support
Not strictly needed for spice, but now available for vnc if
people want it
2016-06-11 16:48:34 -04:00
Cole Robinson
2b34831b26 cli: Add device address.type/address.bus/... options
This exposes every device <address> option, for each device
cli option. So --disk, --network, --video, etc.

Fill out a few more address XML bits as well
2016-06-11 16:10:31 -04:00
Cole Robinson
1330f8c675 cli: Move blkiotune and memorybacking out of the device code area 2016-06-11 13:45:05 -04:00
Pavel Hrdina
df1c3e74aa virt-install: add a new guest feature GIC for ARM guests
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1334857

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-11 18:41:31 +02:00
Pavel Hrdina
9ca3ec8b17 virtinst.cli: remove duplicated line
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-10 18:08:07 +02:00
Cole Robinson
55327c81b7 xmlbuilder: Support clear()ing an object in place
This gives friendly XML output via virt-xml for clearxml=yes +
extra options: the XML block is editted in place, rather than removed
and with the newchanges appended
2016-05-20 14:51:31 -04:00
Cole Robinson
635a228f6b cli: Warn if we think spice GL settings won't work 2016-05-20 14:51:31 -04:00
Marc-André Lureau
8aead7619c virtinst: add listen=none graphics option
Add a special listen value to disable any extra display server listening
socket. This is necessary now that qemu prevents starting a spice+virgl
VM with listening sockets (until spice allows remoting with virgl).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2016-05-20 14:51:31 -04:00
Cole Robinson
4a076232b6 cli: Expose --video heads, ram, vram, vgamem, accel3d 2016-05-20 11:44:18 -04:00
Lin Ma
7358bbfb5d Append '--attach' to virt-viewer for local display if spice gl enabled.
Currently SPICE GL support is local-only, So it needs to attach to the
local display.

Signed-off-by: Lin Ma <lma@suse.com>
2016-05-07 19:21:37 -04:00
Cole Robinson
f4dfb6de9d Fix recent pylint/pep8 output 2016-04-18 16:42:12 -04:00
Marc-André Lureau
f912f28e97 virtinst: add --graphics gl option
Add a --graphics option to enable accelarated rendering using
OpenGl. This is used only by Spice (and for local only guests atm).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2016-03-09 20:25:37 -05:00
Cole Robinson
7f7ff0c344 cli: add --network rom_bar and --network rom_file 2016-01-20 10:53:23 -05:00
Cole Robinson
0d095e22f7 cli: Have --vcpu cpuset=auto use placement=auto
For many years virt-install has supported a bit of logic that maps
--cpuset=auto to a CPU pinning based on host NUMA topology; we look
for a NUMA node who's current free memory is closest to the requested
memory allocation. This isn't very useful though, since it's a one time
allocation, the conditions at VM creation time likely aren't the
conditions of the machine in the future.

Libvirt has supported a smarter option in vcpu placement=auto for a long
while, which will perform a similar operation but at every VM startup.

Convert cpuset=auto to use this functionality instead.
2015-11-18 15:00:54 -05:00
Cole Robinson
492c9c4f28 cli: Add --vcpu placement=static|auto option 2015-11-18 15:00:42 -05:00
Cole Robinson
e9d5347395 cli: Support --network link_state=up|down 2015-11-18 13:59:15 -05:00
Pavel Hrdina
a8110c6cd7 virt-install: report warning for cpuset=auto on non-NUMA host
Currently we report an error but continue with installation, we should
report warning instead of error.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-11-03 11:03:14 +01:00
Abhijeet Kasurde
e5a0d1cbb8 Added support to on_lockfailure
Added cli option to specify on_lockfailure in events.
Also, added various testcases and related output XMLs.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

(crobinso: add clitest.py example)
2015-10-07 10:25:12 -04:00
Abhijeet Kasurde
d7e678cb28 Added support pvspinlock in features
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2015-10-05 15:14:34 -04:00
Cole Robinson
65aba92797 virt-install: Add --feature pmu=on|off 2015-09-28 17:12:42 -04:00
Cole Robinson
6a9f0089b9 devicefilesystem: Rename mode->accessmode
To reflect the name in the XML
2015-09-20 20:16:21 -04:00
Cole Robinson
5584863d18 urlfetcher: Switch to requests and urllib2 instead of urlgrabber
urlgrabber is largely dead upstream and isn't going to be ported to
python3 AFAIK. So we will need to move off of it eventually.

Use requests for http handling which is the most common library nowadays,
and just plain old urllib2 for ftp fetching.
2015-09-18 19:50:35 -04:00