Commit Graph

36 Commits

Author SHA1 Message Date
Cole Robinson 8fe0a208db Move virt-* code into their modules
This layout is closer to what most python modules have nowadays.
It also simplifies testing and static analysis setup.

Keep virt-* wrappers locally, for ease of running these commands
from a git checkout.

Adjust the wrapper binaries we install on via packaging to be
pure python, which makes things like running gdb easier.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 18:27:20 -05: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 4973564e65 virt-clone: add --skip-copy option
This is the flip side to the --force-copy option. We already
have the plumbing internally

https://bugzilla.redhat.com/show_bug.cgi?id=1564865
2019-06-16 14:41:54 -04:00
Cole Robinson cc366fff7d cli: Add more code coverage 2019-06-11 17:51:25 -04:00
Pavel Hrdina 57db41854c virt-clone: fix force-copy of empty cdrom or floppy disk
There is nothing to copy so don't try to generate new path.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-02-28 18:05:31 +01:00
Lin Ma 38f375cf27 virt-clone: Add auto complete support for the general options
Signed-off-by: Lin Ma <lma@suse.com>
2018-12-18 11:20:35 -05:00
Cole Robinson 96ac896e1a cli: Remove redundant argparse dest= options 2018-10-11 12:53:03 -04:00
Cole Robinson 627bfabc32 pylint: Silence output on Fedora 29 2018-09-29 14:27:34 -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 b6dcee8eb7 Use consistent and minimal license header for every file 2018-03-21 07:29:40 -04: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 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 5e2b63c1ff virt-clone: add support to clone nvram VARS
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1243335

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-03-07 13:06:20 +01:00
Kothapally Madhu Pavan d107762880 Error out cleanly when autoclone or destination file is not specified
When virt-clone is used without autoclone or destination file, libvirt
errors with message "ERROR    missing source information for device vda".
This doesn't convey what is missing. This patch will indicate which
options to use.

Signed-off-by: Kothapally Madhu Pavan <kmp@linux.vnet.ibm.com>
2016-09-02 14:10:17 -04: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 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
Chen Hanxiao 4622a0a8f8 virt-clone: introduce --reflink for btrfs COW copy
libvirt commit 466b29c8c3593b2dac92acad5dd8ec923c428259
introduce btrfsCloneFile() for COW copy.
This patch add support for --reflink option for virt-clone.
When specified --reflink, if src and dst images all on a btrfs
fs, we could take advantage of COW copy.
If not, error out.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-02-07 10:18:05 +08:00
Chen Hanxiao 6811bbfaac virt-clone: remove rarely used option --original-xml in fail message
Also replace the short options by long options.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2014-12-10 11:36:23 +08:00
Chen Hanxiao 9e6eaf5d18 virt-clone: improve some error prompts
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2014-12-09 16:10:35 +08:00
Cole Robinson 196ff823b3 Fix warnings with latest pep8 2014-05-02 10:20:59 -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
Cole Robinson c5f6c6852a VirtualDisk: Always use storage APIs for provisioning
This means if we are passed an unmanaged path, we try to create a
storage pool for the parent directory.

We skip directories like /dev where doing this might be problematic.

This makes things much friendlier to use for remote connections, and
means we can always rely on having libvirt's storage APIs to use
for format probing.
2014-02-08 19:24:14 -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
Cole Robinson 4ade419002 virt-clone: Fix typo 2014-02-02 15:36:33 -05:00
Cole Robinson 37122dbc20 clone: Mention virt-sysprep everywhere (bz 878170, bz 912993) 2014-02-01 15:20:37 -05:00
Cole Robinson d1edce1ca5 cli: Drop dest= from most arguments, it was redundant 2014-01-22 10:36:14 -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 4c15da439b cli: Combine registering a bunch of common options 2013-09-28 11:27:26 -04:00
Cole Robinson b3a72bcb95 cli: Remove unneeded parameter to optparse.add_option 2013-09-28 10:03:08 -04:00
Cole Robinson e973f34c41 virtinst: Remove User module
I'm sure the solaris support is totally broken, so just drop this
overcomplicated abstraction.

Also fix a bug where we were using usermode networking in a bunch of
places where it isn't supported.
2013-07-02 21:17:07 -04:00
Cole Robinson 802ed1cba6 clone: Bunch of API cleanup
Simplify imports, drop back compat stuff, drop needless property handling.
2013-07-02 18:54:03 -04:00
Cole Robinson b6fa7d16e5 Add epilog and description for virt-* --help 2013-06-30 15:03:53 -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 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