
On Aug 18 10:38AM, 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 think your solution is correct. Go for it. When you create a netboot VM, Kimchi adds a disk to be the VM's disk and nothing more (no 'cdrom' devices). So, basically you still have a disk to check if it exists.
--
Ramon Nunes Medeiros Kimchi Developer Linux Technology Center Brazil IBM Systems & Technology Group Phone : +55 19 2132 7878 ramonn@br.ibm.com
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
-- Paulo Ricardo Paz Vital Linux Technology Center, IBM Systems http://www.ibm.com/linux/ltc/