Skip to content

server: fix scale vm with compute offering having same disk offering#6688

Merged
shwstppr merged 1 commit intoapache:4.17from
shapeblue:fix-scalevm-samediskoff
Sep 1, 2022
Merged

server: fix scale vm with compute offering having same disk offering#6688
shwstppr merged 1 commit intoapache:4.17from
shapeblue:fix-scalevm-samediskoff

Conversation

@shwstppr
Copy link
Copy Markdown
Contributor

@shwstppr shwstppr commented Aug 30, 2022

Fixes #6679

Fixes behaviour when the VM is scaled to a new compute offering which has the same disk offering associated as the earlier compute offering.

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?

Service offering and VM

(localcloud) 🐱 > list serviceofferings id=1892001d-1d4c-4467-937d-a35415bc1093 
{
  "count": 1,
  "serviceoffering": [
    {
      "cpunumber": 1,
      "cpuspeed": 1000,
      "created": "2022-08-31T10:35:00+0000",
      "defaultuse": false,
      "diskofferingdisplaytext": "Medium Disk, 20 GB",
      "diskofferingid": "0bae8790-1c97-43f6-b0d4-777023377ec8",
      "diskofferingname": "Medium",
      "diskofferingstrictness": false,
      "displaytext": "co1",
      "dynamicscalingenabled": true,
      "hasannotations": false,
      "id": "1892001d-1d4c-4467-937d-a35415bc1093",
      "iscustomized": false,
      "issystem": false,
      "isvolatile": false,
      "limitcpuuse": false,
      "memory": 512,
      "name": "co1",
      "offerha": false,
      "provisioningtype": "thin",
      "rootdisksize": 20,
      "storagetype": "shared"
    }
  ]
}
(localcloud) 🐱 > list serviceofferings id=125b186c-45cf-4a7c-9684-78378e7b327f 
{
  "count": 1,
  "serviceoffering": [
    {
      "cpunumber": 1,
      "cpuspeed": 1000,
      "created": "2022-08-31T10:35:13+0000",
      "defaultuse": false,
      "diskofferingdisplaytext": "Medium Disk, 20 GB",
      "diskofferingid": "0bae8790-1c97-43f6-b0d4-777023377ec8",
      "diskofferingname": "Medium",
      "diskofferingstrictness": false,
      "displaytext": "co2",
      "dynamicscalingenabled": true,
      "hasannotations": false,
      "id": "125b186c-45cf-4a7c-9684-78378e7b327f",
      "iscustomized": false,
      "issystem": false,
      "isvolatile": false,
      "limitcpuuse": false,
      "memory": 1024,
      "name": "co2",
      "offerha": false,
      "provisioningtype": "thin",
      "rootdisksize": 20,
      "storagetype": "shared"
    }
  ]
}
(localcloud) 🐱 > list virtualmachines id=e9bf1ab4-fe27-4c7e-837c-b296ab35e949 
{
  "count": 1,
  "virtualmachine": [
    {
      "account": "admin",
      "affinitygroup": [],
      "cpunumber": 1,
      "cpuspeed": 1000,
      "created": "2022-08-31T10:41:55+0000",
      "details": {
        "Message.ReservedCapacityFreed.Flag": "false",
        "cpuOvercommitRatio": "2.0",
        "dataDiskController": "osdefault",
        "memoryOvercommitRatio": "1.0",
        "rootDiskController": "osdefault",
        "rootdisksize": "20"
      },
      "diskofferingid": "0bae8790-1c97-43f6-b0d4-777023377ec8",
      "diskofferingname": "Medium",
      "displayname": "test-vm",
      "displayvm": true,
      "domain": "ROOT",
      "domainid": "65609c23-2826-11ed-bf3a-1e00750002ea",
      "guestosid": "6582ae97-2826-11ed-bf3a-1e00750002ea",
      "haenable": false,
      "hasannotations": false,
      "hypervisor": "VMware",
      "id": "e9bf1ab4-fe27-4c7e-837c-b296ab35e949",
      "instancename": "i-2-5-VM",
      "isdynamicallyscalable": false,
      "lastupdated": "2022-08-31T10:42:31+0000",
      "memory": 512,
      "name": "test-vm",
      "nic": [
        {
          "deviceid": "0",
          "extradhcpoption": [],
          "id": "fa90c6c8-12c1-4a5a-b86b-c23fdf9453af",
          "isdefault": true,
          "macaddress": "02:00:18:37:00:03",
          "networkid": "6a8f495b-ef15-488b-ac78-fd83e913b69b",
          "networkname": "l2",
          "secondaryip": [],
          "traffictype": "Guest",
          "type": "L2"
        }
      ],
      "osdisplayname": "Other Linux (64-bit)",
      "ostypeid": "6582ae97-2826-11ed-bf3a-1e00750002ea",
      "passwordenabled": false,
      "pooltype": "NetworkFilesystem",
      "receivedbytes": 0,
      "rootdeviceid": 0,
      "rootdevicetype": "ROOT",
      "securitygroup": [],
      "sentbytes": 0,
      "serviceofferingid": "1892001d-1d4c-4467-937d-a35415bc1093",
      "serviceofferingname": "co1",
      "state": "Stopped",
      "tags": [],
      "templatedisplaytext": "ma",
      "templateid": "feb21788-29be-4fb0-8618-ec0f50921838",
      "templatename": "ma",
      "userid": "85491d90-2826-11ed-bf3a-1e00750002ea",
      "username": "admin",
      "zoneid": "fce252b8-5075-4077-80c0-4f027fea354d",
      "zonename": "ref-trl-3557-v-M7-abhishek-kumar"
    }
  ]
}

Before fix

(localcloud) 🐱 > scale virtualmachine id=e9bf1ab4-fe27-4c7e-837c-b296ab35e949 serviceofferingid=125b186c-45cf-4a7c-9684-78378e7b327f 
{
  "accountid": "8547ecfc-2826-11ed-bf3a-1e00750002ea",
  "cmd": "org.apache.cloudstack.api.command.admin.vm.ScaleVMCmdByAdmin",
  "completed": "2022-08-31T10:44:51+0000",
  "created": "2022-08-31T10:44:51+0000",
  "jobid": "ad8860f6-33d3-43b0-957f-8feca3db5c99",
  "jobinstanceid": "e9bf1ab4-fe27-4c7e-837c-b296ab35e949",
  "jobinstancetype": "VirtualMachine",
  "jobprocstatus": 0,
  "jobresult": {
    "errorcode": 431,
    "errortext": "Volume 59896710-9353-4e39-9017-e0f422c7b5c1 already have the new disk offering 0bae8790-1c97-43f6-b0d4-777023377ec8 provided."
  },
  "jobresultcode": 530,
  "jobresulttype": "object",
  "jobstatus": 2,
  "userid": "85491d90-2826-11ed-bf3a-1e00750002ea"
}

After fix

(localcloud) 🐱 > scale virtualmachine id=e9bf1ab4-fe27-4c7e-837c-b296ab35e949 serviceofferingid=125b186c-45cf-4a7c-9684-78378e7b327f 
{
  "virtualmachine": {
    "account": "admin",
    "affinitygroup": [],
    "cpunumber": 1,
    "cpuspeed": 1000,
    "created": "2022-08-31T10:41:55+0000",
    "details": {
      "Message.ReservedCapacityFreed.Flag": "false",
      "cpuOvercommitRatio": "2.0",
      "dataDiskController": "osdefault",
      "memoryOvercommitRatio": "1.0",
      "rootDiskController": "osdefault",
      "rootdisksize": "20"
    },
    "diskofferingid": "0bae8790-1c97-43f6-b0d4-777023377ec8",
    "diskofferingname": "Medium",
    "displayname": "test-vm",
    "displayvm": true,
    "domain": "ROOT",
    "domainid": "65609c23-2826-11ed-bf3a-1e00750002ea",
    "guestosid": "6582ae97-2826-11ed-bf3a-1e00750002ea",
    "haenable": false,
    "hasannotations": false,
    "hypervisor": "VMware",
    "id": "e9bf1ab4-fe27-4c7e-837c-b296ab35e949",
    "instancename": "i-2-5-VM",
    "isdynamicallyscalable": false,
    "jobid": "3e5ecbf9-b806-45dd-b7d1-3c0d190eb64e",
    "jobstatus": 0,
    "lastupdated": "2022-08-31T10:42:31+0000",
    "memory": 1024,
    "name": "test-vm",
    "nic": [
      {
        "deviceid": "0",
        "extradhcpoption": [],
        "id": "fa90c6c8-12c1-4a5a-b86b-c23fdf9453af",
        "isdefault": true,
        "macaddress": "02:00:18:37:00:03",
        "networkid": "6a8f495b-ef15-488b-ac78-fd83e913b69b",
        "networkname": "l2",
        "secondaryip": [],
        "traffictype": "Guest",
        "type": "L2"
      }
    ],
    "osdisplayname": "Other Linux (64-bit)",
    "ostypeid": "6582ae97-2826-11ed-bf3a-1e00750002ea",
    "passwordenabled": false,
    "pooltype": "NetworkFilesystem",
    "receivedbytes": 0,
    "rootdeviceid": 0,
    "rootdevicetype": "ROOT",
    "securitygroup": [],
    "sentbytes": 0,
    "serviceofferingid": "125b186c-45cf-4a7c-9684-78378e7b327f",
    "serviceofferingname": "co2",
    "state": "Stopped",
    "tags": [],
    "templatedisplaytext": "ma",
    "templateid": "feb21788-29be-4fb0-8618-ec0f50921838",
    "templatename": "ma",
    "userid": "85491d90-2826-11ed-bf3a-1e00750002ea",
    "username": "admin",
    "zoneid": "fce252b8-5075-4077-80c0-4f027fea354d",
    "zonename": "ref-trl-3557-v-M7-abhishek-kumar"
  }
}

