Commit Graph

583 Commits

Author SHA1 Message Date
Cole Robinson
860dba6923 guest: Remove disable_default_memballoon
The Guest code isn't triggerable because of the way the cli code
was invoking it, as a <memballoon> device would always be added.
Because libvirt accepts model=none, and that's what '--memballoon none'
will translate to anyways, we don't need any special handling here

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 13:08:12 -05:00
Cole Robinson
6924e16aaf cli: Clarify that --controller address= is not the preferred pattern
Remove it from the man page, and add a local comment to the code

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-25 14:30:07 -05:00
Cole Robinson
b3ea89f218 virtinst: device: Remove set_addrstr()
There's only one user now, in cli.py. Open code it there

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-25 14:30:07 -05:00
Cole Robinson
cdbc3f56e6 cli: kill --graphics keymap=local, and hostkeymap module
Removing this was discussed here:
https://www.redhat.com/archives/virt-tools-list/2019-June/msg00117.html

This is the old default, where we would try to determine a static
keymap value from host graphics config files, and set that in the
XML.

We haven't defaulted to this for a long time, setting a static keymap
is suboptimal generally, and the file parsing code is not up to date
for modern host config. So let's remove it

The hostkeymap module is now unused, so remove it and all the custom
testing for it.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-24 17:04:29 -05:00
Cole Robinson
188fd4adb1 cli: Drop keymap santizing
We shouldn't be validating against a static list of keymaps,
instead we should let libvirt or the hypervisor throw and error.

Also the accompanying code is about to be removed.

It's possible this will break command line usage for some users, like
if they were passing keymap=US and depending on our logic to lower()
it for them. I think this should be rare, and IMO it's acceptable to
tell users to just fix their command line, which should work correctly
with older versions too, so it should be a one time fix.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-24 17:04:29 -05:00
Fabiano Fidêncio
a9aeca60bb unattended: Add reg-login option to --unattended
As osinfo-db introduced the first usage of reg-login, let's also
add support for such option when using --unattended.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2020-01-24 10:05:03 -05:00
Cole Robinson
925948a19e virt-install: Add some coverage exclusions
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-15 11:00:21 -05:00
Cole Robinson
637781fca2 cli: Add --serial type= arg, with back compat alias char_type
'type' is the expected naming here

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-12-24 12:02:53 -05:00
Cole Robinson
e879097d1b cli: Clean up process if execv fails
Like if /bin/true is missing, as it was on freebsd. Use /bin/test
instead which appears to have a higher likelyhood of existing

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-12-11 17:57:35 -05:00
Cole Robinson
78ad233653 tests: abide logging options for clitests
We need to restore logging after calling the cli tools. Centralize
the logging reset behavior since we need that too

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-12-11 17:57:28 -05:00
Cole Robinson
7fee1a2814 cli: Fix --cloud-init and --unattended 'none' handling
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-25 14:19:09 -05:00
Cole Robinson
da996317f8 cli: cloudinit: default to --autoconsole text with --cloud-init
Cloud images all work nicely with text output, and it's likely
the preferred native way to connect to the guest vs graphical.
Plus it simplifies generated password copy+paste

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-25 14:03:49 -05:00
Cole Robinson
e488696cef cli: Add explicit --autoconsole option
Allows the user to override our implicit '--autoconsole default'
handling

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-25 06:22:14 -05:00
Cole Robinson
85a33caa76 cli: Expose default console handling through _AutoconsoleData
Rework all console queries to go through that object API

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-25 06:20:42 -05:00
Cole Robinson
44c519200c cli: Add _AutoconsoleData and use it
This will be expanded later to track explicit requests for certain
console types

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-24 18:12:06 -05:00
Cole Robinson
89fc06f642 cli: Add --cloud-init meta-data=/path/to/meta-data
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-21 17:34:39 -05:00
Cole Robinson
e1bd5f92cf cli: Add --cloud-init user-data=/path/to/user-data
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-20 17:47:34 -05:00
Athina Plaskasoviti
7ae6a60086 cloudinit: Move random password printing and sleeping to virt-install
Fixed:
- Added a do_log flag to print_stdout(), to avoid logging of printed random password.
- Excluded timeout in virt-install from testing

Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-11-20 16:41:10 -05:00
AthinaPl
b4daeba6b5 cloudinit: Add ssh-key=/path/to/key cli option
Login to VM with:
ssh root@vm_ip_address

