Commit Graph

219 Commits

Author SHA1 Message Date
Cole Robinson
13d8a4dae5 VirtualDisk: convert driver_type and driver_name to new style property 2013-07-14 18:16:01 -04:00
Cole Robinson
1a74a8fda6 VirtualDisk: Convert 'type' to new style XML property 2013-07-14 18:15:47 -04:00
Cole Robinson
ae74bd662f VirtualDisk: Convert device property to new implicit style 2013-07-14 17:15:12 -04:00
Cole Robinson
8ad9084e5f default rejiggering setup, no regression 2013-07-14 17:12:39 -04:00
Cole Robinson
2cea517823 xmlbuilder: Allow classes to specify order of certain xml elements
This will save us some test case churn. As an example, we now
do auto building of disk <target> XML and it doesn't alter things.
Without this bus and target are often swapped.
2013-07-14 16:45:28 -04:00
Cole Robinson
154bad0184 xmlbuilder: Simplify default getter/setter some more 2013-07-14 16:35:25 -04:00
Cole Robinson
2d460a98e5 xmlbuilder: Don't treat 0 as None in setter impl 2013-07-14 16:35:25 -04:00
Cole Robinson
9c5a1b60ee CloneManager: Make sure to sync driver_name 2013-07-14 16:35:25 -04:00
Cole Robinson
ed8d785eef VirtualDisk: Drop driver_name = "qemu" from set_defaults
Our property functions should already handle that.
2013-07-14 16:35:25 -04:00
Cole Robinson
70d34e928e VirtualDisk: Drop set_vol_object, it is barely used
And it complicates syncing state. Make points where we sync values
more explicit.
2013-07-14 16:35:09 -04:00
Cole Robinson
328f98272c xmlbuilder: Add plumbing to track if a property is unset 2013-07-14 16:35:09 -04:00
Cole Robinson
6506fb2995 VirtualDisk: Drop is_parse conditional if changing device
We can easily push this up to the caller, nothing really changes the
device of an existing device in practice.
2013-07-14 16:35:09 -04:00
Cole Robinson
d3dbbe9f54 xmlbuilder: Add explicit support for refreshing an XML prop 2013-07-14 16:34:54 -04:00
Cole Robinson
c12327cbd1 Guest: Switch memory units to KB to match default XML 2013-07-13 23:07:01 -04:00
Cole Robinson
69e1d66b53 xmlbuilder: Few misc cleanups and streamlinings 2013-07-13 22:51:54 -04:00
Cole Robinson
7d75a43e33 XMLProperty: Add convenience param is_int 2013-07-13 21:49:32 -04:00
Cole Robinson
5f58d05051 VirtualDisk: Convert more XMLProperties to the new world order 2013-07-13 21:40:54 -04:00
Cole Robinson
41afdfd9aa hostkeymap: Globally cache the host lookup
Rather than make the callers worry about it
2013-07-13 20:58:09 -04:00
Cole Robinson
ed826315a5 xmlbuilder: Simplify free'ing xpath contexts 2013-07-13 20:47:19 -04:00
Cole Robinson
02f35628fb VirtualDisk: Make get_xml_config not have side effects
Move all the defaults setting to a set_defaults function, wire it
up to Guest.get_xml_config.
2013-07-13 20:22:19 -04:00
Cole Robinson
e7b518cbff Guest: Drop validate_parms, it's not useful 2013-07-13 20:01:07 -04:00
Cole Robinson
e04dfdd4ff virtinst: Test rhel defaults, and make sure it doesn't break test suite 2013-07-13 20:01:07 -04:00
Cole Robinson
b152e83fef virtinst: Rename XMLBuilderDomain.py -> xmlbuilder.py
And XMLBuilderDomain -> XMLBuilder
And _xml_property -> XMLProperty
2013-07-13 18:57:24 -04:00
Cole Robinson
4d5ca0ae5a XMLBuilder: Simplify is_multi handling 2013-07-13 18:57:20 -04:00
Cole Robinson
d8c68e3495 XMLBuilder: Split up massive get/set helpers
This should be a no-op, just a big cleanup
2013-07-13 17:54:46 -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
5962fde3e6 VirtualConnection: Fix uri helpers when we use the default empty URI 2013-07-13 16:32:21 -04:00
Cole Robinson
fbf2d9ee40 VirtualDisk: Convert simple props to unified parse/get/set 2013-07-12 15:26:51 -04:00
Cole Robinson
ce243314c0 tests: Verify that every new style XML prop is exercised
coverage isn't going to help us much here, so add some hacky infrastructure
to ensure that xmlparse.py is touching every new style xmlprop.
2013-07-12 15:19:37 -04:00
Cole Robinson
dcd632da80 XMLBuilder: Provide default fget and fset impls
This is the first step towards unifying the XML handling split between
parsing and creating from scratch. Demonstrate it with VirtualDisk.iotune
bits.
2013-07-12 14:41:29 -04:00
Cole Robinson
f620b317b9 tests: Make sure all XML use " for quoting
This is what libxml outputs with, and it's going to mess up
test output with upcoming tests.
2013-07-12 14:19:54 -04:00
Cole Robinson
0d5fe93048 Centralize XML helpers in virtinst/util.py 2013-07-12 13:10:23 -04:00
Cole Robinson
534e613d40 VirtualNetworkInterface: Absord MAC generating routines 2013-07-12 13:10:23 -04:00
Cole Robinson
f1b55090d2 VirtualDisk: Drop cache and io from __init__
They are barely used and can be specified separately.
2013-07-12 13:10:23 -04:00
Cole Robinson
57d4fcab33 VirtualDisk: Drop the volName parameter, it's not needed 2013-07-12 13:10:22 -04:00
Cole Robinson
c151b75896 XMLBuilder: Remove largely unused validation helpers
They aren't adding much value
2013-07-12 13:10:22 -04:00
Cole Robinson
318ba7e474 VirtualConnection: Deal with Guest objects, not raw XML
We already do XML parsing, no need to open code it elsewhere
2013-07-10 20:09:51 -04:00
Cole Robinson
97264a3dfe VirtualConnection: Some reorganizing to avoid circular references 2013-07-10 20:09:51 -04:00
Cole Robinson
3d1b1735ee XMLBuilder: Simplify XML deference
As long as we carry around a reference for every time we lookup
a sub node and use a wrapper class to do the free'ing, we should
be fine.
2013-07-10 20:09:51 -04:00
Martin Kletzander
f08313513b Use proper disk targets.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=968878

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2013-07-09 09:12:53 -04:00
Cole Robinson
7a2caee6e1 VirtualConnection: Allow using virt-manager object caches
So when we call into virtinst it doesn't do a whole round of object
lookup and XML fetching.
2013-07-07 18:54:08 -04:00
Cole Robinson
d386ba5d62 VirtualConnection: Add option to cache fetch_* results
We use this in the CLI tools since there's no point in repeatedly updating
the VM list if the whole process only takes a few seconds.
2013-07-07 16:38:11 -04:00
Cole Robinson
9d560f7d9a VirtualDisk: Always return VM names from is_conflict_disk 2013-07-07 16:34:46 -04:00
Cole Robinson
d5dc06148d virtinst: Move fetch_all_guests to connection object
And fetch_all_pools. And have it use pollhelpers
2013-07-07 15:14:59 -04:00
Cole Robinson
ee7d0b620d connection: Support listAll* object lookups
These calls save us a few API lookups, but are not supported by all
libvirt versions.

