示例#1
0
    def test_deploy_vm(self):
        remote_repo = 'default-openvz-repo'
        template = templates.get_template_list(remote_repo)[0]

        self._addCleanup(templates.delete_template, self.testsp, 'openvz',
                         template)
        templates.sync_template(remote_repo,
                                template,
                                self.testsp,
                                silent=True)

        vmuuid = str(uuid4())
        vms = vm.list_vms('openvz:///system')
        self.assertTrue(vmuuid not in map(lambda v: v['uuid'], vms))

        self._addCleanup(vm.undeploy_vm, 'openvz:///system', vmuuid)

        self.typical_vm_params.update({
            'uuid': vmuuid,
            'template_name': template
        })

        vm.deploy_vm('openvz:///system', self.typical_vm_params)

        vms = vm.list_vms('openvz:///system')

        expected_path = '/storage/%s/openvz/unpacked/%s.ovf' % (self.testsp,
                                                                template)
        self.assertTrue(os.path.exists(expected_path), expected_path)
        self.assertTrue(vmuuid in map(lambda v: v['uuid'], vms),
                        "%s" % map(lambda v: v['uuid'], vms))
        nvm = filter(lambda v: v['uuid'] == vmuuid, vms)
        self.assertEqual(nvm[0]['vm_type'], 'openvz')
    def test_template_download(self):
        repos = templates.get_template_repos()
        repo_ids = map(lambda r: r[1], repos)
        remote_repo = 'default-openvz-repo'
        self.assertTrue(remote_repo in repo_ids)

        template_list = templates.get_template_list(remote_repo)
        template = template_list[0]

        local_templates = templates.get_local_templates('openvz', self.testsp)

        self.assertEqual(0, len(local_templates))

        self._addCleanup(templates.delete_template, self.testsp, 'openvz',
                         template)

        templates.sync_template(remote_repo,
                                template,
                                self.testsp,
                                silent=True)

        local_templates = templates.get_local_templates('openvz', self.testsp)
        self.assertTrue(len(local_templates) > 0)
        self.assertTrue(template in local_templates)

        expected_path = '/storage/%s/openvz/unpacked/%s.ovf' % (self.testsp,
                                                                template)
        self.assertTrue(os.path.exists(expected_path), expected_path)
示例#3
0
    def test_deploy_vm(self):
        remote_repo = 'default-openvz-repo'
        template = templates.get_template_list(remote_repo)[0]

        self._addCleanup(templates.delete_template, self.testsp, 'openvz', template)
        templates.sync_template(remote_repo, template, self.testsp, silent=True)

        vmuuid = str(uuid4())
        vms = vm.list_vms('openvz:///system')
        self.assertTrue(vmuuid not in map(lambda v: v['uuid'], vms))

        self._addCleanup(vm.undeploy_vm, 'openvz:///system', vmuuid)

        self.typical_vm_params.update({'uuid': vmuuid,
                                       'template_name': template})

        vm.deploy_vm('openvz:///system', self.typical_vm_params)

        vms = vm.list_vms('openvz:///system')

        expected_path = '/storage/%s/openvz/unpacked/%s.ovf' % (self.testsp, template)
        self.assertTrue(os.path.exists(expected_path), expected_path)
        self.assertTrue(vmuuid in map(lambda v: v['uuid'], vms),
                        "%s" % map(lambda v: v['uuid'], vms))
        nvm = filter(lambda v: v['uuid'] == vmuuid, vms)
        self.assertEqual(nvm[0]['vm_type'], 'openvz')
示例#4
0
    def test_template_download(self):
        repos = templates.get_template_repos()
        repo_ids = map(lambda r: r[1], repos)
        remote_repo = 'default-openvz-repo'
        self.assertTrue(remote_repo in repo_ids)

        template_list = templates.get_template_list(remote_repo)
        template = template_list[0]

        local_templates = templates.get_local_templates('openvz', self.testsp)

        self.assertEqual(0, len(local_templates))

        self._addCleanup(templates.delete_template, self.testsp, 'openvz', template)

        templates.sync_template(remote_repo, template, self.testsp, silent=True)

        local_templates = templates.get_local_templates('openvz', self.testsp)
        self.assertTrue(len(local_templates) > 0)
        self.assertTrue(template in local_templates)

        expected_path = '/storage/%s/openvz/unpacked/%s.ovf' % (self.testsp, template)
        self.assertTrue(os.path.exists(expected_path), expected_path)