Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

server: allow listing custom offerings for a running VM #5420

Merged

Conversation

shwstppr
Copy link
Contributor

@shwstppr shwstppr commented Sep 8, 2021

Description

listServiceOffering API when called for a running VM only fails to list all possible offerings especially the custom offerings and all offerings when VM is deployed using a custom offering.
This PR improves the list behviour by adding adding appropriate conditions for the custom offerings.

Fixes #5412

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

Offerings and VMs

(local) 馃 > list serviceofferings filter=id,name,cpunumber,cpuspeed,memory,serviceofferingdetails
{
  "count": 6,
  "serviceoffering": [
    {
      "cpunumber": 1,
      "cpuspeed": 500,
      "id": "c17c21bb-faa4-4c14-9774-142260546670",
      "memory": 512,
      "name": "Small Instance"
    },
    {
      "cpunumber": 1,
      "cpuspeed": 1000,
      "id": "0a785dc5-ff8d-48ed-82b2-e24cbd9587b9",
      "memory": 1024,
      "name": "Medium Instance"
    },
    {
      "cpunumber": 1,
      "cpuspeed": 1000,
      "id": "3801bb99-4077-4685-919f-2ae51fce90a9",
      "memory": 1536,
      "name": "fixed"
    },
    {
      "cpuspeed": 1000,
      "id": "fe7de1af-b045-4749-a88f-c20a50082c7b",
      "name": "Constrained",
      "serviceofferingdetails": {
        "maxcpunumber": "4",
        "maxmemory": "2560",
        "mincpunumber": "1",
        "minmemory": "256"
      }
    },
    {
      "id": "3799cd94-8284-485e-81f0-bc3c1e6a29f9",
      "name": "Unconstrained"
    },
    {
      "cpuspeed": 1000,
      "id": "b1423e9e-9fcf-48c1-b156-b563cf9bf4dd",
      "name": "Constrained-1",
      "serviceofferingdetails": {
        "maxcpunumber": "4",
        "maxmemory": "3072",
        "mincpunumber": "2",
        "minmemory": "512"
      }
    }
  ]
}
(local) 馃 > list virtualmachines ids=112b9b4a-12e9-4cfc-8bd7-0e49eabb211f,00774881-64cf-45d1-8c9c-7bdaf7f195da filter=id,name,serviceofferingid,serviceofferingname,details,state
{
  "count": 2,
  "virtualmachine": [
    {
      "details": {
        "cpuNumber": "2",
        "memory": "1024"
      },
      "id": "00774881-64cf-45d1-8c9c-7bdaf7f195da",
      "name": "t5",
      "serviceofferingid": "fe7de1af-b045-4749-a88f-c20a50082c7b",
      "serviceofferingname": "Constrained",
      "state": "Running"
    },
    {
      "details": {},
      "id": "112b9b4a-12e9-4cfc-8bd7-0e49eabb211f",
      "name": "t3",
      "serviceofferingid": "c17c21bb-faa4-4c14-9774-142260546670",
      "serviceofferingname": "Small Instance",
      "state": "Running"
    }
  ]
}

Before change:

(local) 馃悾 > list serviceofferings filter=id,name,cpunumber,cpuspeed,memory,serviceofferingdetails virtualmachineid=112b9b4a-12e9-4cfc-8bd7-0e49eabb211f 
{
  "count": 2,
  "serviceoffering": [
    {
      "cpunumber": 1,
      "cpuspeed": 1000,
      "id": "0a785dc5-ff8d-48ed-82b2-e24cbd9587b9",
      "memory": 1024,
      "name": "Medium Instance"
    },
    {
      "cpunumber": 1,
      "cpuspeed": 1000,
      "id": "3801bb99-4077-4685-919f-2ae51fce90a9",
      "memory": 1536,
      "name": "fixed"
    }
  ]
}
(local) 馃悡 > list serviceofferings filter=id,name,cpunumber,cpuspeed,memory,serviceofferingdetails virtualmachineid=00774881-64cf-45d1-8c9c-7bdaf7f195da 

After change:

