Skip to content

Conversation

@Pearl1594
Copy link
Contributor

Description

Fixes: #5180
This PR allows users to expunge a VM in destroyed state (via destroyVM cmd).

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

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

Attempt expunging a VM in destroyed state using the bulk action support in the UI.

@Pearl1594
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@Pearl1594 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. SL-JID 474

@Pearl1594
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Trillian test result (tid-1204)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 41032 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5183-t1204-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_loadbalance.py
Intermittent failure detected: /marvin/tests/smoke/test_routers_network_ops.py
Intermittent failure detected: /marvin/tests/smoke/test_vpc_redundant.py
Smoke tests completed. 86 look OK, 2 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File
test_01_RVR_Network_FW_PF_SSH_default_routes_egress_true Failure 344.24 test_routers_network_ops.py
test_02_RVR_Network_FW_PF_SSH_default_routes_egress_false Failure 344.13 test_routers_network_ops.py
test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL Failure 538.80 test_vpc_redundant.py
test_03_create_redundant_VPC_1tier_2VMs_2IPs_2PF_ACL_reboot_routers Failure 532.11 test_vpc_redundant.py

Copy link
Contributor

@shwstppr shwstppr left a comment

Choose a reason for hiding this comment

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

LGTM

User (User role) destroys a VM without expunging:

(local) 🦍 > set username user1
(local) 🍁 > list virtualmachines filter=id,name,state listall=true
{
  "count": 1,
  "virtualmachine": [
    {
      "id": "f1e5ed65-7d57-4d87-b557-c398f69ef084",
      "name": "VM-f1e5ed65-7d57-4d87-b557-c398f69ef084",
      "state": "Running"
    }
  ]
}
(local) 🐄 > destroy virtualmachine id=f1e5ed65-7d57-4d87-b557-c398f69ef084 filter=id,name,state,
{}
(local) 🐞 > list virtualmachines filter=id,name,state listall=true
(local) 🦉 > set username admin
(local) 🦋 > list virtualmachines filter=id,name,state listall=true
{
  "count": 1,
  "virtualmachine": [
    {
      "id": "f1e5ed65-7d57-4d87-b557-c398f69ef084",
      "name": "VM-f1e5ed65-7d57-4d87-b557-c398f69ef084",
      "state": "Destroyed"
    }
  ]
}

Admin tries to expunge VM with destroyVirtualMachine API
Without changes - VM remains in Destroyed state

(local) 🐇 > destroy virtualmachine expunge=true id=f1e5ed65-7d57-4d87-b557-c398f69ef084 
{
  "virtualmachine": {
    "account": "user1",
    "affinitygroup": [],
    "cpunumber": 1,
    "cpuspeed": 500,
    "created": "2021-07-06T12:50:17+0530",
    "details": {
      "Message.ReservedCapacityFreed.Flag": "false"
    },
    "displayname": "VM-f1e5ed65-7d57-4d87-b557-c398f69ef084",
    "displayvm": true,
    "domain": "ROOT",
    "domainid": "8d26be19-de24-11eb-9f57-645d8651f45a",
    "guestosid": "8d148fc5-de24-11eb-9f57-645d8651f45a",
    "haenable": false,
    "hypervisor": "Simulator",
    "id": "f1e5ed65-7d57-4d87-b557-c398f69ef084",
    "instancename": "i-5-9-VM",
    "isdynamicallyscalable": false,
    "jobid": "43be3978-1472-4a10-b2c9-5fef38a8e98f",
    "jobstatus": 0,
    "memory": 512,
    "name": "VM-f1e5ed65-7d57-4d87-b557-c398f69ef084",
    "nic": [
      {
        "extradhcpoption": [],
        "gateway": "10.1.1.1",
        "id": "8e6f3201-9ac3-4ee6-b726-d23206d0bb91",
        "ipaddress": "10.1.1.149",
        "isdefault": true,
        "macaddress": "02:00:62:9c:00:06",
        "netmask": "255.255.255.0",
        "networkid": "2b56b153-9b56-4cf0-b23a-ef3817f9b806",
        "networkname": "nw",
        "secondaryip": [],
        "traffictype": "Guest",
        "type": "Isolated"
      }
    ],
    "osdisplayname": "CentOS 5.6 (64-bit)",
    "ostypeid": "8d148fc5-de24-11eb-9f57-645d8651f45a",
    "passwordenabled": false,
    "pooltype": "NetworkFilesystem",
    "rootdeviceid": 0,
    "rootdevicetype": "ROOT",
    "securitygroup": [],
    "serviceofferingid": "2da9fd13-5eb3-44a2-8912-656ab3facb9d",
    "serviceofferingname": "Small Instance",
    "state": "Destroyed",
    "tags": [],
    "templatedisplaytext": "CentOS 5.6 (64-bit) no GUI (Simulator)",
    "templateid": "92b2849b-de25-11eb-9f57-645d8651f45a",
    "templatename": "CentOS 5.6 (64-bit) no GUI (Simulator)",
    "userid": "373a6269-44f3-4853-8462-1f84cd3261db",
    "username": "user1",
    "zoneid": "f058985d-64b4-4cb9-8185-12ccb3e36e6b",
    "zonename": "Sandbox-simulator"
  }
}
(local) 🕷 > list virtualmachines filter=id,name,state listall=true
{
  "count": 1,
  "virtualmachine": [
    {
      "id": "f1e5ed65-7d57-4d87-b557-c398f69ef084",
      "name": "VM-f1e5ed65-7d57-4d87-b557-c398f69ef084",
      "state": "Destroyed"
    }
  ]
}

WIth changes - VM is successfully expunged

(local) 🦇 > destroy virtualmachine expunge=true id=f1e5ed65-7d57-4d87-b557-c398f69ef084 
{
  "null": {
    "affinitygroup": [],
    "nic": [],
    "securitygroup": [],
    "tags": []
  }
}
(local) 🐄 > list virtualmachines filter=id,name,state listall=true

@shwstppr shwstppr closed this Jul 7, 2021
@shwstppr shwstppr reopened this Jul 7, 2021
Copy link
Contributor

@vladimirpetrov vladimirpetrov left a comment

Choose a reason for hiding this comment

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

Functionality tested, LGTM!

Copy link
Member

@weizhouapache weizhouapache 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

@DaanHoogland DaanHoogland added this to the 4.16.0.0 milestone Jul 13, 2021
@DaanHoogland DaanHoogland merged commit b5d7535 into apache:main Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bulk actions: expunge command is ignored when the VMs are already in 'Destroyed' state

7 participants