Since these bits were getting quite large, move them all to a separate
pollhelpers file.

However listAllInterfaces is returning an empty list for now, so we
disable the check: https://bugzilla.redhat.com/show_bug.cgi?id=982014
2013-07-07 15:06:09 -04:00
Cole Robinson
b7ee86541d virtManager: connection: Switch to tick() paradigm for all objects
This is going to be much slower than what we currently do, but we
will be trying to fix that shortly.
2013-07-07 08:44:46 -04:00
Cole Robinson
d427800f11 Share default_uri function 2013-07-06 20:09:18 -04:00
Cole Robinson
3692e98ba0 VirtualConnection: Cache conn support checks 2013-07-06 15:53:35 -04:00
Cole Robinson
c406a6433c VirtualConnection: cache version lookups 2013-07-06 15:39:00 -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
3005382e0d Make is_blktap_capable take a connection
So we don't perform the check if we're using a remote connection
2013-07-06 12:44:53 -04:00
Cole Robinson
ba3aa9ecca Drop conn_max_vcpus validation
Let's just let libvirt throw an error in the rare occasion that we
exceed max vcpus.
2013-07-06 12:40:24 -04:00
Cole Robinson
492a039f7d VirtualConnection: proxy virtinst.support API
Simplifies the lives of callers, and will allow us to do caching later
2013-07-06 12:40:24 -04:00
Cole Robinson
de51e67c74 support: Use range() enum hack 2013-07-06 12:40:24 -04:00
Cole Robinson
ec734191fc virtinst: connection: Absorb all scattered URI helpers 2013-07-06 12:40:24 -04:00
Cole Robinson
57e86259d8 Make conn required for all virtinst objects
This was the way the API had been heading, this just formalizes it.
2013-07-05 20:28:21 -04:00
Cole Robinson
be2d9ddcb4 Add base conn object and bump minimum libvirt version to 0.6.0
This base connection object will be used to simplify the API in various
places, reduce libvirt API calls, and better share code between virtinst
and virt-manager. For now it just centralizes connection opening.

