Commit Graph

79 Commits

Author SHA1 Message Date
Cole Robinson b0d0516736 cloner: Sync <uuid> and <sysinfo> system uuid
Otherwise libvirt errors like:

ERROR    UUID mismatch between <uuid> and <sysinfo>

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

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-08-21 16:21:10 -04:00
Cole Robinson 1a1bbe99f8 cloner: Improve error message about unimplemented rbd support
Fixes: https://github.com/virt-manager/virt-manager/issues/340

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-26 16:58:45 -05:00
Liu Yiding e4a9ff7df4 cloner: mark transient_shareBacking disk as shareable
libvirt 7.4.0 added support for sharing base image of <transient/> disks,
multiple VMs can share the same image
https://libvirt.org/news.html#v7-4-0-2021-06-01

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Liu Yiding <liuyd.fnst@fujitsu.com>
2021-06-22 12:47:28 -04:00
Cole Robinson 4cfb3aeff1 cloner: more detailed error messages about supported network vols
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-11-11 19:06:32 -05:00
Cole Robinson 3d07b28a36 device: disk: Rename path property to get/set_source_path
This makes it more clear that 'path' is really a special designation
with a bunch of complicated logic behind it. It's also easier to
grep for

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-11-11 19:06:32 -05:00
Cole Robinson 1a1e4580c0 cloner: Explicitly reject 'network' disks we don't know how to clone
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-11-03 13:03:03 -05:00
Cole Robinson 9fdbccec2b Fix pylint raise-missing-from
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-15 12:36:27 -04:00
Cole Robinson 16ebab2230 clone: Rework the UI
* Drop the network editing, users can use the details window
* Drop the combo box approach in favor of a regular treeview
* Drop a lot validation checks which are redundant with modern
  virtinst. We probably lose some checks but I don't think it's
  too important
* Use the cloner API
* Add uitest coverage

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson b9de8ad919 cloner: Fix some corner cases with name generation
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson 5c1a1076c0 cloner: Log the generated XML diff, not the whole thing
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson 7f1f5e343e codespell: Whitelist 'cloneable'
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson 8856b781d0 cloner: Write preserve vs share vs clone into DiskInfo
This let's us move more of the preserve logic to virtclone.py
and prep more things to share with virt-manager

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson e6df73261b cloner: Rename clone_disk -> new_disk
The latter is more clear in most contexts, and will make more
sense for future changes

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson 9c1453a253 disk: lookup volumes in disk.set_backend_for_existing_path
Seems like it should be doing this.
Make use of that helper in cloner afterwards

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson f06325904b cloner: Share more clone disk building logic
We use this in virt-manager for nvram move on VM rename, so
let's simplify things for all callers

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson f23a27639f cloner: Big API rework
* Centralize lots of disk building
* Open code virt-clone specific behavior at the source
* Drop a lot or properties
* Move most testing to test_cli.py
* Generally a ton of cleanup

virt-manager clone wizard has not been converted yet so is totally
broken after this commit

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Pino Toscano 2760b20c84 i18n: create single strings for texts/messages
Use single strings with proper placeholders for texts, so there is no
need to join together bits of translated texts.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-15 10:22:26 -04:00
Pino Toscano 71f034d6b6 i18n: fix string puzzles in error messages
Do not split the error messages and the error details, but rather use a
single string with proper placeholders. This avoids string puzzles.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-14 11:23:57 -04:00
Pino Toscano 0145d9838b i18n: fix few spellings
"iSCSI", "KVM", "QEMU", "UNIX", "UUID", "VirtIO", "XML", "vCPU".

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-13 15:37:00 -04:00
Cole Robinson fec9f0b136 po: Fix message format warnings printed from xgettext
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-11 19:18:38 -04:00
Cole Robinson f27e203732 cli: Skip MAC collision error with --check mac_in_use=
There's valid cases where a VM can be defined with a conflicting MAC
address. Prior to  ebd6091cc8 and related refactorings we were more
lax here if the conflicting VM wasn't running, but now we are blocking
some valid usage.

Hoist the validation check up to cli.py and add --check mac_in_use=off
to skip the validation. Advertise it like we do for other checks, so
now a collision error will look something like:

The MAC address '22:11:11:11:11:11' is in use by another virtual
machine. (Use --check mac_in_use=off or --check all=off to override)

