~ubuntu-branches/ubuntu/saucy/python-novaclient/saucy

« back to all changes in this revision

Viewing changes to novaclient/v1_1/flavors.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-02-03 10:46:49 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20120203104649-3604yixrglbsoi0g
Tags: 2012.1~e4~20120203.484-0ubuntu1
New upstream release. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
        :rtype: :class:`Flavor`
40
40
        """
41
41
        return self._get("/flavors/%s" % base.getid(flavor), "flavor")
 
42
 
 
43
    def delete(self, flavor):
 
44
        """
 
45
        Delete a specific flavor.
 
46
 
 
47
        :param flavor: The ID of the :class:`Flavor` to get.
 
48
        :param purge: Whether to purge record from the database
 
49
        """
 
50
        self._delete("/flavors/%s" % base.getid(flavor))
 
51
 
 
52
    def create(self, name, ram, vcpus, disk, flavorid,
 
53
               swap=0, rxtx_factor=1):
 
54
        """
 
55
        Create (allocate) a  floating ip for a tenant
 
56
 
 
57
        :param name: Descriptive name of the flavor
 
58
        :param ram: Memory in MB for the flavor
 
59
        :param vcpu: Number of VCPUs for the flavor
 
60
        :param disk: Size of local disk in GB
 
61
        :param flavorid: Integer ID for the flavor
 
62
        :param swap: Swap space in MB
 
63
        :param rxtx_factor: RX/TX factor
 
64
        :rtype: :class:`Flavor`
 
65
        """
 
66
 
 
67
        body = {
 
68
            "flavor": {
 
69
                "name": name,
 
70
                "ram": int(ram),
 
71
                "vcpus": int(vcpus),
 
72
                "disk": int(disk),
 
73
                "id": int(flavorid),
 
74
                "swap": int(swap),
 
75
                "rxtx_factor": int(rxtx_factor),
 
76
            }
 
77
        }
 
78
 
 
79
        return self._create("/flavors", body, "flavor")