コード例 #1
0
 def test_policy_limitation(self):
     obj = objects.VirtCPUFeature()
     self.assertRaises(ValueError, setattr, obj, 'policy', 'foo')
コード例 #2
0
#    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 nova.compute import arch
from nova.compute import cpumodel
from nova import objects
from nova.tests.unit.objects import test_objects

fake_cpu_model_feature = {
    'policy': cpumodel.POLICY_REQUIRE,
    'name': 'sse2',
}

fake_cpu_model_feature_obj = objects.VirtCPUFeature(**fake_cpu_model_feature)

fake_vcpumodel_dict = {
    'arch': arch.I686,
    'vendor': 'fake-vendor',
    'match': cpumodel.MATCH_EXACT,
    'topology': objects.VirtCPUTopology(sockets=1, cores=1, threads=1),
    'features': [fake_cpu_model_feature_obj],
    'mode': cpumodel.MODE_HOST_MODEL,
    'model': 'fake-model',
}
fake_vcpumodel = objects.VirtCPUModel(**fake_vcpumodel_dict)


class _TestVirtCPUFeatureObj(object):
    def test_policy_limitation(self):