Reported-by: Pino Toscano <ptoscano@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-06 10:17:10 -04:00
Cole Robinson 140a1f3b15 cloner: Drop ability to clone a paused VM
Generally this doesn't work with qemu metadata locking nowadays,
and it was never a safe idea to begin with, because disk contents
could be in an inconsistent state.

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

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-29 18:34:38 -05:00
Cole Robinson 1e1cd4c564 cloner: Clear domain <title> as well
Otherwise in virt-manager the two VMs will be identical

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

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-29 18:34:38 -05:00
Cole Robinson dbcebeb734 guest: Move VM replace helper to cloner
It's the only user. Rework it a bit and add full coverage

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 13:08:12 -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 dcd0b2ac81 cloner: Fill out test coverage 2019-06-15 16:15:01 -04:00
Cole Robinson 387614c641 generatename: Move libvirt collision handling to callers
Make every caller pass an explicit cb that handles libvirt
collision processing. Makes it easier to see exactly what is going
on at the call impls
2019-06-11 17:54:45 -04:00
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 6677f677da util: move generate_name to generatename.py 2019-06-07 18:16:53 -04:00
Cole Robinson c603ea4084 util: Move *_meter to progress.py 2019-06-07 17:32:51 -04:00
Cole Robinson 2bd08bee64 util: Move generate_uuid to a Guest staticmethod 2019-06-06 18:24:23 -04:00
Cole Robinson b2b9d7d366 devices: char: Add CharSource
Move all ./source handling into CharSource, which will be reused by
other device classes as well. This requires us to add ../ handling
into our xmlapi xpath engine
2019-05-14 11:57:50 -04:00
Cole Robinson 622a363e5b clone: Fix inverted --nonsparse check
I botched 4f66c423f7 and inverted the sparse check, meaning --nonsparse
on the command line would actually request a sparse image. Fix it

https://bugzilla.redhat.com/show_bug.cgi?id=1675743
2019-05-13 09:58:13 -04:00
Pavel Hrdina 986097d5f8 cloner: don't fail to clone VM if nvram file doesn't exist
If a VM is defined and never started the nvram file might not exist and
in that case it's created by libvirt automatically on the first start.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-03-28 16:07:13 +01:00
Cole Robinson 4f66c423f7 cloner: Handle --nonsparse for qcow2 images (bz 1675743)
https://bugzilla.redhat.com/show_bug.cgi?id=1675743
2019-03-04 14:04:34 -05: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 ebd6091cc8 devices: interface: Simplify is_conflict_net calls
We don't return a non-fatal error these days, so adjust all callers
to only handle failure
2018-09-04 14:55:04 -04:00
Cole Robinson 8a6a491306 guest: Drop self.autostart and self.replace
Require callers to pass autostart as an argument to start_install
self.replace isn't even used for guest installs
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
Pavel Hrdina 931936a328 virtinst: Remove only auto-generated channel source path
In attempt to fix https://bugzilla.redhat.com/show_bug.cgi?id=1270696
this code was introduced but it removes the path for all channel
devices.  We need to limit it only to the devices that have
auto-generated source path.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2018-06-28 16:45:14 +02: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 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 3909c10441 virtinst: Move all devices to virtinst/devices/ 2018-03-21 07:29:40 -04:00
Cole Robinson 1c911ce567 virtinst: Give device classes consistent DeviceX naming
Previous state was inconsistenty and needlessly wordy. Fix up
a few other class namings that have redundant Virtual in the name
2018-03-21 07:29:40 -04:00
Cole Robinson b25c38816a pylint: Enable 'fixme' checking
Using these for long term TODO type items is not effective, however
it's nice to label things as FIXME during a coding session and have
pylint warn you about them before pushing.
2018-03-15 21:24:48 -04:00
Cole Robinson 3079426c82 virtinst: Drop doc= for properties
This data never gets to the user and largely is just duplicating
libvirt docs. It's redundant
2018-02-22 20:49:07 -05:00
Cole Robinson 8917305a6e Don't use count() for substring checking
Use the idiomatic 'X in Y'
2018-02-14 11:08:09 -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
Radostin Stoyanov f41aafc721 Use enumerate instead of range and len 2017-10-20 13:18:31 -04:00