# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2010 OpenStack LLC # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from xml.dom.minidom import parseString from nova import db from nova import flags from nova import test from nova.endpoint import cloud from nova.virt import libvirt_conn FLAGS = flags.FLAGS class LibvirtConnTestCase(test.TrialTestCase): def bitrot_test_get_uri_and_template(self): class MockDataModel(object): def __getitem__(self, name): return self.datamodel[name] def __init__(self): self.datamodel = { 'name' : 'i-cafebabe', 'memory_kb' : '1024000', 'basepath' : '/some/path', 'bridge_name' : 'br100', 'mac_address' : '02:12:34:46:56:67', 'vcpus' : 2, 'project_id' : None } type_uri_map = { 'qemu' : ('qemu:///system', [lambda s: '' in s, lambda s: 'type>hvm/usr/bin/kvm' not in s]), 'kvm' : ('qemu:///system', [lambda s: '' in s, lambda s: 'type>hvm/usr/bin/qemu<' not in s]), 'uml' : ('uml:///system', [lambda s: '' in s, lambda s: 'type>uml