Skip to content

vmware: search unmanaged instances using hypervisor name#4328

Merged
yadvr merged 2 commits into
apache:4.14from
shapeblue:fix-vm-import-name-search
Sep 24, 2020
Merged

vmware: search unmanaged instances using hypervisor name#4328
yadvr merged 2 commits into
apache:4.14from
shapeblue:fix-vm-import-name-search

Conversation

@shwstppr
Copy link
Copy Markdown
Contributor

@shwstppr shwstppr commented Sep 15, 2020

Description

VMware code keeps a cache of existing VMs on a hypervisor host using cloud.vm.internal.name property of the VM. Searching for unmanaged instances/VMs on a host might not return an expected result when this property differs from the actual name of the VM.

To reproduce:

  • Deploy a VM in vCenter
  • Set custom attribute for the VM with key = cloud.vm.internal.name and value = Anything different than VM name
  • listUnmanagedInstance API fails when name parameter with name of the VM
  • importUnmanagedInstance API fails for the VM

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)

Screenshots (if appropriate):

How Has This Been Tested?

With API using cmk

VM in vcenter having a different name and custom attribute cloud.vm.internal.name
Screenshot from 2020-09-21 12-27-04

Both listUnmanagedInstance and importUnmanagedInstance

> list unmanagedinstances clusterid=5c46e61a-4f4e-478a-8479-613156747764 name=clone
{
  "count": 1,
  "unmanagedinstance": [
    {
      "clusterid": "5c46e61a-4f4e-478a-8479-613156747764",
      "cpucorepersocket": 1,
      "cpunumber": 1,
      "cpuspeed": 0,
      "disk": [
        {
          "capacity": 2147483648,
          "controller": "ide",
          "controllerunit": 0,
          "datastorehost": "10.10.0.16",
          "datastorename": "4a4b464bbcc83578bc6ce35ded34010a",
          "datastorepath": "/acs/primary/pr4328-t2806-vmware-67u3/pr4328-t2806-vmware-67u3-esxi-pri2",
          "datastoretype": "NFS",
          "id": "10-3001",
          "imagepath": "[4a4b464bbcc83578bc6ce35ded34010a] clone/clone_5.vmdk",
          "label": "Hard disk 1",
          "position": 1
        }
      ],
      "hostid": "2ea89a56-df8f-416d-9e9c-0ca35c78a631",
      "memory": 512,
      "name": "clone",
      "nic": [
        {
          "adaptertype": "E1000",
          "id": "Network adapter 1",
          "macaddress": "02:00:6a:49:00:02",
          "networkname": "cloud.guest.1539.200.1-vSwitch1",
          "vlanid": 1539
        }
      ],
      "osdisplayname": "CentOS 4/5 or later (64-bit)",
      "osid": "centos64Guest",
      "powerstate": "PowerOn"
    }
  ]
}
> import unmanagedinstance clusterid=5c46e61a-4f4e-478a-8479-613156747764 name=clone templateid=bfc585bb-fbd0-11ea-bdc1-1e00f10138c3 serviceofferingid=bd10b24c-b742-4602-86e5-7bbb56c1329a 
{
  "virtualmachine": {
    "account": "admin",
    "affinitygroup": [],
    "cpunumber": 1,
    "cpuspeed": 500,
    "created": "2020-09-21T06:56:08+0000",
    "details": {
      "dataDiskController": "osdefault",
      "deployvm": "true",
      "nicAdapter": "E1000",
      "rootDiskController": "ide"
    },
    "displayname": "clone",
    "displayvm": true,
    "domain": "ROOT",
    "domainid": "bfa279ba-fbd0-11ea-bdc1-1e00f10138c3",
    "guestosid": "bfef14e9-fbd0-11ea-bdc1-1e00f10138c3",
    "haenable": false,
    "hostid": "2ea89a56-df8f-416d-9e9c-0ca35c78a631",
    "hostname": "10.10.4.114",
    "hypervisor": "VMware",
    "id": "51989767-5ad2-4899-bfe9-253bca09bc59",
    "instancename": "clone",
    "isdynamicallyscalable": false,
    "memory": 512,
    "name": "clone",
    "nic": [
      {
        "broadcasturi": "vlan://1539",
        "extradhcpoption": [],
        "id": "a393a281-e61c-4633-b85f-fe5b83e60d06",
        "isdefault": true,
        "isolationuri": "vlan://1539",
        "macaddress": "02:00:6a:49:00:02",
        "networkid": "eeb8147d-f1af-4d0b-afa4-4936b3720952",
        "networkname": "t1net",
        "secondaryip": [],
        "traffictype": "Guest",
        "type": "L2"
      }
    ],
    "osdisplayname": "CentOS 5.3 (64-bit)",
    "ostypeid": "bfef14e9-fbd0-11ea-bdc1-1e00f10138c3",
    "passwordenabled": false,
    "rootdeviceid": 0,
    "rootdevicetype": "ROOT",
    "securitygroup": [],
    "serviceofferingid": "bd10b24c-b742-4602-86e5-7bbb56c1329a",
    "serviceofferingname": "Small Instance",
    "state": "Running",
    "tags": [],
    "templatedisplaytext": "CentOS 5.3(64-bit) no GUI (vSphere)",
    "templateid": "bfc585bb-fbd0-11ea-bdc1-1e00f10138c3",
    "templatename": "CentOS 5.3(64-bit) no GUI (vSphere)",
    "userid": "d6e87cc2-fbd0-11ea-bdc1-1e00f10138c3",
    "username": "admin",
    "zoneid": "72b53dda-ceb4-49da-9c19-9b1a4a7a143c",
    "zonename": "pr4328-t2806-vmware-67u3"
  }
}

