Commit Graph

64 Commits

Author SHA1 Message Date
Cole Robinson 388850f04e virtinst: Rename util to xmlutil
The only functions left in there are largely for xml handling, so
make it explicit
2019-06-07 18:21:24 -04:00
Cole Robinson bc4573a14b Fix codespell errors 2019-05-16 14:43:31 -04:00
Cole Robinson 2a30a5f0bf cli: make parse() guest argument optional
Because the non-guest parsers don't need it.
2019-05-12 17:22:13 -04:00
Cole Robinson 3bd7c7c55b cli: Clarify guest_propname and list_propname
There's conflicting 'propname' naming now, so rename some usage
to match
2019-05-10 14:02:44 -04:00
Cole Robinson 7afbb90b4d virt-xml: Handle VM names that look like id/uuid (bz 1679025)
Previously we assume they are id/uuid, so if it's actually the VM
name then the command fails. Now we always check for a name first,

https://bugzilla.redhat.com/show_bug.cgi?id=1679025
2019-03-21 13:45:58 -04:00
Marc Hartmayer 90b1a3ab7d virt-xml: Add support for starting the domain
Add support for starting the domain. By default, first the domain is
defined and then started. If the `--start` is used in combination with
`--no-define` a transient domain is created without persisting the
changes in the persistent domain definition.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-03-06 13:15:38 -05:00
Marc Hartmayer 29f9f2ac9c virt-xml: Add --no-define argument
Add `--no-define` argument. It's mutually exclusive to the `--define`
argument and later on it allows the user to start a domain
transiently.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-03-06 13:15:38 -05:00
Cole Robinson 4a2ff83b51 cli: Parameterize --os-variant
For now it just takes a single name= parameter that maps to
the current behavior
2019-02-07 16:27:01 -05:00
Cole Robinson a9eecd591c cli: Rename options.distro_variant to options.os_variant
We don't really use the 'distro' naming any more, and the
command line option is called os_variant, so stick with that
2019-02-07 15:48:40 -05:00
Lin Ma bbe4866127 cli: Add function cli_flag_name and use it
It can convert the underscore to minus for cli_arg_name in help
output or error message.

Signed-off-by: Lin Ma <lma@suse.com>
2019-01-14 10:40:54 -05:00
Cole Robinson 6c28f53590 cli; Share --os-variant option registering
And improve the help message for both users
2019-01-08 12:44:53 -05:00
Cole Robinson 2f89ecf4a9 Remove Author lines from file headers
Similar to what was done in libvirt. See these commits:

600462834f
c99e954973
2019-01-08 11:45:35 -05:00
Lin Ma 4b09a26578 virt-xml: Add auto complete support for the general options
Signed-off-by: Lin Ma <lma@suse.com>
2018-12-18 11:20:35 -05:00
Andrea Bolognani d2d103a334 virt-xml: Start using --os-variant
The option only works with --add-device for the time being,
so we prevent its use in all other cases.

