Commit Graph

254 Commits

Author SHA1 Message Date
Pavel Hrdina aebebbf879 virt-install: report an error for pxe install without network
Fix a regression where we used to report an error message if user
specified pxe installation without any network (--nonetworks or
--network none).

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-08-06 14:56:30 +02:00
Pavel Hrdina 0fbe8e7a1f translation: fix wrong usage of _() function
All the strings have to be at first translated and then we can fill the
formated and translated string.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-06-05 16:33:51 -04:00
Cole Robinson 93f826a8b2 cli: Replace add --check option (bz 1063471)
For fine grained enabling/disabling validation checks. Use this to
replace the heavy handed --force option.
2015-04-11 19:48:35 -04:00
Cole Robinson 9b21f27e31 cli: Maintain same --print-xml behavior for non virt-install
Don't want it scooping up any nargs
2015-04-07 19:58:28 -04:00
Cole Robinson 3d6831ec8f virt-install: Deprecate --print-step, just use --print-xml
argparse lets us handle this in a back compat fashion, so let's simplify
the CLI.
2015-04-04 17:10:45 -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 2c9d2a2360 virt-install: Don't print virsh command if VM is running (bz 1180558) 2015-03-26 16:43:28 -04:00
Cole Robinson c7c772b200 virt-install: Default to --boot uefi
Try to use --boot uefi if the user hasn't already specified loader params,
or a kernel to boot. If we can't determine a UEFI setup, just print a
warning.
2015-02-22 10:25:51 -05:00
Cole Robinson 09ef4583a0 virt-install: Also don't show console= warning for machvirt + --location 2014-11-21 13:57:30 -05:00
Cole Robinson 507af25258 virt-install: Don't warn about missing console= for machvirt
Since latest kernels figure it out automatically
2014-11-20 19:15:11 -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 64106230bd virt-install: Add hidden option --test-media-detection
Can help with debugging and test cases
2014-09-20 20:32:19 -04:00
Cole Robinson 99700821c6 virt-install: Reorder --help output a bit 2014-09-20 19:30:16 -04:00
Cole Robinson d7e1a40352 virt-install: Deprecate --nodisks in favor of --disk none 2014-09-20 19:16:13 -04:00
Cole Robinson 57ae284ad4 virt-install: Deprecate --nonetworks in favor of --network none
Follows the pattern used by the other cli options
2014-09-20 19:02:38 -04:00
Cole Robinson c26512926d virt-install: Default to --graphics even if DISPLAY is unset
This was a weird bit of logic that tries to be smart, but there isn't
a clear corrolation between DISPLAY being unset and whether the user
wants graphics or not.

Make the default consistent, some people may need to adjust to
--nographics
2014-09-20 18:52:20 -04:00
Cole Robinson 1f3f3fa4fc virt-install: If virt-viewer will fail, default to --wait -1
This can happen if user requests explicit --graphics, but they are on
a headless display. We had a few reports of this recently.
2014-09-20 18:28:43 -04:00
Cole Robinson ca2ee52eb8 virtinst: cli: Move unshared bits to virt-install
Since virt-image is gone, this stuff should all be private to virt-install
2014-09-19 20:31:22 -04:00
Cole Robinson 8b20f68cd7 virt-install: Print warning if no OS detected or specified 2014-09-07 13:55:45 -04:00
Cole Robinson c46459d6a6 virt-install: Improve warning with headless --cdrom 2014-09-07 13:51:15 -04:00
Cole Robinson a8843e5807 virtinst: Remove redundant LiveCDInstaller
DistroInstaller can basically do the same thing. This also gives us distro
detection when using virt-install --livecd
2014-09-07 13:42:56 -04:00
Cole Robinson a722eeac78 virt-install: Enable libosinfo detection for --cdrom
This streamlines virt-manager and virt-install implementations, requiring
installer.distro_detect to be called if we want distro detection. As
a side effect, we now get CDROM detection for free.
2014-09-07 12:20:26 -04:00
Richard W.M. Jones 283553060d arm: On arm the virtual console is PL011-based ttyAMA0.
Confusingly real ARM hardware can have either PC-like 8250 devices,
which the Linux kernel calls /dev/ttyS0, or ARM-only PL011-based
/dev/ttyAMA0.

