Commit Graph

2066 Commits

Author SHA1 Message Date
Cole Robinson
8ed9eef905 netlist: Use same default policy as virt-install
virt-manager's logic is hard to follow, and gives weird results
by just choosing the first bridge device it finds more or less.

Use virt-install's logic: bridge if it is the default route,
otherwise network 'default' if it exists

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:39:34 -05:00
Cole Robinson
869eb2dc8f devices: interface: Cache default bridge lookup for process lifetime
Saves us possibly hammering the logs if this goes wrong. We are
about to start using it more in virt-manager

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:39:34 -05:00
Cole Robinson
9a72df3128 devices: interface: Rework default_source functions slightly
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:39:34 -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
2367e70efa virtManager: Remove magic spapr-* device handling
We have lots of spapr-* pretty printing and some magic handling
spread around the codebase. These devices have fallen out of favor
and are rarely used, so drop the special handling

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
7251ea25c2 virtManager: Remove graphics keymap UI
Removing this was discussed here:
https://www.redhat.com/archives/virt-tools-list/2019-June/msg00117.html

For a decade, qemu and xen and virt-manager work together to
make setting a manual keymap redundant. Advertising it in the UI does
more harm than good, because users may think they need to specify
one when in the vast majority of cases it will give worse behavior.

With the XML editing UI, users still have a way to do this by hand
if they really know what they are doing.

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
Cole Robinson
419f8cd31b pollhelpers: Streamline usage a bit
* Explicitly define the build 'cb', don't use lambda
* Rename pollhelpers arguments, clarifying use of cb
* Check support status in pollhelpers
* Move 'dopoll' checking up a level in vmmConnection

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-24 17:04:29 -05:00
Cole Robinson
3ad646fef1 pollhelpers: Kill old style polling
All the major hypervisor drivers have supported listAllDomains
since rhel6 vintage libvirt. Most other driver types have had the APIs
since their introduction, or for just as long.

I will be surprised if this affects anyone in any material way

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-24 17:04:18 -05:00
Cole Robinson
4147f760e8 connection: Explicitly error if domain listing APIs are not supported
This will be more important when we drop old domain polling APIs,
because it will be more likely we encounter an old libvirt or weird
connection without the expected API support

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-24 15:39:41 -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
ec50dbd15d devices: disk: Ensure abspath when checking search permissions
Reported-by: Junqin Zhou <juzhou@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-18 15:27:01 -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
Fabiano Fidêncio
616ac2ebe3 installerinject: Check for genisoimage and mkisofs before calling it
Let's check for both genisoimage and mkisofs as some distros will ship
mkisofs without linking it to genisoimage, as OpenSUSE Leap 15.1 does.

And, I know, genisoimage is a requirement of the project. However, it's
not packaged on OpenSUSE Leap 15.1 while mkisofs is present there.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-12-17 17:09:26 -05:00
Michal Privoznik
66be1d009f domcapabilities: Whitelist upstream qemu edk2 paths
Upstream qemu installs
/usr/share/qemu/edk2-$ARCH-(?secure-)code.fd FW images. Whitelist
them too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2019-12-17 16:27:49 -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
Pavel Hrdina
39366c37f6 controller: don't set default controller index
Libvirt is able to figure this out and it will make usage of the CLI
options more user-friendly.

For example if users wants to add a new pcie-root-port to existing VM
they have to figure out the latest controller index and call it like
this:

    virt-xml \
        --add-device \
        --controller pci,model=pcie-root-port,index=$nextIndex \
        $VM

After this change it will be simply:

    virt-xml \
        --add-device \
        --controller pci,model=pcie-root-port \
        $VM

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-12-04 12:38:28 +01: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
04b15f0dba cloudinit: Don't regenerate root password
Store the first one we generate for later usage

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-25 14:03:49 -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
226378d522 unattended: Fix errors when running as root
Tries to use 'root' as VM username, which is forbidden

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-25 12:02:27 -05:00
Cole Robinson
530befc222 unattended: fix error message variable order
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-25 11:49:38 -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
b55a959e5e installer: Use standard scratchdir for cloudinit tempfiles
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-23 10:38:49 -05:00
Cole Robinson
18ff22f732 cloudinit: Add license header
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-22 22:59:27 -05:00
Cole Robinson
a67237b221 cloudinit: Rework file building
* Ensure files are cleaned up if we fail mid run
* Ensure temp user-data and meta-data files are cleaned up
* Move dest file naming into cloudinit.py

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-22 22:57:43 -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
Cole Robinson
9a3f73710e cloudinit: Only print generated password if it was requested
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-20 17:47:34 -05:00
Cole Robinson
f107aaab02 cloudinit: split out _create_userdata_content
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-20 17:32:49 -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
3014644f25 cloudinit: Scrub password from logs
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-11-20 16:41:10 -05:00
Athina Plaskasoviti
1b43ae8716 cloudinit: Fix password expiration
Password expiration happens in case of one time random password generation.
When user provides password from file, don't expire the password.

Signed-off-by: Athina Plaskasoviti <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
66d95c6792 cloudinit: Move password generation inside class CloudInitData
Function generate_password() provides random 16 digit password and
get_root_password() handling root_password assignment.

Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-11-20 16:41:10 -05:00
Athina Plaskasoviti
db0e524e8d cloudinit: Add basic testing for cli option --cloud-init
Tests now cover default --cloud-init behavior, and
root-password=(generate and given password),disable=no.

Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-11-20 16:41:10 -05:00
Athina Plaskasoviti
9266cc47c1 cloudinit: Change iso suffix for cloud image installations
Generated iso now called ...-cloudinit.iso.

Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-11-20 16:41:10 -05:00
Athina Plaskasoviti
dadaf8eb45 cloudinit: Fixed broken testsuite
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-11-20 16:41:10 -05:00
Athina Plaskasoviti
0e5b1b3048 cloudinit: Clean up create_metadata and create_userdata functions from unused/unwanted arguments
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