3030import support
3131from VirtualDevice import VirtualDevice
3232from VirtualDisk import VirtualDisk
33+ from Clock import Clock
3334
3435import osdict
3536from virtinst import _virtinst as _
@@ -109,9 +110,22 @@ def cpuset_str_to_tuple(conn, cpuset):
109110
110111 def __init__ (self , type = None , connection = None , hypervisorURI = None ,
111112 installer = None ):
113+
114+ # Set up the connection, since it is fundamental for other init
115+ self .conn = connection
116+ if self .conn == None :
117+ logging .debug ("No conn passed to Guest, opening URI '%s'" % \
118+ hypervisorURI )
119+ self .conn = libvirt .open (hypervisorURI )
120+
121+ if self .conn == None :
122+ raise RuntimeError , _ ("Unable to connect to hypervisor, aborting "
123+ "installation!" )
124+
112125 # We specifically ignore the 'type' parameter here, since
113126 # it has been replaced by installer.type, and child classes can
114127 # use it when creating a default installer.
128+ ignore = type
115129 self ._installer = installer
116130 self ._name = None
117131 self ._uuid = None
@@ -123,6 +137,7 @@ def __init__(self, type=None, connection=None, hypervisorURI=None,
123137 self ._consolechild = None
124138 self ._os_autodetect = False
125139 self ._autostart = False
140+ self ._clock = Clock (self .conn )
126141 self .features = None
127142
128143 self ._os_type = None
@@ -155,15 +170,6 @@ def __init__(self, type=None, connection=None, hypervisorURI=None,
155170 self ._default_console_assigned = None
156171 self ._default_input_assigned = None
157172
158- self .conn = connection
159- if self .conn == None :
160- logging .debug ("No conn passed to Guest, opening URI '%s'" % \
161- hypervisorURI )
162- self .conn = libvirt .open (hypervisorURI )
163- if self .conn == None :
164- raise RuntimeError , _ ("Unable to connect to hypervisor, aborting "
165- "installation!" )
166-
167173 self ._caps = CapabilitiesParser .parse (self .conn .getCapabilities ())
168174
169175
@@ -175,6 +181,10 @@ def set_installer(self, val):
175181 self ._installer = val
176182 installer = property (get_installer , set_installer )
177183
184+ def get_clock (self ):
185+ return self ._clock
186+ clock = property (get_clock )
187+
178188 # Domain name of the guest
179189 def get_name (self ):
180190 return self ._name
@@ -667,12 +677,14 @@ def _get_features_xml(self):
667677
668678 def _get_clock_xml (self ):
669679 """
670- Return <clock/> xml (currently only relevant for FV guests)
680+ Return <clock/> xml
671681 """
672- return ""
682+ return self . clock . get_xml_config ()
673683
674684 def _get_osblob (self , install ):
675- """Return os, features, and clock xml (Implemented in subclass)"""
685+ """
686+ Return os, features, and clock xml (Implemented in subclass)
687+ """
676688 xml = ""
677689
678690 osxml = self .installer .get_install_xml (self , install )
0 commit comments