Cole Robinson | 6 Aug 18:14
Favicon

[PATCH 0/6]: virt-install: support remote guest creation

The following series implements the needed pieces to allow
virt-install to provision VMs on remote connections. The
main pieces of this are:

- Teaching VirtualDisk about libvirt storage management
- Teaching relevant Installers to expect storage parameters
  for cdrom media
- Adding an interface to virt-install for users to specify
  storage managed.

This also has a requirement on the storage building api
I just posted.

More detail will be in each individual email.

Thanks,
Cole
Cole Robinson | 6 Aug 18:20
Favicon

[PATCH 1/6]: Move VirtualDisk to its own file

This patch is a simple move to prepare for the fun stuff.

VirtualDisk is removed out of Guest.py and put into its
own file VirtualDisk.py. All files that were relatively
importing VirtualDisk needed to be fixed up as well.

Thanks,
Cole

# HG changeset patch
# User "Cole Robinson <crobinso@...>"
# Date 1217985457 14400
# Node ID 7e161f48ad67ccdd023105a5489777adad5fe482
# Parent  6a207373b908ab521d33cd675c7c8d3854bdc1f1
Move VirtualDisk to its own file.

diff -r 6a207373b908 -r 7e161f48ad67 virtinst/CloneManager.py
--- a/virtinst/CloneManager.py	Tue Jul 29 11:21:07 2008 -0400
+++ b/virtinst/CloneManager.py	Tue Aug 05 21:17:37 2008 -0400
@@ -29,6 +29,7 @@
 import commands
 import libvirt
 import Guest
+from VirtualDisk import VirtualDisk
 from virtinst import _virtinst as _

 #
@@ -332,7 +333,7 @@
(Continue reading)

Daniel P. Berrange | 7 Aug 11:57
Favicon

Re: [PATCH 1/6]: Move VirtualDisk to its own file

On Wed, Aug 06, 2008 at 12:20:29PM -0400, Cole Robinson wrote:
> This patch is a simple move to prepare for the fun stuff.
> 
> VirtualDisk is removed out of Guest.py and put into its
> own file VirtualDisk.py. All files that were relatively
> importing VirtualDisk needed to be fixed up as well.

Simple no-op, move of code - ACK to commit.

Daniel
--

-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
Cole Robinson | 6 Aug 18:21
Favicon

[PATCH 2/6] Add a few helper util functions

This patch adds a few functions to virtinst.util:

1. is_storage_capable: receives an active connection
   and attempts to determine if it supports storage
   management. This is used in a few places to maintain
   existing behavior and error paths for connections
   to older libvirt versions.

2. is_remote: receives a uri and determines if it
   specifies a remote connection. Used for various
   validation checks.

3. get_xml_path: Receives an xml blob and an
   xPath, and returns that path from the xml. This
   is largely a convenience function since we have
   this code duplicated in about 10 places throughout
   virtinst and virt-manager.

Thanks,
Cole

# HG changeset patch
# User "Cole Robinson <crobinso@...>"
# Date 1217990239 14400
# Node ID 3fd6f72be4ee2a841ecf7ef8428284c5c365a6ea
# Parent  4fc92b37ef96adb71f3890343e7e3ca77c7bdce8
Add is_remote, is_storage_capable, and get_xml_path helpers to util.

(Continue reading)

Daniel P. Berrange | 7 Aug 12:03
Favicon

Re: [PATCH 2/6] Add a few helper util functions

On Wed, Aug 06, 2008 at 12:21:46PM -0400, Cole Robinson wrote:
> This patch adds a few functions to virtinst.util:
> 
> 1. is_storage_capable: receives an active connection
>    and attempts to determine if it supports storage
>    management. This is used in a few places to maintain
>    existing behavior and error paths for connections
>    to older libvirt versions.

Yes, useful code, since we can't be sure the libvirtd we're talking
remotely to has storage support.

> 2. is_remote: receives a uri and determines if it
>    specifies a remote connection. Used for various
>    validation checks.

Ok, this is basically the existing code from virt-manager's 
file src/virtManager/connection.py, so looks good. 

While you're doing this I'd suggest that we might as well add
the rest of the helpers there too - get_hostname, get_transport
and get_driver, possibly also making uri_split public. Perhaps
have them all in a virtinst.util.uri  module - or at least put
the 'uri' in their name, get  get_uri_hostname, is_uri_remote,
get_uri_transport, get_uri_driver.

> 3. get_xml_path: Receives an xml blob and an
>    xPath, and returns that path from the xml. This
>    is largely a convenience function since we have
>    this code duplicated in about 10 places throughout
(Continue reading)

Cole Robinson | 6 Aug 18:22
Favicon

[PATCH 3/6] Add VirtualDevice class

The patch below adds a VirtualDevice class. My goal is
to eventually have all device classes extend this, but
it is not a pressing need at the moment. This is added
in preparation for the VirtualDevice fixes coming next.

