ia64/xen-unstable

changeset 1050:7f65f6292176

bitkeeper revision 1.689 (40118468UT1zIR80oFQpa0jMSoyUvA)

XenoUtil.py:
Fix XenoUtil.py to import only what is necessary.
author kaf24@scramble.cl.cam.ac.uk
date Fri Jan 23 20:30:32 2004 +0000 (2004-01-23)
parents e38f01055fc3
children 85909caca7ed
files tools/xc/py/XenoUtil.py
line diff
     1.1 --- a/tools/xc/py/XenoUtil.py	Fri Jan 23 19:40:15 2004 +0000
     1.2 +++ b/tools/xc/py/XenoUtil.py	Fri Jan 23 20:30:32 2004 +0000
     1.3 @@ -1,4 +1,4 @@
     1.4 -import string, re, os, sqlite, Xc, sys
     1.5 +import string, re, os, sys
     1.6  
     1.7  ##### Module variables
     1.8  
     1.9 @@ -16,6 +16,16 @@ VD_DB_FILE = "/var/spool/xen_vdisks.sqli
    1.10  """
    1.11  VBD_EXPERT_MODE = 0
    1.12  
    1.13 +##### Module initialisation
    1.14 +
    1.15 +try:
    1.16 +    # try to import sqlite (not everyone will have it installed)
    1.17 +    import sqlite
    1.18 +except ImportError:
    1.19 +    # on failure, just catch the error, don't do anything
    1.20 +    pass
    1.21 +
    1.22 +
    1.23  ##### Networking-related functions
    1.24  
    1.25  def get_current_ipaddr(dev='eth0'):
    1.26 @@ -808,6 +818,8 @@ def vd_extents_validate(new_extents,new_
    1.27                     exceed VBD_EXPERT_MODE or -1 if it does (error)
    1.28      """
    1.29  
    1.30 +    import Xc # this is only needed in this function
    1.31 +
    1.32      xc = Xc.new()
    1.33  
    1.34      ##### Probe for explicitly created virtual disks and build a list