It would be nice to have it work with --build-xml too, but
in that case the user would have to provide some extra
information that in the case of --add-device we can figure
out from the existing guest, and it's not entirely clear
whether that would even be that useful, so for now we're
not considering that case at all.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-11-13 12:15:50 +01:00
Andrea Bolognani ade53764fc virt-xml: Accept --os-variant option
We're not doing anything with it yet, but having the
parser accept it means we can write tests and see how
their output changes once we wire it up in earnest.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-11-13 12:08:46 +01:00
Cole Robinson bd35f4711c devices: disk: Rename setup() to build_storage()
It's more explicit. Plus drop the supposedly generic setup()
entry point, storage is handled specially everywhere so it's
not a generic interface
2018-09-04 14:55:04 -04:00
Cole Robinson 882e9d1dee virt-xml: Call set_defaults on created XML objects 2018-09-04 14:55:04 -04:00
Cole Robinson ea413be214 xmlbuilder: Rename get_xml_config -> get_xml
The config part is redundant. Should have done this a long time ago
2018-08-31 16:52:02 -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
David H. Gutteridge 4a58a689db virt-xml: Warn when --update is inapplicable 2018-04-03 12:34:55 -04:00
Cole Robinson 46ec093a28 virt-xml: Make it more clear when changes take effect
shutdown could be interpreted as a soft reboot, which won't
apply the changes
2018-03-25 19:22:28 -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 b6dcee8eb7 Use consistent and minimal license header for every file 2018-03-21 07:29:40 -04:00
Cole Robinson 8c3388697c virt-xml: Remove redundant XML roundtripping
Based on how we do diff reporting it doesn't accomplish anything anyways
2018-02-22 18:48:31 -05:00
Cole Robinson ddba9c1702 Switch to python3 in script shebang
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2018-02-06 18:56:15 -05:00
Cole Robinson 8b4befae60 virtinst: Drop UUID validation
It's redundant as libvirt will give us these checks already, and we
aren't even testing it
2017-12-14 12:45:01 -05: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 4e7a6ad728 tests: pylint: Silence/fix a bunch of new warnings 2017-06-16 12:54:56 -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
Cole Robinson 38c10f70f8 virt-xml: Only print message if changes are applied 2017-03-06 22:15:46 -05:00
David H. Gutteridge 9a451e6faa Remove minor redundancy in action_remove_device()
There's no need to call util.listify() twice.
2017-02-16 13:31:32 -05:00
Cole Robinson 118bf85cba Apparently -tt doesn't work with #!/usr/bin/env ... 2016-06-17 16:38:57 -04:00
Cole Robinson 47dd38eb3e Use #!/usr/bin/env for python scripts
This is recommended for upstream, but not for downstream, like Fedora.
So change /usr/bin/env to /usr/bin/python2 at RPM install time to
match the ideal Fedora config.

https://fedoraproject.org/wiki/Features/SystemPythonExecutablesUseSystemPython
https://bugzilla.redhat.com/show_bug.cgi?id=1303282
2016-06-17 12:56:14 -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 3ce5af712b cli: Drop unused VirtCLIParser.option_variable_name 2016-06-13 19:15:35 -04:00
Cole Robinson 68962f48f7 virtinst: Support multiple seclabels
libvirt has supported this for a while. Wire it all up through the
cli, and fix some bad assumptions along the way.
2015-09-05 13:49:36 -04:00
Cole Robinson 4d87d2f27b cli: Make child lookup not specific to guest devices
<seclabel> is not singleton nowadays, so we need to extend our
infrastructure to handle non-device child properties. This is part of
that
2015-09-04 16:16:25 -04:00
Pavel Hrdina 76bad650de virt-xml: refactor the handling of --define and --update options
The code was wrong in many ways.  The main issue was, that for live
updates we were using config XML instead of live XML.

This patch fixes the --update and --define options to work properly as
described in man page.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-07-07 10:42:32 -04: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 d4bf3b58a0 clitest: Drop prompttest infrastructure
Just fake it for the one remaining test
2015-04-22 18:00:00 -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 99700821c6 virt-install: Reorder --help output a bit 2014-09-20 19:30:16 -04:00
Cole Robinson 0ad7611b59 virt-xml: Tweak update prompting messages 2014-09-17 12:21:49 -04: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
Chen Hanxiao b53b3874a4 virt-xml: add "-c" as short option of "--connect"
Add "-c" as short option of "--connect" for virt-xml.

We could use either
virt-xml -c lxc:///
or
virt-xml --connect lxc:///

This will be more convenient if we operate
non-default hypervisor.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2014-02-12 22:57:40 +08:00
Cole Robinson ac6706208d cli: Shorten some long --help examples 2014-02-10 18:13:42 -05:00
Cole Robinson d76aab264e tests: Only use one env variable to notify we are running tests 2014-02-10 14:47:20 -05:00