[et-mgmt-tools] [PATCH 2/6] Add a few helper util functions
Daniel P. Berrange
berrange at redhat.com
Thu Aug 7 10:03:36 UTC 2008
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
> virtinst and virt-manager.
Good idea
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 :|
More information about the et-mgmt-tools
mailing list