Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 702554 Details for
Bug 915520
Oz: Package update - Add qcow2 support
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Backport/cherry pick of upstream patch
0004-Add-qcow2-support.patch (text/plain), 8.16 KB, created by
Ian McLeod
on 2013-02-25 23:40:56 UTC
(
hide
)
Description:
Backport/cherry pick of upstream patch
Filename:
MIME Type:
Creator:
Ian McLeod
Created:
2013-02-25 23:40:56 UTC
Size:
8.16 KB
patch
obsolete
>diff --git a/man/oz-cleanup-cache.1 b/man/oz-cleanup-cache.1 >index 8b132c6..6cf95f2 100644 >--- a/man/oz-cleanup-cache.1 >+++ b/man/oz-cleanup-cache.1 >@@ -81,7 +81,9 @@ installation. The \fBtype\fR key defines what type of virtualization > to use. The \fBbridge_name\fR key defines which bridge Oz should > place the guests that it launches on. The \fBcpus\fR key defines how > many cpus should be used inside the virtual machine. The \fBmemory\fR >-key defines how much memory should be used inside the virtual machine. >+key defines how much memory (in megabytes) should be used inside the >+virtual machine. The \fBimage_type\fR key defines which output disk >+type should be used. > > The \fBcache\fR section allows some manipulation of how Oz caches > data. The caching of data in Oz is a tradeoff between installation >diff --git a/man/oz-customize.1 b/man/oz-customize.1 >index 6a78c9a..3971419 100644 >--- a/man/oz-customize.1 >+++ b/man/oz-customize.1 >@@ -83,7 +83,9 @@ installation. The \fBtype\fR key defines what type of virtualization > to use. The \fBbridge_name\fR key defines which bridge Oz should > place the guests that it launches on. The \fBcpus\fR key defines how > many cpus should be used inside the virtual machine. The \fBmemory\fR >-key defines how much memory should be used inside the virtual machine. >+key defines how much memory (in megabytes) should be used inside the >+virtual machine. The \fBimage_type\fR key defines which output disk >+type should be used. > > The \fBcache\fR section allows some manipulation of how Oz caches > data. The caching of data in Oz is a tradeoff between installation >diff --git a/man/oz-generate-icicle.1 b/man/oz-generate-icicle.1 >index 3c3fd41..c1dc925 100644 >--- a/man/oz-generate-icicle.1 >+++ b/man/oz-generate-icicle.1 >@@ -87,7 +87,9 @@ installation. The \fBtype\fR key defines what type of virtualization > to use. The \fBbridge_name\fR key defines which bridge Oz should > place the guests that it launches on. The \fBcpus\fR key defines how > many cpus should be used inside the virtual machine. The \fBmemory\fR >-key defines how much memory should be used inside the virtual machine. >+key defines how much memory (in megabytes) should be used inside the >+virtual machine. The \fBimage_type\fR key defines which output disk >+type should be used. > > The \fBcache\fR section allows some manipulation of how Oz caches > data. The caching of data in Oz is a tradeoff between installation >diff --git a/man/oz-install.1 b/man/oz-install.1 >index 1eee88d..69c584a 100644 >--- a/man/oz-install.1 >+++ b/man/oz-install.1 >@@ -138,7 +138,9 @@ installation. The \fBtype\fR key defines what type of virtualization > to use. The \fBbridge_name\fR key defines which bridge Oz should > place the guests that it launches on. The \fBcpus\fR key defines how > many cpus should be used inside the virtual machine. The \fBmemory\fR >-key defines how much memory should be used inside the virtual machine. >+key defines how much memory (in megabytes) should be used inside the >+virtual machine. The \fBimage_type\fR key defines which output disk >+type should be used. > > The \fBcache\fR section allows some manipulation of how Oz caches > data. The caching of data in Oz is a tradeoff between installation >diff --git a/oz.cfg b/oz.cfg >index ee5ad2f..8bd7c27 100644 >--- a/oz.cfg >+++ b/oz.cfg >@@ -5,6 +5,7 @@ screenshot_dir = . > > [libvirt] > uri = qemu:///system >+image_type = raw > # type = kvm > # bridge_name = virbr0 > # cpus = 1 >diff --git a/oz/Guest.py b/oz/Guest.py >index 0b20c39..5469594 100644 >--- a/oz/Guest.py >+++ b/oz/Guest.py >@@ -39,7 +39,6 @@ import tempfile > import urlparse > import M2Crypto > import base64 >-import parted > import hashlib > import errno > import re >@@ -163,6 +162,9 @@ class Guest(object): > # libvirt expects kilobytes, so multiply by 1024 > self.install_memory = oz.ozutil.config_get_key(config, 'libvirt', > 'memory', 1024) * 1024 >+ self.image_type = oz.ozutil.config_get_key(config, 'libvirt', 'image_type', 'raw') >+ if self.image_type != 'raw' and self.image_type != 'qcow2': >+ raise oz.OzException.OzException("Invalid image_type; must be 'raw' or 'qcow2'") > > # configuration from 'cache' section > self.cache_original_media = oz.ozutil.config_get_boolean_key(config, >@@ -182,8 +184,13 @@ class Guest(object): > > self.diskimage = output_disk > if self.diskimage is None: >- self.diskimage = os.path.join(self.output_dir, >- self.tdl.name + ".dsk") >+ if self.image_type == 'qcow2': >+ self.diskimage = os.path.join(self.output_dir, >+ self.tdl.name + ".qcow2") >+ else: >+ self.diskimage = os.path.join(self.output_dir, >+ self.tdl.name + ".dsk") >+ > self.icicle_tmp = os.path.join(self.data_dir, "icicletmp", > self.tdl.name) > self.listen_port = random.randrange(1024, 65535) >@@ -430,6 +437,11 @@ class Guest(object): > bootTarget.setProp("bus", self.disk_bus) > bootSource = bootDisk.newChild(None, "source", None) > bootSource.setProp("file", self.diskimage) >+ if self.image_type == 'qcow2': >+ driver = bootDisk.newChild(None, "driver", None) >+ driver.setProp("name", "qemu") >+ driver.setProp("type", "qcow2") >+ > # install disk (if any) > if installdev: > install = devices.newChild(None, "disk", None) >@@ -458,25 +470,47 @@ class Guest(object): > self.log.info("Generating %dGB diskimage for %s" % (size, > self.tdl.name)) > >- f = open(self.diskimage, "w") >- f.truncate(size * 1024 * 1024 * 1024) >- f.close() >+ directory = os.path.dirname(self.diskimage) >+ filename = os.path.basename(self.diskimage) >+ >+ doc = libxml2.newDoc("1.0") >+ pool = doc.newChild(None, "pool", None) >+ pool.setProp("type", "dir") >+ pool.newChild(None, "name", "oztempdir") >+ target = pool.newChild(None, "target", None) >+ target.newChild(None, "path", directory) >+ pool_xml = doc.serialize(None, 1) > >+ doc = libxml2.newDoc("1.0") >+ vol = doc.newChild(None, "volume", None) >+ vol.setProp("type", "file") >+ vol.newChild(None, "name", filename) >+ vol.newChild(None, "allocation", "0") >+ cap = vol.newChild(None, "capacity", str(size)) >+ cap.setProp("unit", "G") >+ target = vol.newChild(None, "target", None) >+ fmt = target.newChild(None, "format", None) >+ fmt.setProp("type", self.image_type) > # FIXME: this makes the permissions insecure, but is needed since > # libvirt launches guests as qemu:qemu. >- os.chmod(self.diskimage, >- stat.S_IRUSR|stat.S_IWUSR|stat.S_IRGRP|stat.S_IWGRP|stat.S_IROTH|stat.S_IWOTH) >+ permissions = target.newChild(None, "permissions", None) >+ permissions.newChild(None, "mode", "0666") >+ vol_xml = doc.serialize(None, 1) >+ >+ pool = self.libvirt_conn.storagePoolCreateXML(pool_xml, 0) >+ try: >+ pool.createXML(vol_xml, 0) >+ finally: >+ pool.destroy() > > if create_partition: >- dev = parted.Device(self.diskimage) >- disk = parted.freshDisk(dev, 'msdos') >- constraint = parted.Constraint(device=dev) >- geom = parted.Geometry(device=dev, start=1, end=2) >- partition = parted.Partition(disk=disk, >- type=parted.PARTITION_NORMAL, >- geometry=geom) >- disk.addPartition(partition=partition, constraint=constraint) >- disk.commit() >+ g_handle = guestfs.GuestFS() >+ g_handle.add_drive_opts(self.diskimage, format=self.image_type, readonly = 0) >+ g_handle.launch() >+ devices = g_handle.list_devices() >+ g_handle.part_init(devices[0], "msdos") >+ g_handle.part_add(devices[0], 'p', 1, 2) >+ g_handle.close() > > def generate_diskimage(self, size=10, force=False): > """
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 915520
: 702554 |
702555
|
708780