Thanks,
Cole

# HG changeset patch
# User "Cole Robinson <crobinso@...>"
# Date 1217985724 14400
# Node ID c98567a840436ff1ef8e81de130510e09606c2a6
# Parent  cb14cc14d8ebc7e80e592d61cae823a5ef8e4cc5
Add VirtualDevice class, eventually should be used as parent class for all domain device xml classes.

diff -r cb14cc14d8eb -r c98567a84043 virtinst/VirtualDevice.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/virtinst/VirtualDevice.py	Tue Aug 05 21:22:04 2008 -0400
@@ -0,0 +1,78 @@
+#
+# Base class for all VM devices
+#
+# Copyright 2008  Red Hat, Inc.
+# Cole Robinson <crobinso@...>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free  Software Foundation; either version 2 of the License, or
(Continue reading)

Daniel P. Berrange | 7 Aug 12:16
Favicon

Re: [PATCH 3/6] Add VirtualDevice class

On Wed, Aug 06, 2008 at 12:22:37PM -0400, Cole Robinson wrote:
> The patch below adds a VirtualDevice class. My goal is
> to eventually have all device classes extend this, but
> it is not a pressing need at the moment. This is added
> in preparation for the VirtualDevice fixes coming next.

ACK

Daniel
--

-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
Cole Robinson | 6 Aug 18:24
Favicon

[PATCH 4/6] Make VirtualDisk libvirt storage aware

The following patch fixes up VirtualDisk validation and
adds options for specifying libvirt managed storage.

The whole validation mechanism is fixed to allow setting
properties outside of object init time and still having
useful validation. A lot of documentation is added as well.

The main interface changes are as follows (ripped from the
code docs):

===========================

If creating a disk object from an existing local block
device or file, a path is all that should be required. If you want to
create a local file, a size also needs to be specified.

The remote case is a bit more complex. The options are:
    1. A libvirt virStorageVol instance (passed as 'volObject') for an
       existing storage volume.
    2. A virtinst L{StorageVolume} instance for creating a volume (passed
       as 'volInstall').
    3. An active connection ('conn') and a path to a storage volume on
       that connection.
    4. An active connection and a tuple of the form ("poolname",
       "volumename") (passed as 'volName')

For the last two cases, the lookup will be performed, and 'vol_object'
will be set to the returned virStorageVol. All the above cases also
work on a local connection as well, the only difference being that
option 3 won't neccessarily error out if the volume isn't found.
(Continue reading)

Daniel P. Berrange | 7 Aug 12:20
Favicon

Re: [PATCH 4/6] Make VirtualDisk libvirt storage aware

On Wed, Aug 06, 2008 at 12:24:01PM -0400, Cole Robinson wrote:
> The following patch fixes up VirtualDisk validation and
> adds options for specifying libvirt managed storage.
> 
> The whole validation mechanism is fixed to allow setting
> properties outside of object init time and still having
> useful validation. A lot of documentation is added as well.
> 
> The main interface changes are as follows (ripped from the
> code docs):
> 
> ===========================
> 
> If creating a disk object from an existing local block
> device or file, a path is all that should be required. If you want to
> create a local file, a size also needs to be specified.
> 
> The remote case is a bit more complex. The options are:
>     1. A libvirt virStorageVol instance (passed as 'volObject') for an
>        existing storage volume.
>     2. A virtinst L{StorageVolume} instance for creating a volume (passed
>        as 'volInstall').
>     3. An active connection ('conn') and a path to a storage volume on
>        that connection.
>     4. An active connection and a tuple of the form ("poolname",
>        "volumename") (passed as 'volName')
> 
> For the last two cases, the lookup will be performed, and 'vol_object'
> will be set to the returned virStorageVol. All the above cases also
> work on a local connection as well, the only difference being that
(Continue reading)

Cole Robinson | 6 Aug 18:25
Favicon

[PATCH 5/6] Pass storage parameters to installer classes

The following patch updates the relevant installer classes
to deal with storage parameters for cdrom media.

A 'conn' attribute is added to all installer classes so
we can provide proper storage lookup and validation. If
a remote conn is specified and a path (presumably to
cdrom media) is passed to 'location', we can attempt to
determine if the path is managed on the connection. So
passing a connection and a managed path on the remote
host should cause everything to just work.

The other change is that 'location' can now be a (poolname,
volname) tuple that it passes off to VirtualDisk's new
volName init parameter.

Thanks,
Cole

# HG changeset patch
# User "Cole Robinson <crobinso@...>"
# Date 1217990394 14400
# Node ID 01efca5886ba1ce923c75406b4d28dc26c79ebcc
# Parent  b665c19355e8bc1439b5be4ecf51284d78d600cc
Make installer location storage api aware.

Allow 'location' to be a (poolname, volname) tuple, Attempt to look up
volumes if location is a path and a connection has been passed.

(Continue reading)