Signed-off-by: AthinaPl <athina.plaskasoviti@gmail.com>
2019-11-20 16:41:10 -05:00
Athina Plaskasoviti
7a2c53612f cloudinit: Add root-password-generate=yes|no instead of root-password=xxxx
Now --cloud-init defaults to root-password-generate=yes,disable=yes.
Option for plaintext password given through the cli is completely removed.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-11-20 16:41:10 -05:00
Athina Plaskasoviti
050d4dd62a cloudinit: Add cli option root-password-file=/path/to/file
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-11-20 16:41:10 -05:00
Athina Plaskasoviti
0bbfc80b68 cloudinit: Add disable=yes|no
Cli option to permanently disable cloud-init after first boot by user request.
Handled so that bare --cloud-init defaults to --cloud-init root-password=generate,disable=yes.

Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-11-20 16:41:10 -05:00
Cole Robinson
ec47c9dafc cloudinit: Fix setting root password in user-data 2019-11-20 16:41:10 -05:00
Athina Plaskasoviti
19317024cc Introduction of cloud-init configuration in virt-install
Usage:
--cloud-init

Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-11-20 16:41:05 -05:00
Cole Robinson
c311b28979 cli: Add 'clearxml' arg for options it doesn't apply to
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-20 16:40:00 -05:00
Fabiano Fidêncio
cdcec1fb03 unattended: Add option to set the user-login
Let's allow setting the login of the guest user.

Using the user from the system is a quite good fallback, but would break
unattended installations when running virt-install as root. Thus, for
those cases, it makes sense to have the option of setting the user
login.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-11-12 16:07:07 -05:00
Cole Robinson
0eb571f9e1 cli: Add --tpm backend.encryption.secret=
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-09-04 08:29:58 -04:00
Menno Lageman
0254558e6e cli: add --features kvm.hint-dedicated.state=
QEMU version 2.12.1 introduced a performance feature under commit
be7773268d98 ("target-i386: add KVM_HINTS_DEDICATED performance hint").
Support for this performance hint was added in libvirt 5.7.0 by commit
cb12c59dac04 ("qemu: support for kvm-hint-dedicated performance hint").

This patch extends virt-install's existing --features option to insert the
appropriate XML into the guest definition if this feature is specified
on the command line.

    E.g. --features='kvm.hint-dedicated.state=on' would result
    in the following XML:

      <features>
        ...
        <kvm>
          <hint-dedicated state='on'/>
        </kvm>
        ...
      </features>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Menno Lageman <menno.lageman@oracle.com>
2019-09-03 14:04:18 -04:00
Cole Robinson
1f0c262051 cli: Add --controller driver.iothread
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-08-28 13:17:32 -04:00
Cole Robinson
cee3f6b48e cli: Add --disk driver.iothread
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-08-28 12:43:56 -04:00
Athina Plaskasoviti
2e49041d85 cli: Add --clock timer[0-9]*.catchup options
Added:
-timer[0-9]*.catchup.threshold
-timer[0-9]*.catchup.slew
-timer[0-9]*.catchup.limit

Catchup attributes need timer with assigned tickpolicy=catchup.

XML Mapping:

<clock>
  ...
  <catchup threshold="X" slew="X" limit="X"/>
  ...
</clock>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-08-19 15:39:47 -04:00
Athina Plaskasoviti
cc60d558c0 cli: Add --cputune memorytune options
--memorytune[0-9]*.vcpus
--memorytune[0-9]*.node[0-9]*.id
--memorytune[0-9]*.node[0-9]*.bandwidth

XML Mapping:

<cputune>
  ...
  <memorytune vcpus="X">
    <node id="X" bandwidth="X"/>
  </memorytune>
  ...
</cputune>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-08-19 15:39:47 -04:00
Athina Plaskasoviti
9cea262b85 cli: Add --cputune cachetune options
- cachetune[0-9]*.vcpus
- cachetune[0-9]*.cache[0-9]*.level
- cachetune[0-9]*.cache[0-9]*.id
- cachetune[0-9]*.cache[0-9]*.type
- cachetune[0-9]*.cache[0-9]*.size
- cachetune[0-9]*.cache[0-9]*.unit

XML Mapping:

<domain>
...
  <cputune>
  ...
    <cachetune vcpus="X">
      <cache level="X" id="X" type="X" size="X" unit="X"/>
    </cachetune>
  ...
  </cputune>
...
</domain>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-08-19 15:39:47 -04:00
Athina Plaskasoviti
7f8648c53d cli: Add --boot initdir, inituser, initgroup options
XML Mapping:

<os>
...
<initdir>X</initdir>
<inituser>X</inituser>
<initgroup>X</initgroup>
...
</os>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-08-03 19:34:18 -04:00
Cole Robinson
b20c5764bc man: Document the --keywrap option 2019-07-28 18:11:04 -04:00
Athina Plaskasoviti
e70ead5098 cli: Add --blkiotune device[0-9]*.read_bytes_sec/write_bytes_sec/read_iops_sec/write_iops_sec options
XML Mapping:

<blkiotune>
  <device>
    ...
    <read_bytes_sec>X</read_bytes_sec>
    <write_bytes_sec>X</write_bytes_sec>
    <read_iops_sec>X</read_iops_sec>
    <write_iops_sec>X</write_iops_sec>
    ...
  </device>
</blkiotune>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-07-25 19:13:13 -04:00
Athina Plaskasoviti
9afe51a0f8 cli: Add --keywrap cipher[0-9]*.name=aes|des, cipher[0-9]*.state=on|off
XML Mapping:

<domain>
...
  <keywrap>
    <cipher name="X" state="X"/>
  </keywrap>
...
</domain>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-07-23 16:59:32 -04:00
Athina Plaskasoviti
2b24a85884 cli: Add --clock timer[0-9]*.track, timer[0-9]*.mode, timer[0-9]*.frequency options
XML Mapping:

<clock>
...
  <timer track="X" mode="X" frequency="X"/>
...
</clock>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-07-15 16:11:51 -04:00
Fabiano Fidêncio
58c6876450 unattended: Read the passwords from a file
Let's not expose the user/root password in the CLI and, instead, let's
rely on a file passed by the admin and read the password from there.

'CVE-2019-10183' has been assigned to the virt-install --unattended
admin-password=xxx disclosure issue.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-07-03 13:25:26 -04:00
Cole Robinson
f3e7b9a8f0 cli: Finish off test coverage 2019-07-03 13:12:10 -04:00
Cole Robinson
3a1f10c6c5 cli: Remove warnings about spice and GL
libvirt catches the missing support here, and the warnings are not
accurate because these values can work with SDL and EGL headless.
2019-07-02 14:58:44 -04:00
Cole Robinson
afdb25e158 cli: Add more 'no cover' annotations 2019-07-02 14:58:44 -04:00
Athina Plaskasoviti
b6563b90e5 cli: Add --numatune options memnode[0-9]*.cellid, memnode[0-9]*.mode, memnode[0-9]*.nodeset
XML Mapping:

<numatune>
...
  <memnode cellid="X" mode="X" nodeset="X"/>
...
</numatune>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-06-17 17:41:25 -04:00
Andrea Bolognani
fb81adea7e cli: Add special treatment for --memballoon none
We want to start adding a memory balloon automatically to
guests, but we also need to make sure that it can be explicitly
disabled at the user's request.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-06-17 13:50:11 -04:00
Cole Robinson
728fd7cf7b cli: Don't generate path with 'None' if --name not specified
Use 'disk' instead. It will take some work to unwind this so
that the path isn't generated until a name is truly specified
2019-06-17 01:04:58 -04:00
Cole Robinson
16362671e9 virt-install: Add --install no_install=yes|no
This just formalizes the behavior of things like --import and
--livecd
2019-06-17 00:12:32 -04:00
Cole Robinson
e9439a8ef1 virtinst: Move multiple installer .py files to virtinst/install/ 2019-06-17 00:12:32 -04: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
addff23ccb guest: Add uefi_requested
This helps us break that virt-install dependency: parse cli to get
arch/machine info, cli requests uefi, uefi needs to know arch machine
info. Instead just make the 'uefi' bit set a flag, that we resolve
in Guest.set_defaults once we have all the info we need.
2019-06-16 18:32:07 -04:00
Cole Robinson
9c8e879ff0 virt-install: Add --boot firmware= 2019-06-16 17:15:08 -04:00