This also exposed various places where our handling for older libvirt
was busted, so raise our minimum host version to 0.6.0, the first
version that supports threaded client requests.
2013-07-05 16:42:19 -04:00
Cole Robinson
35758d0fb7 Merge virt-* logging setup 2013-07-05 16:21:33 -04:00
Cole Robinson
ea2a1331cf virtinst: Guest: Simplify passing in a connection 2013-07-03 13:37:00 -04:00
Cole Robinson
d5c9f893be virtinst: Drop polkit0 support
Requires a host much older than we will currently run on
2013-07-03 12:27:03 -04:00
Cole Robinson
4672ed3a0a Drop most explicit SunOS support
We haven't had a patch from Sun/Oracle in over 4 years, nor a libvirt
patch in about as long. I don't think anyone cares.
2013-07-03 12:15:56 -04:00
Cole Robinson
4c967118d4 VirtualDisk: Remove vdisk provisioning
Since we haven't had any patches from Sun/Oracle for 4 years, and this
stuff should really go through libvirt storage APIs anyways.
2013-07-03 11:53:17 -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
80e6389b75 Fix a spelling error 2013-06-30 14:33:01 -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
Stefan Berger
c829b55581 Add VirtualTPMDevice class to virtinst
Add VirtualTPMDevice class and TPM test cases to xmlparse.py

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2013-06-26 19:43:53 -04:00
Martin Kletzander
af9762313e Fix VirtualDisk formatting
Add EOLs after iotune elements and add address generation when the
address is set.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2013-06-19 18:18:32 -04:00
Martin Kletzander
137134650f Allow partial address formatting
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2013-06-19 18:18:32 -04:00
Cole Robinson
4da8c604f8 osdict: Add Fedora 19 2013-06-13 14:58:59 -04:00
Leonardo Garcia
665375db1b Fix progres bar output bug in virt-clone.
The loop in StorageVolume._progress_thread that updates the cloning progress
bar has a call to sleep in the beginning of the loop which causes issues with
the progress bar. An example output (shorten to use less columns) with the
problem:

[laggarcia@fedora18 virt-manager]$ ./virt-clone --connect
qemu+ssh://root@192.168.122.1/system --original=Fedora18-test --auto-clone
root@192.168.122.1's password:
Allocating 'Fedora18-test-clone.img'                                  |  20 GB  00:00:56

Clone 'Fedora18-test-clone' created successfully.
[laggarcia@fedora18 virt-manager]$ '    4% [===-     ] -300039887.4 B/s | 881 MB  --:--:-- ETA

As the StorageVolume._progress_thread sleeps for one second when the loop
starts, it might occur that, when the cloning procedure finishes, the loop is
still awaiting to update the progress bar, which will cause a bad progress bar
update.

