def add_image(self, image, pool, cmd=None):
shortimage = os.path.basename(image).split('?')[0]
if pool is not None:
pool = [p['path'] for p in self._pool_info() if p['name'] == pool]
if pool:
poolpath = pool[0]
else:
print("Pool not found. Leaving....")
return
downloadcmd = 'curl -Lo %s -f %s/%s' % (shortimage, poolpath, image)
os.system(downloadcmd)
if cmd is not None and find_executable('virt-customize') is not None:
cmd = "virt-customize -a %s/%s %s" % (poolpath, image, cmd)
os.system(cmd)
return {'result': 'success'}
评论列表
文章目录