(local) 馃悤 > list serviceofferings filter=id,name,cpunumber,cpuspeed,memory,serviceofferingdetails virtualmachineid=112b9b4a-12e9-4cfc-8bd7-0e49eabb211f 
{
  "count": 5,
  "serviceoffering": [
    {
      "cpunumber": 1,
      "cpuspeed": 1000,
      "id": "0a785dc5-ff8d-48ed-82b2-e24cbd9587b9",
      "memory": 1024,
      "name": "Medium Instance"
    },
    {
      "cpunumber": 1,
      "cpuspeed": 1000,
      "id": "3801bb99-4077-4685-919f-2ae51fce90a9",
      "memory": 1536,
      "name": "fixed"
    },
    {
      "cpuspeed": 1000,
      "id": "fe7de1af-b045-4749-a88f-c20a50082c7b",
      "name": "Constrained",
      "serviceofferingdetails": {
        "maxcpunumber": "4",
        "maxmemory": "2560",
        "mincpunumber": "1",
        "minmemory": "256"
      }
    },
    {
      "id": "3799cd94-8284-485e-81f0-bc3c1e6a29f9",
      "name": "Unconstrained"
    },
    {
      "cpuspeed": 1000,
      "id": "b1423e9e-9fcf-48c1-b156-b563cf9bf4dd",
      "name": "Constrained-1",
      "serviceofferingdetails": {
        "maxcpunumber": "4",
        "maxmemory": "3072",
        "mincpunumber": "2",
        "minmemory": "512"
      }
    }
  ]
}
(local) 馃 > list serviceofferings filter=id,name,cpunumber,cpuspeed,memory,serviceofferingdetails virtualmachineid=00774881-64cf-45d1-8c9c-7bdaf7f195da 
{
  "count": 3,
  "serviceoffering": [
    {
      "cpuspeed": 1000,
      "id": "fe7de1af-b045-4749-a88f-c20a50082c7b",
      "name": "Constrained",
      "serviceofferingdetails": {
        "maxcpunumber": "4",
        "maxmemory": "2560",
        "mincpunumber": "1",
        "minmemory": "256"
      }
    },
    {
      "id": "3799cd94-8284-485e-81f0-bc3c1e6a29f9",
      "name": "Unconstrained"
    },
    {
      "cpuspeed": 1000,
      "id": "b1423e9e-9fcf-48c1-b156-b563cf9bf4dd",
      "name": "Constrained-1",
      "serviceofferingdetails": {
        "maxcpunumber": "4",
        "maxmemory": "3072",
        "mincpunumber": "2",
        "minmemory": "512"
      }
    }
  ]
}

listServiceOffering API when called for a running VM only fails to list all possible offerings especially the custom offerings and all offerings when VM is deployed using a custom offering.
This PR improves the list behviour by adding adding appropriate conditions for the custom offerings.

Fixes apache#5412

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@shwstppr
Copy link
Contributor Author

shwstppr commented Sep 8, 2021

@blueorangutan package

@blueorangutan
Copy link

@shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: 鉁旓笍 el7 鉁旓笍 el8 鉁旓笍 debian 鉁旓笍 suse15. SL-JID 1179

@shwstppr shwstppr closed this Sep 9, 2021
@shwstppr shwstppr reopened this Sep 9, 2021
@shwstppr
Copy link
Contributor Author

shwstppr commented Sep 9, 2021

@blueorangutan test

@blueorangutan
Copy link

@shwstppr a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan
Copy link

Trillian test result (tid-2004)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 35694 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5420-t2004-kvm-centos7.zip
Smoke tests completed. 89 look OK, 0 have errors
Only failed tests results shown below:

Test Result Time (s) Test File

Copy link
Member

@rohityadavcloud rohityadavcloud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - did not test the PR

Copy link
Contributor

@nvazquez nvazquez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm

@rohityadavcloud
Copy link
Member

ping @shwstppr - can you fix the conflict?

@shwstppr
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: 鉁旓笍 el7 鉁栵笍 el8 鉁旓笍 debian 鉁栵笍 suse15. SL-JID 1267

@nvazquez
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@nvazquez a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

}
vmMemory = NumbersUtil.parseInt(details.get(ApiConstants.MEMORY), 0);
}
if (vmCpu != null && vmCpu > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to have a single method to take cpu number, speed and memory and return a single sc instead ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if that would add any benefit as that single SearchCriteria will also be a combination of these three SearchCriterias with AND condition

@blueorangutan
Copy link

Packaging result: 鉁旓笍 el7 鉁旓笍 el8 鉁旓笍 debian 鉁旓笍 suse15. SL-JID 1278

@rohityadavcloud
Copy link
Member

@blueorangutan test centos7 vmware-67u3

@blueorangutan
Copy link

@rhtyd a Trillian-Jenkins test job (centos7 mgmt + vmware-67u3) has been kicked to run smoke tests

Co-authored-by: davidjumani <dj.davidjumani1994@gmail.com>
@shwstppr
Copy link
Contributor Author

@rhtyd will restart tests as had to make a change
@blueorangutan package

@blueorangutan
Copy link

@shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: 鉁旓笍 el7 鉁旓笍 el8 鉁旓笍 debian 鉁旓笍 suse15. SL-JID 1284

@shwstppr
Copy link
Contributor Author

@blueorangutan test centos7 vmware-67u3

@blueorangutan
Copy link

@shwstppr a Trillian-Jenkins test job (centos7 mgmt + vmware-67u3) has been kicked to run smoke tests

Copy link
Contributor

@davidjumani davidjumani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified, list all offering either unconstrained or constrained and GTE than the current value

@blueorangutan
Copy link

Trillian test result (tid-2084)
Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server 7
Total time taken: 41764 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5420-t2084-vmware-67u3.zip
Smoke tests completed. 89 look OK, 0 have errors
Only failed tests results shown below:

Test Result Time (s) Test File

@sureshanaparti
Copy link
Contributor

Merging based on approvals and test results

@sureshanaparti sureshanaparti merged commit 981dac7 into apache:main Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot select constrained or unconstrained offering on powered on VM
7 participants