This simple fix solves this issue.
2013-06-10 10:20:35 -04:00
Leonardo Garcia
576721d8b2 Remove unnecessary nested try block.
This nested block has been added by python-virtinst's commit
4a9664634dd5ae65ed92b59b1f1543633c7d8112, aparently without need.
2013-06-10 09:55:17 -04:00
Martin Kletzander
74aa8c8a58 Generate valid UUIDs according to RFC4122
Similar change to that made in libvrt's upstream commit 396c4d34.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=963161
2013-06-05 10:19:53 +02:00
Cole Robinson
2274e233e0 Fix PCI commit, add CCID controller as well 2013-05-28 10:55:40 -04:00
Cole Robinson
448730306e virtinst: Add pretty name for PCI controller 2013-05-27 19:45:14 -04:00
Cole Robinson
14578fc2c3 details: Fix changing cirrus->QXL for active VM (bz 928882) 2013-05-27 18:50:25 -04:00
Marc Deslauriers
fb76c4e550 virt-manager: Update list of Ubuntu releases
Hi,

Here's a patch to update the list of Ubuntu releases.

Thanks,

Marc.

commit 1ada943da0ec01f444b3df452e6f371d07021330
Author: Marc Deslauriers <marc.deslauriers@ubuntu.com>
Date:   Tue May 21 15:59:17 2013 -0400

    Update list of Ubuntu releases
2013-05-21 16:02:30 -04:00
Cole Robinson
0877f9a3d9 Fix some pylint 2013-05-13 16:45:51 -04:00
Guannan Ren
32f0781531 addhardware: differentiate duplicate usb devices by bus/addr
When there are multiple usb devices with same vendor/product
in the host device list, the bus/addr is going to be used when
attaching one of usb devices.

Currently is_dup flag is only useful to VirtualHostDeviceUSB.

I put get_nodedevs_number() in connection.py, so the startup
hooks can use it.
2013-05-09 13:48:18 -04:00
Guannan Ren
4c1039252a virtinst: set is_dup to true when --host-device come with bus.addr
When there are multile USB devices, --host-device with bus.addr
can identify unique device, so we need to add bus/addr info to
XML rather than only vendor/product

If there is only one USB device with --host-device bus.addr,
adding bus/addr is no harm under the request of user.
2013-05-09 13:48:18 -04:00
Guannan Ren
0802cb1add virtinst: throw error when --host-device can't specify unique device
When there are mutiple USB devices with identical vendorId and
productId, with --host-device <vendorId:productId>, virt-install
fails to specify one.
Currently the virt-install add the first node device with
these vendorId and productId.
This fix will throw out an error when argument to --host-device
can't specify unique node device.

For example:
virt-install ${other args} \
             --host-device <vendorId:productId>
ERROR    15e1:2007 corresponds to multiple node devices
2013-04-25 13:40:23 -04:00
Cole Robinson
6f4167a66f clone: Fix --preserve-data --file /existing/storage/vol
We were validating storage creation in a bunch of cases where we
shouldn't, since it was all skipped anyways.
2013-04-24 10:50:20 -04:00
Martin Kletzander
70fa76a780 Support incomplete .treeinfo files
In case there was '.treeinfo' file available, virt-install was
forcibly getting image information out of the file.  For some
distributions (especially older releases, e.g. RHEL 4), there might be
'.treeinfo' file available, but with incomplete information.  Allow
fallback to default values even when '.treeinfo' file is found.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=954262
2013-04-22 16:57:40 +02:00
Cole Robinson
6f7fca5f2a tests: Greatly expand testdriver.xml
Mostly comes from my own testdriver I used for manual virt-manager testing.
Add some notes to HACKING about using it.
2013-04-21 13:34:51 -04:00
Guannan Ren
e941a9e92b cpu: add helper function to reset cpu related variables to none
The helper function aims to reset cpu related vars to none except
<topology>.
It is named with clear_attrs(). clear() could be saved for later use
of clearing all of them including <topology>.
2013-04-20 16:04:55 -04:00
Guannan Ren
15f72a84ab check cpu host-model mode support
UPDATE_CPU flag exists after v0.8.0, so libvirt that
supports HOST_MODEL should support UPDATE_CPU,
the earliest version we are going to check is v0.9.10.
2013-04-20 16:04:43 -04:00
Cole Robinson
a55bb900fc VirtualDisk: Fix iotune code indentation 2013-04-17 13:15:24 -04:00
Cole Robinson
07e0c92b4b Remove a bunch of outdates FIXME/XXX comments 2013-04-17 09:32:00 -04:00
Cole Robinson
9f3b21c9a1 Shorten iotune names for simplicity
And refactor some of the virt-manager code for the same goal.
2013-04-16 18:37:42 -04:00
Cole Robinson
4107646bf3 virtinst: install: simplify has_install_phase() 2013-04-15 12:37:36 -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
Ken ICHIKAWA
2a72d50477 Add support for cpu mode attribute and cpu host-passthrough
With this patch, users can use cpu host-passthrough like this:

  virt-install --cpu host-passthrough ...

Signed-off-by: Ken ICHIKAWA <ichikawa.ken@jp.fujitsu.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>

(crobinso: Add Hu Tao to AUTHORS)
2013-04-14 13:55:06 -04:00
Cole Robinson
d5f466d558 virtinst: util: Move keymap stuff to its own file 2013-04-13 16:31:13 -04:00
Cole Robinson
abbc828b70 VirtualGraphics: Don't lookup local keymap over and over
Triggered with virt-manager: new vm -> customize before install with a
non qemu. Guest.get_xml_config copies each device so it can set defaults
in a non persistent way. Unfortunately VirtualGraphics was copied before
a keymap lookup was ever done. End result was that we called
util.default_keymap over and over which is slow and floods the logs.
2013-04-13 16:18:03 -04:00
Cole Robinson
94cf9a204b VirtualGraphics: Cache locally keymap 2013-04-13 16:14:14 -04:00
Cole Robinson
02733ecff4 virtinst: util: Simplify randomUUID 2013-04-13 15:48:06 -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
3f79fa3919 Fix the last of the pylint messages
If using an older pylint, there are still some complaints about hashlib
and Popen, but those aren't our problems.
2013-04-13 13:45:08 -04:00
Cole Robinson
baf531f710 virtinst: Guest: Remove back compat static device lists 2013-04-13 13:40:45 -04:00
Cole Robinson
248a1a509f virtinst: Guest: remove legacy 'boot' handling 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
9359ad2bb6 virtinst: Remove ParaVirt and FullVirtGuest
They were just around for back compat at this point, the tools
have moved on.
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
986014ec49 XMLBuilderDomain: Replace 'map' usage
Our usage here was complex and very specific to map() behavior, so
add an explicit function that replicates what we want.
2013-04-12 08:27:44 -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
69d3f21da6 virtinst: nic: Don't check MAC collision with host
It was:

- Slow
- Not that useful
- Only worked in the local case

If anyone cares, the proper thing to do is implement it with the iface APIs.
2013-04-11 12:15:37 -04:00
Cole Robinson
e0e3c212e4 virtinst: Remove manual selinux bits
Wasn't very useful to begin with, and modern day svirt correctly
handles things.
2013-04-11 12:15:37 -04:00
Cole Robinson
459cb3de5e util: Remove old default_bridge, rename default_bridge2 2013-04-11 12:15:37 -04:00
Cole Robinson
a07c81e92a util: Remove a bunch of unused methods
And move some to the only files they are used in.
2013-04-11 12:15:37 -04:00
Cole Robinson
b3779eec7d Remove old 'Xen' class name back compat 2013-04-11 12:15:37 -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
Martin Kletzander
212b77cc1f Fix logical volume tests
After commit 590c8dbebf, the tests got
broken due to the fact that the commit broke something that was
working.  I'm changing the error to warning and fixing the tests.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2013-04-10 10:02:13 -04:00
Martin Kletzander
590c8dbebf Don't support sparse logical volumes
Sparse logical volumes are supported by libvirt, but only in case the
user takes care of the reallocation, which is not what virt-install
and virt-manager users want.  This patch defaults the logical volumes
to non-sparse ones and makes sure allocation is always equal to
capacity for such volumes.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2013-04-03 20:44:29 -04:00
Tom Lanyon
ef2bdc4722 virt-install: don't fail on storage pools without targets.
(crobinso: Add Tom to AUTHORS)
2013-04-03 19:40:39 -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