Daniel P. Berrange | 7 Aug 12:21
Favicon

Re: [PATCH 5/6] Pass storage parameters to installer classes

On Wed, Aug 06, 2008 at 12:25:29PM -0400, Cole Robinson wrote:
> The following patch updates the relevant installer classes
> to deal with storage parameters for cdrom media.
> 
> A 'conn' attribute is added to all installer classes so
> we can provide proper storage lookup and validation. If
> a remote conn is specified and a path (presumably to
> cdrom media) is passed to 'location', we can attempt to
> determine if the path is managed on the connection. So
> passing a connection and a managed path on the remote
> host should cause everything to just work.

ACK

Daniel
--

-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
Cole Robinson | 6 Aug 18:26
Favicon

[PATCH 6/6] update virt-install options for specifying managed storage

The attached patch updates virt-install to allow specifying
libvirt managed storage.

--file can specified managed storage using:

- An absolute path to a managed volume
- A volume passed as --file volume:poolname:volname
- A pool to create storage on, using --file pool:poolname

--cdrom can use the first of the above two options (doesn't
make sense to create install media).

There is an obvious problem with this approach though:
Specifying pool:foo or volume:foo:bar could collide
with existing file names, and volume:foo:bar would
fail if the specified pool had a colon in it. This
was mostly my quick solution so I could test it all
out, i'm open to suggestions how to change it. Once an
interface is decided on I'll update the docs.

This is built on the patch to remove prompting from
virt-install, fyi.

Thanks,
Cole

# HG changeset patch
# User "Cole Robinson <crobinso@...>"
(Continue reading)

Daniel P. Berrange | 7 Aug 12:31
Favicon

Re: [PATCH 6/6] update virt-install options for specifying managed storage

On Wed, Aug 06, 2008 at 12:26:48PM -0400, Cole Robinson wrote:
> The attached patch updates virt-install to allow specifying
> libvirt managed storage.
> 
> --file can specified managed storage using:
> 
> - An absolute path to a managed volume
> - A volume passed as --file volume:poolname:volname
> - A pool to create storage on, using --file pool:poolname
> 
> --cdrom can use the first of the above two options (doesn't
> make sense to create install media).
> 
> There is an obvious problem with this approach though:
> Specifying pool:foo or volume:foo:bar could collide
> with existing file names, and volume:foo:bar would
> fail if the specified pool had a colon in it. This
> was mostly my quick solution so I could test it all
> out, i'm open to suggestions how to change it. Once an
> interface is decided on I'll update the docs.

The other option would be to leave --file & --cdrom as they
already are, and instead use a more sensibly named  option
like --disk. People are often confused thinging that can't
pass a block device to --file already.  

The --cdrom arg also allows specifying a URI, in which case it
downloads the ISO image from the install tree for booting. 

So  I'd suggest using URI syntax
(Continue reading)

Cole Robinson | 12 Aug 16:41
Favicon

Re: [PATCH 6/6] update virt-install options for specifying managed storage

Daniel P. Berrange wrote:
> On Wed, Aug 06, 2008 at 12:26:48PM -0400, Cole Robinson wrote:
>> The attached patch updates virt-install to allow specifying
>> libvirt managed storage.
>>
>> --file can specified managed storage using:
>>
>> - An absolute path to a managed volume
>> - A volume passed as --file volume:poolname:volname
>> - A pool to create storage on, using --file pool:poolname
>>
>> --cdrom can use the first of the above two options (doesn't
>> make sense to create install media).
>>
>> There is an obvious problem with this approach though:
>> Specifying pool:foo or volume:foo:bar could collide
>> with existing file names, and volume:foo:bar would
>> fail if the specified pool had a colon in it. This
>> was mostly my quick solution so I could test it all
>> out, i'm open to suggestions how to change it. Once an
>> interface is decided on I'll update the docs.
> 
> The other option would be to leave --file & --cdrom as they
> already are, and instead use a more sensibly named  option
> like --disk. People are often confused thinging that can't
> pass a block device to --file already.  
> 
> 
> The --cdrom arg also allows specifying a URI, in which case it
> downloads the ISO image from the install tree for booting. 
(Continue reading)

Cole Robinson | 7 Aug 23:14
Favicon

Re: [PATCH 0/6]: virt-install: support remote guest creation

Cole Robinson wrote:
> The following series implements the needed pieces to allow
> virt-install to provision VMs on remote connections. The
> main pieces of this are:
> 
> - Teaching VirtualDisk about libvirt storage management
> - Teaching relevant Installers to expect storage parameters
>   for cdrom media
> - Adding an interface to virt-install for users to specify
>   storage managed.
> 
> This also has a requirement on the storage building api
> I just posted.
> 
> More detail will be in each individual email.
> 
> Thanks,
> Cole
> 

I've committed the first 5 patches in this series. Patch
2 was augmented with the other uri functions that Dan
recommended.

Thanks,
Cole

Gmane