Ejemplo n.º 1
0
 def handle(self, request, data):
     api.flavor_create(request, data['name'], int(data['memory_mb']),
                       int(data['vcpus']), int(data['disk_gb']),
                       int(data['flavorid']))
     msg = '%s was successfully added to flavors.' % data['name']
     LOG.info(msg)
     messages.success(request, msg)
     return redirect('syspanel_flavors')
Ejemplo n.º 2
0
 def handle(self, request, data):
     api.flavor_create(request,
                       data['name'],
                       int(data['memory_mb']),
                       int(data['vcpus']),
                       int(data['disk_gb']),
                       int(data['flavorid']))
     msg = '%s was successfully added to flavors.' % data['name']
     LOG.info(msg)
     messages.success(request, msg)
     return redirect('syspanel_flavors')
Ejemplo n.º 3
0
 def handle(self, request, data):
     api.flavor_create(
         request,
         data["name"],
         int(data["memory_mb"]),
         int(data["vcpus"]),
         int(data["disk_gb"]),
         int(data["flavorid"]),
     )
     msg = "%s was successfully added to flavors." % data["name"]
     LOG.info(msg)
     messages.success(request, msg)
     return redirect("syspanel_flavors")
Ejemplo n.º 4
0
    def test_flavor_create(self):
        FLAVOR_DISK = 1000
        FLAVOR_ID = 6
        FLAVOR_MEMORY = 1024
        FLAVOR_NAME = "newFlavor"
        FLAVOR_VCPU = 2

        admin_api = self.stub_admin_api()

        admin_api.flavors = self.mox.CreateMockAnything()
        admin_api.flavors.create(FLAVOR_NAME, FLAVOR_MEMORY, FLAVOR_VCPU, FLAVOR_DISK, FLAVOR_ID).AndReturn(TEST_RETURN)

        self.mox.ReplayAll()

        ret_val = api.flavor_create(
            self.request, FLAVOR_NAME, str(FLAVOR_MEMORY), str(FLAVOR_VCPU), str(FLAVOR_DISK), FLAVOR_ID
        )

        self.assertIsInstance(ret_val, api.Flavor)
        self.assertEqual(ret_val._apiresource, TEST_RETURN)

        self.mox.VerifyAll()