<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-cite-prefix">On 09/16/2014 08:58 PM, Aline Manera
wrote:<br>
</div>
<blockquote cite="mid:5418CE96.6010106@linux.vnet.ibm.com"
type="cite">
<br>
On 09/04/2014 05:50 PM, Daniel Henrique Barboza wrote:
<br>
<blockquote type="cite">These changes implements the backend
support for setting the disk
<br>
image type in the VM template, by using a new parameter called
<br>
"type" in the 'disk' object of the template_create schema.
<br>
<br>
If the parameter is not used, the template will use the default
<br>
disk type (qcow2).
<br>
<br>
Signed-off-by: Daniel Henrique Barboza
<a class="moz-txt-link-rfc2396E" href="mailto:danielhb@linux.vnet.ibm.com"><danielhb@linux.vnet.ibm.com></a>
<br>
---
<br>
docs/API.md | 1 +
<br>
src/kimchi/API.json | 12 ++++++++++++
<br>
src/kimchi/i18n.py | 1 +
<br>
src/kimchi/vmtemplate.py | 5 ++++-
<br>
4 files changed, 18 insertions(+), 1 deletion(-)
<br>
<br>
diff --git a/docs/API.md b/docs/API.md
<br>
index 298441f..11dba67 100644
<br>
--- a/docs/API.md
<br>
+++ b/docs/API.md
<br>
@@ -195,6 +195,7 @@ Represents a snapshot of the Virtual
Machine's primary monitor.
<br>
* index: The device index
<br>
* size: The device size in GB
<br>
* base: Base image of this disk
<br>
+ * type: Type of the image (qcow2 or raw)
<br>
</blockquote>
<br>
From libvirt the supported formats are: "raw", "bochs", "qcow",
"qcow2", "qed", "vmdk"
<br>
Shouldn't we support all those too?
<br>
</blockquote>
From libvirt doc:<br>
<br>
<a class="moz-txt-link-freetext" href="http://libvirt.org/storage.html">http://libvirt.org/storage.html</a><br>
<br>
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
<span style="color: rgb(0, 0, 0); font-family: Verdana, Arial,
Helvetica, sans-serif; font-size: 13px; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing: normal;
line-height: normal; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;
display: inline !important; float: none; background-color:
rgb(255, 255, 255);">When listing existing volumes all these
formats are supported natively. When creating new volumes, only a
subset may be available. The<span class="Apple-converted-space"> </span></span><code
style="color: rgb(0, 0, 0); font-style: normal; font-variant:
normal; font-weight: normal; letter-spacing: normal; line-height:
normal; orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255);">raw</code><span
style="color: rgb(0, 0, 0); font-family: Verdana, Arial,
Helvetica, sans-serif; font-size: 13px; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing: normal;
line-height: normal; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;
display: inline !important; float: none; background-color:
rgb(255, 255, 255);"><span class="Apple-converted-space"> </span>type
is guaranteed always available. The<span
class="Apple-converted-space"> </span></span><code style="color:
rgb(0, 0, 0); font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height: normal;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255);">qcow2</code><span
style="color: rgb(0, 0, 0); font-family: Verdana, Arial,
Helvetica, sans-serif; font-size: 13px; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing: normal;
line-height: normal; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;
display: inline !important; float: none; background-color:
rgb(255, 255, 255);"><span class="Apple-converted-space"> </span>type
can be created if either<span class="Apple-converted-space"> </span></span><code
style="color: rgb(0, 0, 0); font-style: normal; font-variant:
normal; font-weight: normal; letter-spacing: normal; line-height:
normal; orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255);">qemu-img</code><span
style="color: rgb(0, 0, 0); font-family: Verdana, Arial,
Helvetica, sans-serif; font-size: 13px; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing: normal;
line-height: normal; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;
display: inline !important; float: none; background-color:
rgb(255, 255, 255);"><span class="Apple-converted-space"> </span>or<span
class="Apple-converted-space"> </span></span><code style="color:
rgb(0, 0, 0); font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height: normal;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255);">qcow-create</code><span
style="color: rgb(0, 0, 0); font-family: Verdana, Arial,
Helvetica, sans-serif; font-size: 13px; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing: normal;
line-height: normal; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;
display: inline !important; float: none; background-color:
rgb(255, 255, 255);"><span class="Apple-converted-space"> </span>tools
are present. The others are dependent on support of the<span
class="Apple-converted-space"> </span></span><code style="color:
rgb(0, 0, 0); font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height: normal;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255);">qemu-img</code><span
style="color: rgb(0, 0, 0); font-family: Verdana, Arial,
Helvetica, sans-serif; font-size: 13px; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing: normal;
line-height: normal; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;
display: inline !important; float: none; background-color:
rgb(255, 255, 255);"><span class="Apple-converted-space"> </span>tool.<br>
<br>
</span>This is why I considered only raw and qcow2. The other types
are dependent on qemu-img tool, which<br>
can support different types according to distro and arch.<br>
<blockquote cite="mid:5418CE96.6010106@linux.vnet.ibm.com"
type="cite">
<br>
<blockquote type="cite">
<br>
* graphics *(optional)*: The graphics paramenters of this
template
<br>
* type: The type of graphics. It can be VNC or spice
or None.
<br>
diff --git a/src/kimchi/API.json b/src/kimchi/API.json
<br>
index 2e2f9b0..67ffaf7 100644
<br>
--- a/src/kimchi/API.json
<br>
+++ b/src/kimchi/API.json
<br>
@@ -419,6 +419,12 @@
<br>
"type": "string",
<br>
"pattern": "^/.+$",
<br>
"error": "KCHTMPL0023E"
<br>
+ },
<br>
+ "type": {
<br>
+ "description": "Type of the
image of the disk",
<br>
+ "type": "string",
<br>
+ "pattern": "^qcow2|raw$",
<br>
+ "error": "KCHTMPL0025E"
<br>
}
<br>
<br>
}
<br>
@@ -590,6 +596,12 @@
<br>
"type": "number",
<br>
"minimum": 1,
<br>
"error": "KCHTMPL0022E"
<br>
+ },
<br>
+ "type": {
<br>
+ "description": "Type of the
image of the disk",
<br>
+ "type": "string",
<br>
+ "pattern": "^qcow2|raw$",
<br>
+ "error": "KCHTMPL0025E"
<br>
}
<br>
}
<br>
},
<br>
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
<br>
index 1e8b47a..9c81ea0 100644
<br>
--- a/src/kimchi/i18n.py
<br>
+++ b/src/kimchi/i18n.py
<br>
@@ -130,6 +130,7 @@ messages = {
<br>
"KCHTMPL0022E": _("Disk size must be greater than 1GB."),
<br>
"KCHTMPL0023E": _("Template base image must be a valid
local image file"),
<br>
"KCHTMPL0024E": _("Cannot identify base image %(path)s
format"),
<br>
+ "KCHTMPL0025E": _("Invalid disk image type. Types
supported: 'qcow2', 'raw'"),
<br>
<br>
"KCHPOOL0001E": _("Storage pool %(name)s already exists"),
<br>
"KCHPOOL0002E": _("Storage pool %(name)s does not exist"),
<br>
diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
<br>
index c5bb7b3..9b8349d 100644
<br>
--- a/src/kimchi/vmtemplate.py
<br>
+++ b/src/kimchi/vmtemplate.py
<br>
@@ -195,7 +195,10 @@
drive=drive-%(bus)s0-1-0,id=%(bus)s0-1-0'/>
<br>
src = os.path.join(storage_path, volume)
<br>
dev = "%s%s" %
(self._bus_to_dev[self.info['disk_bus']],
<br>
string.lowercase[index])
<br>
</blockquote>
<br>
<blockquote type="cite">- fmt = 'raw' if
self._get_storage_type() in ['logical'] else 'qcow2'
<br>
+ if self._get_storage_type() in ['logical']:
<br>
+ fmt = 'raw'
<br>
+ else:
<br>
+ fmt = disk.get('type', 'qcow2')
<br>
</blockquote>
<br>
If user passes a different type of 'raw' to a logical volume we
should raise an error.
<br>
<br>
<blockquote type="cite"> params = {'src': src, 'dev':
dev, 'bus': self.info['disk_bus'],
<br>
'type': fmt}
<br>
ret += """
<br>
</blockquote>
<br>
</blockquote>
<br>
</body>
</html>