Lease creation should fail if ‘amount’ and/or ‘min’ parameters are passed with value as 0

Bug #1807101 reported by Niraj Singh
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Blazar
Fix Released
Undecided
Asmita Singh

Bug Description

Description
===========

Lease for resource_type virtual:instance should not be created with amount=0.

Steps to reproduce
==================

Create lease for instance reservation with amount=0.

Command:

blazar lease-create --reservation resource_type=virtual:instance,vcpus=1,memory_mb=1024,disk_gb=20,amount=0,affinity=False --start-date "2020-07-24 20:00" --end-date "2020-08-09 21:00" lease-1

Expected result
===============

Lease create for instance reservation should fail with 400 BadRequest.

Actual Result
=============

Lease create for instance reservation with amount=0 created successfully.

Niraj Singh (nirajsingh)
description: updated
Changed in blazar:
assignee: nobody → Asmita Singh (asmita2018)
Changed in blazar:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to blazar (master)

Fix proposed to branch: master
Review: https://review.openstack.org/630026

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to blazar (master)

Reviewed: https://review.opendev.org/630026
Committed: https://git.openstack.org/cgit/openstack/blazar/commit/?id=fa6bb0b5b2976906214b7f7f4f4aa5cb24234736
Submitter: Zuul
Branch: master

commit fa6bb0b5b2976906214b7f7f4f4aa5cb24234736
Author: asmita singh <email address hidden>
Date: Fri Dec 21 14:00:18 2018 +0000

    Lease creation/update should fail if amount is 0

    Lease is getting created and updated for resource_type virtual:instance
    with amount=0.
    This patch doesn't allow creation and update of lease with amount=0, it
    will raise 400 BadRequest.

    Lease creation for resource_type physical:host with min=0 or max=0
    raises 500 Internal Server Error and lease is updated for resource_type
    physical:host with min=0 or max=0.
    This patch doesn't allow creation and update of lease with min=0 or
    max=0, it will raise 400 BadRequest.

    APIImpact:
    1)Return 400 instead of 201 when lease is created with amount=0 for
    resource_type 'virtual:instance'.
    2)Return 400 instead of 500 when lease is created with min=0 or max=0
    for resource_type 'physical:host'.
    3)Return 400 instead of 200 when lease is updated with amount=0 for
    resource_type 'virtual:instance'.
    4)Return 400 instead of 200 when lease is updated with min=0 or max=0
    for resource_type 'physical:host'.

    Closes-Bug: #1807101

    Change-Id: I70e35ac7a524afb04077da5978c7563dec120639

Changed in blazar:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/blazar 4.0.0.0rc1

This issue was fixed in the openstack/blazar 4.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.