Пример #1
0
 def __init__(self, opt_args):
     self.line = 'virt-trinity-pool.xml'
     self.path = self.line
     self.number = random.randint(1, 9)
     name = 'virt-trinity-pool-%s' % self.number
     self.content = utils_random.xml('storagepool', name=name)
     opt_args['pool'] = name
Пример #2
0
    def __init__(self, opt_args):
        self.line = 'virt-trinity-vm.xml'
        self.path = self.line

        vm_name = 'virt-trinity-1'
        all_names = ['virt-trinity-' + str(i) for i in xrange(1, 10)]
        vm_names = [
            name for name in
            utils.run('virsh list --all --name').stdout.splitlines()
            if name.startswith('virt-trinity-')
        ]
        avail_names = list(set(all_names) - set(vm_names))
        if avail_names:
            vm_name = random.choice(avail_names)
            self.content = utils_random.xml('domain', name=vm_name)
            with open('latest.xml', 'w') as fp:
                fp.write(self.content)
        else:
            opt_args['skip'] = True