コード例 #1
0
ファイル: volume_types.py プロジェクト: vishvananda/nova
def create(context, name, extra_specs={}):
    """Creates volume types."""
    try:
        db.volume_type_create(context, dict(name=name,
                                            extra_specs=extra_specs))
    except exception.DBError, e:
        LOG.exception(_('DB error: %s') % e)
        raise exception.VolumeTypeCreateFailed(name=name,
                                               extra_specs=extra_specs)
コード例 #2
0
ファイル: volume_types.py プロジェクト: baz-reddwarf/nova
def create(context, name, extra_specs={}):
    """Creates volume types."""
    try:
        db.volume_type_create(context,
                              dict(name=name,
                                   extra_specs=extra_specs))
    except exception.DBError, e:
        LOG.exception(_('DB error: %s') % e)
        raise exception.VolumeTypeCreateFailed(name=name,
                                               extra_specs=extra_specs)
コード例 #3
0
ファイル: volume_types.py プロジェクト: yamahata/nova
def create(context, name, extra_specs={}):
    """Creates volume types."""
    try:
        db.volume_type_create(context, dict(name=name,
                                            extra_specs=extra_specs))
    except exception.DBError, e:
        LOG.exception(_('DB error: %s') % e)
        raise exception.ApiError(
            _("Cannot create volume_type with "
              "name %(name)s and specs %(extra_specs)s") % locals())
コード例 #4
0
def create(context, name, extra_specs={}):
    """Creates volume types."""
    try:
        db.volume_type_create(context,
                              dict(name=name,
                                   extra_specs=extra_specs))
    except exception.DBError, e:
        LOG.exception(_('DB error: %s') % e)
        raise exception.ApiError(_("Cannot create volume_type with "
                                    "name %(name)s and specs %(extra_specs)s")
                                    % locals())
コード例 #5
0
    def setUp(self):
        super(VolumeTypeExtraSpecsTestCase, self).setUp()
        self.context = context.get_admin_context()
        self.vol_type1 = dict(name="TEST: Regular volume test")
        self.vol_type1_specs = dict(vol_extra1="value1",
                                    vol_extra2="value2",
                                    vol_extra3=3)
        self.vol_type1['extra_specs'] = self.vol_type1_specs
        ref = db.volume_type_create(self.context, self.vol_type1)
        self.volume_type1_id = ref.id
        for k, v in self.vol_type1_specs.iteritems():
            self.vol_type1_specs[k] = str(v)

        self.vol_type2_noextra = dict(name="TEST: Volume type without extra")
        ref = db.volume_type_create(self.context, self.vol_type2_noextra)
        self.vol_type2_id = ref.id
コード例 #6
0
    def setUp(self):
        super(VolumeTypeExtraSpecsTestCase, self).setUp()
        self.context = context.get_admin_context()
        self.vol_type1 = dict(name="TEST: Regular volume test")
        self.vol_type1_specs = dict(vol_extra1="value1",
                                  vol_extra2="value2",
                                  vol_extra3=3)
        self.vol_type1['extra_specs'] = self.vol_type1_specs
        ref = db.volume_type_create(self.context, self.vol_type1)
        self.volume_type1_id = ref.id
        for k, v in self.vol_type1_specs.iteritems():
            self.vol_type1_specs[k] = str(v)

        self.vol_type2_noextra = dict(name="TEST: Volume type without extra")
        ref = db.volume_type_create(self.context, self.vol_type2_noextra)
        self.vol_type2_id = ref.id