@shwstppr
Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

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

@yadvr yadvr added this to the 4.15.0.0 milestone Sep 15, 2020
@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔centos7 ✔centos8 ✔debian. JID-2007

@yadvr
Copy link
Copy Markdown
Member

yadvr commented Sep 15, 2020

@blueorangutan test centos7 vmware-67u3

@blueorangutan
Copy link
Copy Markdown

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

@blueorangutan
Copy link
Copy Markdown

Trillian test result (tid-2743)
Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server 7
Total time taken: 55075 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4328-t2743-vmware-67u3.zip
Intermittent failure detected: /marvin/tests/smoke/test_kubernetes_supported_versions.py
Intermittent failure detected: /marvin/tests/smoke/test_outofbandmanagement.py
Intermittent failure detected: /marvin/tests/smoke/test_vpc_vpn.py
Smoke tests completed. 83 look OK, 2 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File
test_01_add_delete_kubernetes_supported_version Error 1810.38 test_kubernetes_supported_versions.py
test_oobm_zchange_password Error 18.07 test_outofbandmanagement.py

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@shwstppr shwstppr force-pushed the fix-vm-import-name-search branch from 70fea3e to d46b9dc Compare September 18, 2020 04:34
@shwstppr shwstppr changed the base branch from master to 4.14 September 18, 2020 04:34
@shwstppr
Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

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

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

Packaging result: ✔centos7 ✖centos8 ✔debian. JID-2035

@shwstppr shwstppr closed this Sep 18, 2020
@shwstppr shwstppr reopened this Sep 18, 2020
@shwstppr shwstppr marked this pull request as ready for review September 21, 2020 07:23
@shwstppr
Copy link
Copy Markdown
Contributor Author

@rhtyd I have changed base branch as vm import was added in 4.14. Please change the milestone if needed
@blueorangutan test centos7 vmware-67u3

@blueorangutan
Copy link
Copy Markdown

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

@DaanHoogland DaanHoogland modified the milestones: 4.15.0.0, 4.14.1.0 Sep 21, 2020
@blueorangutan
Copy link
Copy Markdown

Trillian test result (tid-2807)
Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server 7
Total time taken: 64641 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4328-t2807-vmware-67u3.zip
Intermittent failure detected: /marvin/tests/smoke/test_deploy_vm_root_resize.py
Intermittent failure detected: /marvin/tests/smoke/test_kubernetes_supported_versions.py
Intermittent failure detected: /marvin/tests/smoke/test_outofbandmanagement.py
Intermittent failure detected: /marvin/tests/smoke/test_router_dhcphosts.py
Intermittent failure detected: /marvin/tests/smoke/test_vpc_redundant.py
Smoke tests completed. 76 look OK, 2 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File
test_01_add_delete_kubernetes_supported_version Error 1808.03 test_kubernetes_supported_versions.py
test_oobm_issue_power_cycle Error 24.38 test_outofbandmanagement.py
test_oobm_issue_power_off Error 21.56 test_outofbandmanagement.py
test_oobm_issue_power_on Error 22.59 test_outofbandmanagement.py
test_oobm_issue_power_reset Error 26.35 test_outofbandmanagement.py

@yadvr
Copy link
Copy Markdown
Member

yadvr commented Sep 22, 2020

Tests, 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.

code looks good, not sure if the method rename is making anything more clear but no objections.

@yadvr yadvr merged commit ca1e02f into apache:4.14 Sep 24, 2020
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.

4 participants