~gandelman-a/ubuntu/precise/nova/UCA_2012.2.1

« back to all changes in this revision

Viewing changes to nova/compute/instance_types.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-05-24 13:12:53 UTC
  • mfrom: (1.1.55)
  • Revision ID: package-import@ubuntu.com-20120524131253-ommql08fg1en06ut
Tags: 2012.2~f1-0ubuntu1
* New upstream release.
* Prepare for quantal:
  - Dropped debian/patches/upstream/0006-Use-project_id-in-ec2.cloud._format_image.patch
  - Dropped debian/patches/upstream/0005-Populate-image-properties-with-project_id-again.patch
  - Dropped debian/patches/upstream/0004-Fixed-bug-962840-added-a-test-case.patch
  - Dropped debian/patches/upstream/0003-Allow-unprivileged-RADOS-users-to-access-rbd-volumes.patch
  - Dropped debian/patches/upstream/0002-Stop-libvirt-test-from-deleting-instances-dir.patch
  - Dropped debian/patches/upstream/0001-fix-bug-where-nova-ignores-glance-host-in-imageref.patch 
  - Dropped debian/patches/0001-fix-useexisting-deprecation-warnings.patch
* debian/control: Add python-keystone as a dependency. (LP: #907197)
* debian/patches/kombu_tests_timeout.patch: Refreshed.
* debian/nova.conf, debian/nova-common.postinst: Convert to new ini
  file configuration
* debian/patches/nova-manage_flagfile_location.patch: Refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
"""Built-in instance properties."""
22
22
 
 
23
import re
 
24
 
23
25
from nova import context
24
26
from nova import db
25
27
from nova import exception
29
31
FLAGS = flags.FLAGS
30
32
LOG = logging.getLogger(__name__)
31
33
 
 
34
INVALID_NAME_REGEX = re.compile("[^\w\.\- ]")
 
35
 
32
36
 
33
37
def create(name, memory, vcpus, root_gb, ephemeral_gb, flavorid, swap=None,
34
38
           rxtx_factor=None):
48
52
        'rxtx_factor': rxtx_factor,
49
53
    }
50
54
 
 
55
    # ensure name does not contain any special characters
 
56
    invalid_name = INVALID_NAME_REGEX.search(name)
 
57
    if invalid_name:
 
58
        msg = _("names can only contain [a-zA-Z0-9_.- ]")
 
59
        raise exception.InvalidInput(reason=msg)
 
60
 
51
61
    # ensure some attributes are integers and greater than or equal to 0
52
62
    for option in kwargs:
53
63
        try: