@@ -118,8 +118,8 @@ def acquireBootDisk(baseuri, progresscb, scratchdir="/var/tmp", type=None, distr
118118 fetcher .cleanupLocation ()
119119
120120class DistroInstaller (Guest .Installer ):
121- def __init__ (self , type = "xen" , location = None , boot = None , extraargs = None ):
122- Guest .Installer .__init__ (self , type , location , boot , extraargs )
121+ def __init__ (self , type = "xen" , location = None , boot = None , extraargs = None , os_type = None ):
122+ Guest .Installer .__init__ (self , type , location , boot , extraargs , os_type )
123123
124124 def get_location (self ):
125125 return self ._location
@@ -177,15 +177,12 @@ def _prepare_kernel_and_initrd(self, guest, distro, meter):
177177 if not self .extraargs is None :
178178 self .install ["extraargs" ] = self .extraargs
179179 else :
180- ostype = None
181- if self .type == "xen" :
182- ostype = "xen"
183180 # Need to fetch the kernel & initrd from a remote site, or
184181 # out of a loopback mounted disk image/device
185182 (kernelfn , initrdfn , args ) = acquireKernel (self .location ,
186183 meter ,
187184 scratchdir = self .scratchdir ,
188- type = ostype ,
185+ type = self . os_type ,
189186 distro = distro )
190187 self .install ["kernel" ] = kernelfn
191188 self .install ["initrd" ] = initrdfn
@@ -223,15 +220,10 @@ def _get_osblob(self, install, hvm, arch = None, loader = None):
223220 if install or hvm :
224221 osblob = "<os>\n "
225222
226- if hvm :
227- type = "hvm"
228- else :
229- type = "linux"
230-
231223 if arch :
232- osblob += " <type arch='%s'>%s</type>\n " % (arch , type )
224+ osblob += " <type arch='%s'>%s</type>\n " % (arch , self . os_type )
233225 else :
234- osblob += " <type>%s</type>\n " % type
226+ osblob += " <type>%s</type>\n " % self . os_type
235227
236228 if install and self .install ["kernel" ]:
237229 osblob += " <kernel>%s</kernel>\n " % util .xml_escape (self .install ["kernel" ])
@@ -269,8 +261,8 @@ def post_install_check(self, guest):
269261
270262
271263class PXEInstaller (Guest .Installer ):
272- def __init__ (self , type = "xen" , location = None , boot = None , extraargs = None ):
273- Guest .Installer .__init__ (self , type , location , boot , extraargs )
264+ def __init__ (self , type = "xen" , location = None , boot = None , extraargs = None , os_type = None ):
265+ Guest .Installer .__init__ (self , type , location , boot , extraargs , os_type )
274266
275267 def prepare (self , guest , meter , distro = None ):
276268 pass
@@ -280,15 +272,10 @@ def _get_osblob(self, install, hvm, arch = None, loader = None):
280272 if install or hvm :
281273 osblob = "<os>\n "
282274
283- if hvm :
284- type = "hvm"
285- else :
286- type = "linux"
287-
288275 if arch :
289- osblob += " <type arch='%s'>%s</type>\n " % (arch , type )
276+ osblob += " <type arch='%s'>%s</type>\n " % (arch , self . os_type )
290277 else :
291- osblob += " <type>%s</type>\n " % type
278+ osblob += " <type>%s</type>\n " % self . os_type
292279
293280 if loader :
294281 osblob += " <loader>%s</loader>\n " % loader
0 commit comments