Fixes apache#6679

Fixes behaviour when the VM is scaled to a new compute offering which has same disk offering associated as the earlier compute offering.

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

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@shwstppr a Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@sonarqubecloud
Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 4087

@shwstppr
Copy link
Copy Markdown
Contributor Author

@blueorangutan test

@blueorangutan
Copy link
Copy Markdown

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

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 30, 2022

Codecov Report

Merging #6688 (d70c5f6) into 4.17 (7115e35) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

@@             Coverage Diff              @@
##               4.17    #6688      +/-   ##
============================================
- Coverage      5.86%    5.86%   -0.01%     
  Complexity     3920     3920              
============================================
  Files          2451     2451              
  Lines        242282   242288       +6     
  Branches      37911    37914       +3     
============================================
  Hits          14211    14211              
- Misses       226501   226507       +6     
  Partials       1570     1570              
Impacted Files Coverage Δ
.../src/main/java/com/cloud/vm/UserVmManagerImpl.java 0.00% <0.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Copy Markdown
Member

@yadvr yadvr left a comment

Choose a reason for hiding this comment

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

LGTM
@harikrishna-patnala to review/test/check

@shwstppr shwstppr added this to the 4.17.1.0 milestone Aug 30, 2022
@blueorangutan
Copy link
Copy Markdown

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

Test Result Time (s) Test File

Copy link
Copy Markdown
Contributor

@NuxRo NuxRo left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Copy Markdown
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

Copy link
Copy Markdown
Member

@harikrishna-patnala harikrishna-patnala left a comment

Choose a reason for hiding this comment

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

LGTM.

Tested between compute offerings linked to non-custom disk offerings and also between custom disk offerings. Worked as expected, scale VM offering is successful when there is no change in disk offering.

@shwstppr shwstppr merged commit c290cbc into apache:4.17 Sep 1, 2022
neogismm pushed a commit to neogismm/cloudstack that referenced this pull request Sep 5, 2022
…pache#6688)

Fixes apache#6679

Fixes behaviour when the VM is scaled to a new compute offering which has the same disk offering associated as the earlier compute offering.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to change Compute Offering, if the identical Disk Offering is linked to it

6 participants