<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hey Ramon,<br>
<br>
I know this is not the case at this moment but we're going to
support disks that<br>
aren't attached to any storage pool. It's better to make this new
function consider<br>
this scenario too.<br>
<br>
<div class="moz-cite-prefix">On 08/18/2016 10:38 AM, Ramon Medeiros
wrote:<br>
</div>
<blockquote cite="mid:57B5BA69.9050806@linux.vnet.ibm.com"
type="cite">
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
vmtemplate.py has a function that checks template integrity
(validate_integrity), that check template and if found some
parameters invalid, warn the user.<br>
<br>
Today, the function is not verifying disks. I'll do it. Just want
to make sure i'm checking all kind:<br>
<br>
Here is the function:<br>
<br>
<small><small> def validate_integrity(self):<br>
invalid = {}<br>
# validate networks integrity<br>
invalid_networks = list(set(self.info['networks']) -<br>
set(self._get_all_networks_name()))<br>
if invalid_networks:<br>
invalid['networks'] = invalid_networks<br>
<br>
# validate storagepools and integrity<br>
for disk in self.info['disks']:<br>
pool_uri = disk['pool']['name']<br>
pool_name = pool_name_from_uri(pool_uri)<br>
if pool_name not in
self._get_active_storagepools_name():<br>
invalid['storagepools'] = [pool_name]<br>
<br>
if os.path.exists(disk["base"])<br>
<br>
# validate iso integrity<br>
# FIXME when we support multiples cdrom devices<br>
iso = self.info.get('cdrom')<br>
if iso:<br>
if os.path.exists(iso):<br>
st_mode = os.stat(iso).st_mode<br>
if not (stat.S_ISREG(st_mode) or
stat.S_ISBLK(st_mode)):<br>
invalid['cdrom'] = [iso]<br>
elif not check_url_path(iso):<br>
invalid['cdrom'] = [iso]<br>
<br>
self.info['invalid'] = invalid<br>
<br>
return self.info</small></small><br>
<br>
I just need to get the loop "<small><small># validate storagepools
and integrity<big><big>" and add a checking:<br>
# validate storagepools and integrity<br>
for disk in self.info['disks']:<br>
pool_uri = disk['pool']['name']<br>
pool_name = pool_name_from_uri(pool_uri)<br>
if pool_name not in
self._get_active_storagepools_name():<br>
invalid['storagepools'] = [pool_name]<br>
+<br>
+ if not os.path.exists(disk.get("base")):<br>
+ invalid["disks"] = disk</big></big><br>
<big><big>+ <br>
<br>
I guess this way i can validate disks on dir storagepools,
and nfs. But, what about netboot and other kind?<br>
</big></big></small></small></blockquote>
<br>
I don't think it's worth the effort trying to validate netboot in
the template level. Network<br>
connectivity can change more often than disks and storage pools.
Checking netboot status<br>
in the template will not guarantee that it will be available when
the VM is created. <br>
<br>
<blockquote cite="mid:57B5BA69.9050806@linux.vnet.ibm.com"
type="cite"><small><small><big><big> </big></big><br>
<br>
</small></small>
<pre class="moz-signature" cols="72">--
Ramon Nunes Medeiros
Kimchi Developer
Linux Technology Center Brazil
IBM Systems & Technology Group
Phone : +55 19 2132 7878
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:ramonn@br.ibm.com">ramonn@br.ibm.com</a> </pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Kimchi-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Kimchi-devel@ovirt.org">Kimchi-devel@ovirt.org</a>
<a class="moz-txt-link-freetext" href="http://lists.ovirt.org/mailman/listinfo/kimchi-devel">http://lists.ovirt.org/mailman/listinfo/kimchi-devel</a>
</pre>
</blockquote>
<br>
</body>
</html>