[Kimchi-devel] [RFC] Invalid image path not marking template as "invalid" (kimchi-project/kimchi: Issue #933)

Daniel Henrique Barboza dhbarboza82 at gmail.com
Thu Aug 18 14:27:20 UTC 2016


Hey Ramon,

I know this is not the case at this moment but we're going to support 
disks that
aren't attached to any storage pool. It's better to make this new 
function consider
this scenario too.

On 08/18/2016 10:38 AM, Ramon Medeiros wrote:
> vmtemplate.py has a function that checks template integrity 
> (validate_integrity), that check template and if found some parameters 
> invalid, warn the user.
>
> Today, the function is not verifying disks. I'll do it. Just want to 
> make sure i'm checking all kind:
>
> Here is the function:
>
>     def validate_integrity(self):
>         invalid = {}
>         # validate networks integrity
>         invalid_networks = list(set(self.info['networks']) -
> set(self._get_all_networks_name()))
>         if invalid_networks:
>             invalid['networks'] = invalid_networks
>
>         # validate storagepools and integrity
>         for disk in self.info['disks']:
>             pool_uri = disk['pool']['name']
>             pool_name = pool_name_from_uri(pool_uri)
>             if pool_name not in self._get_active_storagepools_name():
>                 invalid['storagepools'] = [pool_name]
>
>             if os.path.exists(disk["base"])
>
>         # validate iso integrity
>         # FIXME when we support multiples cdrom devices
>         iso = self.info.get('cdrom')
>         if iso:
>             if os.path.exists(iso):
>                 st_mode = os.stat(iso).st_mode
>                 if not (stat.S_ISREG(st_mode) or stat.S_ISBLK(st_mode)):
>                     invalid['cdrom'] = [iso]
>             elif not check_url_path(iso):
>                 invalid['cdrom'] = [iso]
>
>         self.info['invalid'] = invalid
>
>         return self.info
>
> I just need to get the loop "# validate storagepools and integrity"  
> and add a checking:
>         # validate storagepools and integrity
>         for disk in self.info['disks']:
>             pool_uri = disk['pool']['name']
>             pool_name = pool_name_from_uri(pool_uri)
>             if pool_name not in self._get_active_storagepools_name():
>                 invalid['storagepools'] = [pool_name]
> +
> +     if not os.path.exists(disk.get("base")):
> +         invalid["disks"] = disk
> +
>
> I guess this way i can validate disks on dir storagepools, and nfs. 
> But, what about netboot and other kind?

I don't think it's worth the effort trying to validate netboot in the 
template level. Network
connectivity can change more often than disks and storage pools. 
Checking netboot status
in the template will not guarantee that it will be available when the VM 
is created.

>
>
> -- 
>
> Ramon Nunes Medeiros
> Kimchi Developer
> Linux Technology Center Brazil
> IBM Systems & Technology Group
> Phone : +55 19 2132 7878
> ramonn at br.ibm.com  
>
>
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/kimchi-devel/attachments/20160818/cf5ce11c/attachment.html>


More information about the Kimchi-devel mailing list