Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Commit cb5822e

Browse files
committed
merge heads
2 parents 4b2907b + 6fd446b commit cb5822e

6 files changed

Lines changed: 32 additions & 47 deletions

File tree

virt-clone

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,6 @@ def get_clone_diskfile(new_diskfiles, design, conn):
9494
if not cli.prompt_for_yes_or_no(warnmsg + _("Do you really want to use the disk (yes or no)? ")):
9595
disk = None
9696
continue
97-
# Overwrite disk?
98-
elif os.path.exists(d.path) and os.path.isfile(d.path):
99-
warnmsg = _("You are going to overwrite file '%s'!\n") % d.path
100-
if not cli.prompt_for_yes_or_no(warnmsg + _("Do you really want to use the file (yes or no)? ")):
101-
disk = None
102-
continue
10397
new_diskfiles[i] = d.path
10498
break
10599

virt-install

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,6 @@ def get_disk(disk, size, sparse, guest, hvm, conn):
8585
if not cli.prompt_for_yes_or_no(warnmsg + _("Do you really want to use the disk (yes or no)? ")):
8686
disk = size = None
8787
continue
88-
# Overwrite disk?
89-
elif os.path.exists(d.path) and os.path.isfile(d.path):
90-
warnmsg = _("You are going to overwrite file '%s'!\n") % d.path
91-
if not cli.prompt_for_yes_or_no(warnmsg + _("Do you really want to use the file (yes or no)? ")):
92-
disk = None
93-
continue
9488

9589
guest.disks.append(d)
9690
break
@@ -265,7 +259,7 @@ def parse_args():
265259
help=_("The CPU architecture to simulate"))
266260

267261
# paravirt options
268-
parser.add_option("-p", "--paravirt", action="store_false", dest="paravirt",
262+
parser.add_option("-p", "--paravirt", action="store_true", dest="paravirt",
269263
help=_("This guest should be a paravirtualized guest"))
270264
parser.add_option("-l", "--location", type="string", dest="location",
271265
action="callback", callback=cli.check_before_store,
@@ -352,13 +346,13 @@ def main():
352346
print >> sys.stderr, _("Can't do both --hvm and --paravirt")
353347

354348
if options.fullvirt:
355-
osType = "hvm"
349+
os_type = "hvm"
356350
elif options.paravirt:
357-
osType = "xen"
351+
os_type = "xen"
358352
else:
359-
osType = None
353+
os_type = None
360354

361-
guest = capabilities.guestForOSType(type=osType, arch=options.arch)
355+
guest = capabilities.guestForOSType(type=os_type, arch=options.arch)
362356
if guest is None:
363357
print >> sys.stderr, _("Unsupported virtualization type")
364358
sys.exit(1)
@@ -375,11 +369,11 @@ def main():
375369
if not hvm:
376370
print >> sys.stderr, _("LiveCD installations are not supported for paravirt guests")
377371
sys.exit(1)
378-
installer = virtinst.LiveCDInstaller(type = type)
372+
installer = virtinst.LiveCDInstaller(type = type, os_type = os_type)
379373
elif options.pxe:
380-
installer = virtinst.PXEInstaller(type = type)
374+
installer = virtinst.PXEInstaller(type = type, os_type = os_type)
381375
else:
382-
installer = virtinst.DistroInstaller(type = type)
376+
installer = virtinst.DistroInstaller(type = type, os_type = os_type)
383377

384378
if (options.pxe and options.location) or (options.location and options.cdrom) or (options.cdrom and options.pxe):
385379
print >> sys.stderr, _("Only one of --pxe, --location and --cdrom can be used")

virtinst/DistroManager.py

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ def acquireBootDisk(baseuri, progresscb, scratchdir="/var/tmp", type=None, distr
118118
fetcher.cleanupLocation()
119119

120120
class 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

271263
class 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

virtinst/Guest.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,11 +407,12 @@ class XenSDLGraphics(SDLVirtualGraphics):
407407
pass
408408

409409
class Installer(object):
410-
def __init__(self, type = "xen", location = None, boot = None, extraargs = None):
410+
def __init__(self, type = "xen", location = None, boot = None, extraargs = None, os_type = None):
411411
self._location = None
412412
self._extraargs = None
413413
self._boot = None
414414
self._cdrom = False
415+
self._os_type = os_type
415416
self._install_disk = None # VirtualDisk that contains install media
416417

417418
if type is None:
@@ -443,6 +444,12 @@ def set_type(self, val):
443444
self._type = val
444445
type = property(get_type, set_type)
445446

447+
def get_os_type(self):
448+
return self._os_type
449+
def set_os_type(self, val):
450+
self._os_type = val
451+
os_type = property(get_os_type, set_os_type)
452+
446453
def get_scratchdir(self):
447454
if self.type == "xen":
448455
return "/var/lib/xen"

virtinst/LiveCDInstaller.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ def __init__(self, msg):
2929
Exception.__init__(self, msg)
3030

3131
class LiveCDInstaller(Guest.Installer):
32-
def __init__(self, type = "xen", location = None):
33-
Guest.Installer.__init__(self, type, location)
32+
def __init__(self, type = "xen", location = None, os_type = None):
33+
Guest.Installer.__init__(self, type, location, os_type = None)
3434

3535
def prepare(self, guest, meter, distro = None):
3636
self.cleanup()
@@ -59,7 +59,7 @@ def _get_osblob(self, install, hvm, arch = None, loader = None):
5959
return None
6060

6161
osblob = "<os>\n"
62-
osblob += " <type>hvm</type>\n"
62+
osblob += " <type>%s</type>\n" % self.os_type
6363
if loader:
6464
osblob += " <loader>%s</loader>\n" % loader
6565
osblob += " <boot dev='cdrom'/>\n"

virtinst/ParaVirtGuest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ def __init__(self, type=None, connection=None, hypervisorURI=None, installer=Non
3030
if not installer:
3131
installer = DistroManager.DistroInstaller(type = type)
3232
Guest.Guest.__init__(self, type, connection, hypervisorURI, installer)
33-
self.disknode = "xvd"
33+
if self.type == "xen":
34+
self.disknode = "xvd"
35+
else:
36+
self.disknode = "hd"
3437

3538
def _get_osblob(self, install):
3639
return self.installer._get_osblob(install, hvm = False)

0 commit comments

Comments
 (0)