qemu can emulate either, but the default for `-M virt' is the PL011
so /dev/ttyAMA0.

Change the warning message so it uses ttyAMA0 instead.
2014-08-05 13:32:45 +02:00
Chen Hanxiao 2f4a424521 use binary prefixes for units where appropriate
https://bugzilla.redhat.com/show_bug.cgi?id=1103893

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2014-06-16 11:56:53 +08:00
Cole Robinson f397d96ca6 virt-install: Don't require install option with --print-xml (bz 1095789) 2014-05-11 19:19:00 -04:00
Cole Robinson 2de9e9cc52 virt-install: Remove needless error message redirection 2014-05-11 19:00:51 -04:00
Giuseppe Scrivano bcb60f0fb1 virt-install: Drop support for --os-variant list
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-03-24 12:40:42 +01:00
Cole Robinson 63b27ceae1 caps: Simplify guest lookup routines
Checking for acceleration should always be done, API users can opt out
by requesting a specific domain type.
2014-02-17 11:54:11 -05:00
Martin Kletzander 4196f4287b Use proper python version
since we work with python2 only, mentioning it in all shebangs make
the commands from git work even when python3 is set as default.

This also fixes one test where command being ran is 'virt-xml' through
subprocess.Popen().

While at that, add '-tt' where possible in order to make everyone use
same indentation characters.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-02-12 21:55:32 +01:00
Cole Robinson ac6706208d cli: Shorten some long --help examples 2014-02-10 18:13:42 -05:00
Chen Hanxiao fcac052cdc virt-install: add support for user namespace
This patch will enable configuring idmap.
It could be used as enable user namespace
for LXC containers.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2014-02-09 13:16:34 -05:00
Cole Robinson 0b4a72fd77 virt-convert: Reimplement it
We totally break CLI compat here, but the previous tool wasn't sustainable.
Instead, repurpose the tool as strictly converting external formats
like ovf/vmx to native libvirt XML, and launch the guest.

So we drop vmx/virt-image output, and virt-image input, and a slew of
command line options. I don't think anyone was depending on this in a
scripted fashion, so in practice I don't think anyone will care.

Add much more comprehensive unit tests while we are at it.
2014-02-07 21:16:09 -05:00
Cole Robinson 2ffd5a66e6 guest: Add single entry point for adding default devices 2014-02-07 16:07:32 -05:00
Chen Hanxiao c23de0b181 virtinst: drop parameter guest in convert_old_networks
We do not use this paramter any more since commit:
46d3e0041a.
So drop it.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2014-02-06 22:33:00 +08:00
Cole Robinson e70ab961f9 virt-install: Switch back to using --sound argument
Since argparse allows optional arguments, we can back compat handle the
original boolean --sound option. This is nicer than using an option
named --soundhw
2014-02-05 12:41:34 -05:00
Cole Robinson 4e4fb15a2f virt-*: Drop all --prompt handling
This stuff is not very helpful and a pain to maintain. Let's drop it once
and for all. We still accept the CLI options and log a warning so people
hopefully take the hint.
2014-02-04 17:01:27 -05:00
Chen Hanxiao ad05b19f20 If we use "--boot init=INITPATH" style to set
container's init, virt-install will complain:

"ERROR    Install methods (--location URL,
--cdrom CD/ISO, --pxe, --import, --boot hd|cdrom|...)
cannot be specified for container guests"

This patch will fix this bug.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2014-02-03 19:03:21 +08:00
Cole Robinson 95575aa5c7 virt-install: Add lots of warnings if --nographics won't work 2014-02-02 15:34:32 -05:00
Cole Robinson 927a7ef265 cli: Add --metadata option
Can take name, description, uuid, and title (new). This deprecates the
separate --description and --uuid element, but we won't require it for
specifying a name with virt-install/virt-image since that's quite
overkill. Allowing --name with this option is mostly for the benefit
of virt-xml.
2014-01-25 17:20:29 -05:00
Cole Robinson ed25983d14 virt-install: Drop useless assignment 2014-01-25 17:20:29 -05:00
Cole Robinson 7ba76b5748 cli: Add --memory, deprecates -r/--ram
This is a compound option like we use elsewhere, with suboptions for
maxmemory and hugepages.
2014-01-25 17:20:29 -05:00
Cole Robinson 35f6567c69 Allow command line introspection ex: disk=?
This will list all sub options associated with that command.
2014-01-22 15:37:23 -05:00
Cole Robinson 812c4c6d98 virt-install: Move more shared options to cli.py
virt-xml will use these
2014-01-22 10:43:48 -05:00
Cole Robinson f9ab83a69e virt-install: Deprecate --init, make it --boot init= instead 2014-01-22 10:43:09 -05:00
Cole Robinson ec79c676b3 cli: Deprecate explicit --cpuset option, make it a --vcpus sub option 2014-01-22 10:43:01 -05:00
Cole Robinson 54b73f4502 cli: Centralize most option handling dispatch
Rather than require tools to do multiple parse_* calls. This infrastructure
will help with virt-xml as well.
2014-01-22 10:42:05 -05:00
Cole Robinson 269339f29f cli: drop get_* helpers, just make parse_* helpers handle all cases 2014-01-22 10:40:48 -05:00
Cole Robinson d216c44157 Stub out --check-cpu option
It's old, uninteresting, and I don't think anyone is depending on it
to work. Parse the command line option, but don't do anything differently.
2014-01-22 10:38:42 -05:00
Cole Robinson 6c7439d625 cli: Drop useless get_uuid helper 2014-01-22 10:36:21 -05:00
Cole Robinson d1edce1ca5 cli: Drop dest= from most arguments, it was redundant 2014-01-22 10:36:14 -05:00
Cole Robinson 41a84bae9f cli: Rework adhoc CLI parsing into a class structure
This adds:

VirtCLIArgument: a single foo=bar mapping
VirtOptionString: A collection of VirtCLIArguments, that parses the whole thing
VirtCLIParser: Represents a single cli option like --disk, --network, etc.

Centralizing this infrastructure opens up a lot of doors for future
improvements, like cli option introspection.
2014-01-22 10:35:30 -05:00
Chen Hanxiao a98515a4da virt-install: add support for '--panic option'
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>

(crobinso: man page and cli tweaks)
2014-01-22 09:33:18 -05:00
Cole Robinson c426a30511 Convert all command line handling to argparse
Allows us to drop some hacks, and we may need it for a new upcoming
tool.
2014-01-19 11:32:08 -05:00
Cole Robinson a82b60dcff capabilities: Remove some public API back compat 2014-01-18 13:23:30 -05:00
Cole Robinson bd5b285eea virt-install: Drop inaccurate comment, update copyright date 2013-12-14 18:28:27 -05:00
Cole Robinson 56b9f6187b Streamline support checks
Just use one function check_support
2013-10-06 10:08:04 -04:00
Cole Robinson 18fa751059 Add qemu-guest-agent channel automatically for supported OS 2013-10-06 09:19:59 -04:00
Cole Robinson f44ad5ae05 Default to virtio console for supported OS
This could cause issues for people trying unattended non-graphical
kickstart installs and expecting ttyS0 in the guest to be hooked
up to the default console. So to get back the default behavior, you
can do:

  --console pty
2013-10-06 08:53:05 -04:00
Cole Robinson dae3678d26 guest: Absorb more default device checks 2013-10-06 08:30:33 -04:00
Cole Robinson d0b067f2fc virt-install: Add --clock option 2013-10-05 16:48:07 -04:00
Cole Robinson e6cebd04ca virt-install: Fix launching console (after graphics rework) 2013-10-02 20:20:52 -04:00
Cole Robinson 9c57c72eac Default to adding USB2 for new enough KVM
We enable this for virt-install as well. To avoid it, you can do either

--controller usb,model=none or --controller usb
2013-10-02 15:54:35 -04:00
Cole Robinson 4c15da439b cli: Combine registering a bunch of common options 2013-09-28 11:27:26 -04:00
Cole Robinson b3719f25ac cli: s/yes_or_no/yes_no/g 2013-09-28 10:06:52 -04:00
Cole Robinson b3a72bcb95 cli: Remove unneeded parameter to optparse.add_option 2013-09-28 10:03:08 -04:00
Cole Robinson eca87838fb virt-install: Add --features option
And hide docs about old --noacpi/--noacpi options. I don't think
anyone really uses them anyways, but if anyone complains we should
just implement --features for the other CLI commands.
2013-09-28 09:58:57 -04:00
Cole Robinson 16a190a0dc cli: Add some consistency to deprecated option handling
Take all the old options and convert them to new style, so the rest
of the app only needs to deal with new style bits.
2013-09-27 22:31:52 -04:00
Cole Robinson 6013622da4 cli: Make option handling more consistent 2013-09-27 16:52:41 -04:00
Cole Robinson 1212cf43a9 DomainFeatures: Drop __getitem__ helpers
They just complicate matters
2013-09-27 15:08:44 -04:00
Cole Robinson c5f5d5ad9d urlfetcher: Clean up APIs for fetching URL media 2013-09-26 14:28:13 -04:00
Cole Robinson a2e5206730 deviceinterface: Fix creating direct interfaces (bz 1006324)
And take the opportunity to standarize on setting net.source,
rather than have API users have to do net.bridge/network/source_dev
2013-09-24 10:00:01 -04:00
Cole Robinson e9b8a289b5 network: Centralize pxe support check 2013-09-22 17:05:15 -04:00
Giuseppe Scrivano a55438f880 virt-install: add support for virtio-rng devices
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2013-09-20 18:56:19 -04:00
Cole Robinson b96fa5706c Fix a couple transalation issues 2013-09-20 12:10:34 -04:00
Cole Robinson 38545e3af8 Fix pylint warnings with latest version 2013-09-19 13:14:44 -04:00
Cole Robinson f220e6778c Guest: Drop OS listing helpers, and OS_TYPES back compat 2013-08-11 14:52:30 -04:00
Cole Robinson 45d2db887d virt-*: Unify handling of --os-variant
And hide --os-type from the cli since it is long since redundant.
2013-08-11 12:39:28 -04:00
Cole Robinson d36f953142 guest: Move all console handling to virt-install, the only consumer 2013-08-11 12:39:28 -04:00
Cole Robinson 87789548ba guest: Drop consolecb and wait parameters from start_install 2013-08-11 12:39:28 -04:00
Cole Robinson 012d1cdc52 Installer: Drop all XML handling, just have it setup install info 2013-07-23 17:34:33 -04:00
Cole Robinson 00d41be5c5 DistroInstaller: Bunch of misc cleanup 2013-07-23 17:34:32 -04:00
Cole Robinson f37d4d010a virtinst: Drop __init__ params from Guest and Installer 2013-07-23 17:34:32 -04:00
Cole Robinson 524d1047b1 Guest: Make API users opt in for default console/input devices
We don't need to maintain API back compat anymore
2013-07-23 17:34:32 -04:00
Cole Robinson e802eae07b VirtualCharDevice: Convert to new style XML props, rework API 2013-07-23 17:34:31 -04:00
Cole Robinson 4ce1774d53 VirtualDisk: Rework provisioning and validation behavior
We separate all the provisioning bits to diskbackend.py. VirtualDisk
users now need to explicitly opt in to storage creation by using
set_create_storage().

validation is no longer done automatically, users must call the
validation() command.

__init__ drops all extra parameters.

This will eventually get us to a point where we can unify the manual
XML building and XML parsing machinery, and get consistent validation
behavior between devices.
2013-07-13 16:37:33 -04:00
Cole Robinson 2540c5dc9a virt-install: Fix use of removed get_uri API 2013-07-13 16:32:21 -04:00
Cole Robinson 0d5fe93048 Centralize XML helpers in virtinst/util.py 2013-07-12 13:10:23 -04:00
Cole Robinson 94f8d4cfa9 VirtualConnection: cache capabilities XML
This means we can drop passing around the pre-parsed caps info everywhere.
2013-07-06 14:12:13 -04:00
Cole Robinson ec734191fc virtinst: connection: Absorb all scattered URI helpers 2013-07-06 12:40:24 -04:00
Cole Robinson b6fa7d16e5 Add epilog and description for virt-* --help 2013-06-30 15:03:53 -04:00
Stefan Berger 93718868c7 Add CLI support and CLI test cases
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2013-06-26 19:43:58 -04:00
Cole Robinson 7ae458f1ba virt-install: Error if -c <uri> specified
-c maps to --cdrom for virt-install, but for other libvirt tools like
virsh it maps to --connect.

Handle -c and --cdrom a little differently: if -c contains '://',
error out with an explanation. User can work around it by using
--cdrom. This could in theory break some users, but the change they
make will be backwards compatible.
2013-04-21 12:28:14 -04:00
Cole Robinson 0f57dae8b2 virtinst: Remove not-very-useful post_install_check
It doesn't work in a variety of cases and it's not very useful
to begin with.
2013-04-15 12:37:36 -04:00
Cole Robinson 0d243983d0 Revive pep8 and clean up the code
autopep8 is pretty cool :)
2013-04-13 15:22:43 -04:00
Cole Robinson baf531f710 virtinst: Guest: Remove back compat static device lists 2013-04-13 13:40:45 -04:00
Cole Robinson 7a47465ab6 virtinst: Guest: remove back compat graphics handling 2013-04-13 13:40:45 -04:00
Cole Robinson ae471007fc Tons of misc pylint fixes 2013-04-13 13:40:29 -04:00
Cole Robinson a386186c74 Remove most map() and filter() usage
They aren't available on python3 so pylint complains, and list
comprehensions are usually better.
2013-04-12 08:27:44 -04:00
Cole Robinson c5e45ae448 Remove all relative imports
We also drop VirtualDevice from the 'public' virtinst API, since there
are better ways to get its info.
2013-04-12 08:27:44 -04:00
Cole Robinson 927bcc11cd virtinst: util: Move URI helpers to their own file
Helps us avoid some relative imports, and makes things cleaner.
2013-04-11 12:15:38 -04:00
Cole Robinson 3bce20d974 virtinst: Combine util.py and _util.py
Was originally split to not pollute the public API, but we aren't public
anymore
2013-04-11 12:15:37 -04:00
Cole Robinson 9fc356af43 virt-install: Better error when user accidentally passes -vcpus
Notice the missing - in -vcpus. It maps to

--hvm --cdrom pus

If the user also specifies --paravirt, they get an error that hvm and
paravirt conflict, which is very confusing.

There isn't a nice way to catch this issue which isn't back compatible,
so scrape the raw argv and try to figure it out.
2013-04-04 12:04:07 -04:00
Cole Robinson d6c8ad0297 Wire up python unit tests, unify gettext setup 2013-04-03 18:22:05 -04:00
Cole Robinson 88603e4fad Merge code from python-virtinst.git
As outlined here:

https://www.redhat.com/archives/virt-tools-list/2012-February/msg00040.html

For now this is just a direct import of the code from virtinst commit
dca5a4d6245f21d554f8853197a6a234bfc8e52c. History is not merged, so
please refer to original git for detailed commit histor:

http://git.fedorahosted.org/cgit/python-virtinst.git/
2013-04-03 18:22:05 -04:00