Closed borisstoyanov closed 1 year ago
Investigated this. Imported VMs doesn't set deviceIds for imported NICs and they always remain 0
> select id,uuid,device_id from nics where instance_id=32;
+----+--------------------------------------+-----------+
| id | uuid | device_id |
+----+--------------------------------------+-----------+
| 80 | dfe56e48-e1b6-4464-b29b-1f726d9e335f | 0 |
| 81 | ce94fb42-771d-4513-a6a2-6a28b199656f | 0 |
| 82 | ba7636b2-bac2-412b-b12a-14f4482244b3 | 0 |
+----+--------------------------------------+-----------+
While all nics are imported fine they are not returned by the listVirtualMachines API (probably after this https://github.com/apache/cloudstack/commit/490658c5c323bd6ad8e38ee7b65738787cb6bf3c). listNics API return them correctly,
(localcloud) 🐱 > list virtualmachines id=f9a33062-9554-4129-bf53-567b02a2d6af
{
"count": 1,
"virtualmachine": [
{
"account": "admin",
"affinitygroup": [],
"cpunumber": 1,
"cpuspeed": 500,
"cpuused": "7%",
"created": "2022-12-07T11:27:35+0000",
"details": {
"dataDiskController": "osdefault",
"deployvm": "true",
"nicAdapter": "E1000",
"rootDiskController": "ide"
},
"diskioread": 0,
"diskiowrite": 0,
"diskkbsread": 0,
"diskkbswrite": 0,
"displayname": "gsgdsg",
"displayvm": true,
"domain": "ROOT",
"domainid": "28dd0d34-6c84-11ed-8ab8-1e00480000ff",
"guestosid": "28e2ad5a-6c84-11ed-8ab8-1e00480000ff",
"haenable": false,
"hasannotations": false,
"hostid": "570210ef-977d-4889-bd52-96b95b0e1658",
"hostname": "10.0.34.63",
"hypervisor": "VMware",
"id": "f9a33062-9554-4129-bf53-567b02a2d6af",
"instancename": "i-2-29-VM",
"isdynamicallyscalable": false,
"memory": 512,
"memoryintfreekbs": 519168,
"memorykbs": 524288,
"memorytargetkbs": 524288,
"name": "i-2-29-VM",
"networkkbsread": 0,
"networkkbswrite": 0,
"nic": [
{
"broadcasturi": "vlan://1224",
"deviceid": "0",
"extradhcpoption": [],
"id": "a31136c7-ab39-4870-98af-7da2328ccab9",
"isdefault": true,
"isolationuri": "vlan://1224",
"macaddress": "02:00:18:e1:00:01",
"networkid": "3b0ba2a6-f8a6-4bd7-aca0-397209e2e4f9",
"networkname": "l2-1",
"secondaryip": [],
"traffictype": "Guest",
"type": "L2"
}
],
"osdisplayname": "CentOS 5.0 (64-bit)",
"ostypeid": "28e2ad5a-6c84-11ed-8ab8-1e00480000ff",
"passwordenabled": false,
"pooltype": "NetworkFilesystem",
"receivedbytes": 0,
"rootdeviceid": 0,
"rootdevicetype": "ROOT",
"securitygroup": [],
"sentbytes": 0,
"serviceofferingid": "24a0a582-723f-4f75-972f-e759347f08e9",
"serviceofferingname": "Small Instance",
"state": "Running",
"tags": [],
"templatedisplaytext": "VM Import Default Template",
"templateid": "d8e4e63c-bbe7-4367-9a12-b14f2f01b062",
"templatename": "system-default-vm-import-dummy-template.iso",
"userid": "3ef79458-6c84-11ed-8ab8-1e00480000ff",
"username": "admin",
"zoneid": "2e2b5e15-b08e-4d62-9288-312a8f7f21e8",
"zonename": "ref-trl-3847-v-M7-abhishek-kumar"
}
]
}
(localcloud) 🐱 > list nics virtualmachineid=f9a33062-9554-4129-bf53-567b02a2d6af
{
"count": 3,
"nic": [
{
"broadcasturi": "vlan://1224",
"deviceid": "0",
"extradhcpoption": [],
"id": "a31136c7-ab39-4870-98af-7da2328ccab9",
"isdefault": true,
"isolationuri": "vlan://1224",
"macaddress": "02:00:18:e1:00:01",
"networkid": "3b0ba2a6-f8a6-4bd7-aca0-397209e2e4f9",
"networkname": "l2-1",
"traffictype": "Guest",
"type": "L2",
"virtualmachineid": "f9a33062-9554-4129-bf53-567b02a2d6af"
},
{
"broadcasturi": "vlan://1221",
"deviceid": "0",
"extradhcpoption": [],
"gateway": "10.1.1.1",
"id": "562ea186-2c91-41ba-838c-ca276e7887e5",
"ipaddress": "10.1.1.193",
"isdefault": false,
"isolationuri": "vlan://1221",
"macaddress": "02:00:31:05:00:05",
"netmask": "255.255.255.0",
"networkid": "b88d9ada-7673-419b-bafe-76eafffb51e8",
"networkname": "Isolated1",
"traffictype": "Guest",
"type": "Isolated",
"virtualmachineid": "f9a33062-9554-4129-bf53-567b02a2d6af"
},
{
"broadcasturi": "vlan://1228",
"deviceid": "0",
"extradhcpoption": [],
"gateway": "10.1.1.1",
"id": "0e241072-5f72-4e5b-8165-106624dd01ba",
"ipaddress": "10.1.1.197",
"isdefault": false,
"isolationuri": "vlan://1228",
"macaddress": "02:00:13:4e:00:11",
"netmask": "255.255.255.0",
"networkid": "dcca7280-f9af-4f20-b925-67928d9294b3",
"networkname": "dsgfds",
"traffictype": "Guest",
"type": "Isolated",
"virtualmachineid": "f9a33062-9554-4129-bf53-567b02a2d6af"
}
]
}
Drafted a PR which adds deviceid for nics of imported VM
@borisstoyanov I realised just after merging this hasn't been manually tested by you or @vladimirpetrov but I see testing from @shwstppr, pl re-open if this should require another round of testing by someone else 🙏
ISSUE TYPE
COMPONENT NAME
CLOUDSTACK VERSION
CONFIGURATION
VMware
OS / ENVIRONMENT
SUMMARY
When importing an unmanaged VM it only adds the first NIC, if the VM has more than one it will end up only with one in CloudStack
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS