adapt condition to use the correct letter for pvlan types#5194
Conversation
| (Strings.isNullOrEmpty(network.getBroadcastUri().toString()) || | ||
| !networkBroadcastUri.equals(String.format("pvlan://%d-i%d", nic.getVlan(), nic.getPvlan())))) { | ||
| throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("PVLAN of network(ID: %s) %s is found different from the VLAN of nic(ID: %s) pvlan://%d-i%d during VM import", network.getUuid(), networkBroadcastUri, nic.getNicId(), nic.getVlan(), nic.getPvlan())); | ||
| !networkBroadcastUri.equals(String.format("pvlan://%d-%s%d", nic.getVlan(), nic.getPvlanType().charAt(0), nic.getPvlan())))) { |
There was a problem hiding this comment.
@DK101010 will case of pvlan type matter? Does nic.getPvlanType() always return lowercase string?
There was a problem hiding this comment.
Hi @shwstppr yes, the types community and isolated are lowercase. I'm not quite sure if this will continue in the future. But I also didn't want to create pointless source code. That's why I left out for now
There was a problem hiding this comment.
living dangerously, huh? as it is used twice anyway, better prepare it in a var above.
…gerImpl.java Co-authored-by: dahn <daan.hoogland@gmail.com>
|
@blueorangutan package |
|
@shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✖️ el7 ✖️ el8 ✖️ debian. SL-JID 544 |
shwstppr
left a comment
There was a problem hiding this comment.
Other than the compilation issue, code changes are correct based on the premise that broadcast URI for PVLAN will be based on its type and the first character of the type string.
@DK101010 since we do not have any smoke to test VM import, it will be great if you can add API call/output for testing this change
…gerImpl.java Co-authored-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Do you want this ? import unmanagedinstance clusterid=b6dc2477-f3ec-43e2-a405-3605e29aaa42 name=VM-ac60ee4e-7231-4057-8ff6-40f0c9eacd04 displayname=VM-ac60ee4e-7231-4057-8ff6-40f0c9eacd04 serviceofferingid=35d68014-0257-4775-b256-49a009aa5750{
"accountid": "226c8611-ff24-11ea-9d07-005056827a97",
"cmd": "org.apache.cloudstack.api.command.admin.vm.ImportUnmanagedInstanceCmd",
"completed": "2021-07-15T07:18:39+0100",
"created": "2021-07-15T07:18:36+0100",
"jobid": "c07d365c-7057-4124-bf6b-ce4efbe2ca1b",
"jobprocstatus": 0,
"jobresult": {
"virtualmachine": {
"account": "admin",
"affinitygroup": [],
"cpunumber": 1,
"cpuspeed": 0,
"created": "2021-07-15T07:18:38+0100",
"details": {
"dataDiskController": "osdefault",
"deployvm": "true",
"nicAdapter": "E1000",
"rootDiskController": "pvscsi"
},
"displayname": "VM-ac60ee4e-7231-4057-8ff6-40f0c9eacd04",
"displayvm": true,
"domain": "ROOT",
"domainid": "226c46c2-ff24-11ea-9d07-005056827a97",
"guestosid": "224af937-ff24-11ea-9d07-005056827a97",
"haenable": false,
"hostid": "73676017-b962-4942-bb4c-cf297634b212",
"hostname": "iosvemt01.esx-tst.os.itelligence.de",
"hypervisor": "VMware",
"id": "93309b0b-8af7-4ad2-85ea-a7e492b9af2e",
"instancename": "VM-ac60ee4e-7231-4057-8ff6-40f0c9eacd04",
"isdynamicallyscalable": false,
"memory": 1024,
"name": "VM-ac60ee4e-7231-4057-8ff6-40f0c9eacd04",
"nic": [
{
"broadcasturi": "vlan://2",
"extradhcpoption": [],
"id": "3d4d8f5e-2ce6-4575-91c8-9d367520d97c",
"isdefault": true,
"isolationuri": "vlan://2",
"macaddress": "02:00:07:e5:00:60",
"networkid": "85d27cc3-9184-4d7f-87c4-e5b08b2eb2cc",
"networkname": "Guest",
"secondaryip": [],
"traffictype": "Guest",
"type": "L2"
}
],
"osdisplayname": "Other Ubuntu (64-bit)",
"ostypeid": "224af937-ff24-11ea-9d07-005056827a97",
"passwordenabled": false,
"rootdeviceid": 0,
"rootdevicetype": "ROOT",
"securitygroup": [],
"serviceofferingid": "35d68014-0257-4775-b256-49a009aa5750",
"serviceofferingname": "testCPU0Mhz",
"state": "Running",
"tags": [],
"templatedisplaytext": "VM Import Default Template",
"templateid": "59faead6-743e-442f-a964-ffb31da3e785",
"templatename": "system-default-vm-import-dummy-template.iso",
"userid": "22712228-ff24-11ea-9d07-005056827a97",
"username": "admin",
"zoneid": "de1c4b6f-a58b-46e6-9418-1fd55a9f022c",
"zonename": "eu-de-vct5"
}
},
"jobresultcode": 0,
"jobresulttype": "object",
"jobstatus": 1,
"userid": "22712228-ff24-11ea-9d07-005056827a97"
}
|
|
@blueorangutan package @DK101010 yes, will be great to have a list and import API call/output added in the PR's description. Though I feel the test you added above is not for PVLAN broadcast URI type. |
|
@shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian. SL-JID 553 |
@shwstppr you are completely right, wrong vm
{
"accountid": "226c8611-ff24-11ea-9d07-005056827a97",
"cmd": "org.apache.cloudstack.api.command.admin.vm.ImportUnmanagedInstanceCmd",
"completed": "2021-07-15T09:42:19+0100",
"created": "2021-07-15T09:42:05+0100",
"jobid": "189390c5-6401-4e62-830f-7ba2b96c174f",
"jobprocstatus": 0,
"jobresult": {
"virtualmachine": {
"affinitygroup": [],
"cpunumber": 1,
"cpuspeed": 0,
"created": "2021-07-15T09:42:19+0100",
"details": {
"cpuNumber": "1",
"dataDiskController": "osdefault",
"deployvm": "true",
"memory": "1024",
"nicAdapter": "Vmxnet3",
"rootDiskController": "pvscsi"
},
"displayname": "ubuvtst6",
"displayvm": true,
"domain": "itelligence",
"domainid": "05dfd7d7-5b11-4f3e-94e4-9569c95f75ee",
"guestosid": "224af937-ff24-11ea-9d07-005056827a97",
"haenable": false,
"hostid": "73676017-b962-4942-bb4c-cf297634b212",
"hostname": "iosvemt01.esx-tst.os.itelligence.de",
"hypervisor": "VMware",
"id": "c13c12de-aa87-413c-8fe3-895a7094af60",
"instancename": "ubuvtst6",
"isdynamicallyscalable": false,
"memory": 1024,
"name": "ubuvtst6",
"nic": [
{
"broadcasturi": "vlan://289",
"extradhcpoption": [],
"id": "c5f110b3-cdc1-492d-be66-c313861942df",
"isdefault": true,
"isolationuri": "vlan://289",
"macaddress": "00:50:56:92:12:41",
"networkid": "c0816fba-bac0-46a7-b749-cc2c36e97f60",
"networkname": "Frontend_289",
"secondaryip": [],
"traffictype": "Guest",
"type": "L2"
},
{
"broadcasturi": "pvlan://63-c289",
"extradhcpoption": [],
"id": "46820c91-c310-4b1e-9383-7a8036e97a8f",
"isdefault": false,
"isolationuri": "pvlan://63-c289",
"macaddress": "02:00:39:f3:00:01",
"networkid": "baad9713-c8a8-4f5f-8ea5-546190db4306",
"networkname": "Backup_63-289",
"secondaryip": [],
"traffictype": "Guest",
"type": "L2"
}
],
"osdisplayname": "Other Ubuntu (64-bit)",
"ostypeid": "224af937-ff24-11ea-9d07-005056827a97",
"passwordenabled": false,
"project": "dev-01",
"projectid": "fc61ebe1-6290-4100-98ca-18fb3d950af2",
"rootdeviceid": 0,
"rootdevicetype": "ROOT",
"securitygroup": [],
"serviceofferingid": "15b5681f-08c2-417a-a9ba-4480c229ec03",
"serviceofferingname": "custom_std-ha-std_fat-fp-std",
"state": "Running",
"tags": [],
"templatedisplaytext": "VM Import Default Template",
"templateid": "59faead6-743e-442f-a964-ffb31da3e785",
"templatename": "system-default-vm-import-dummy-template.iso",
"userid": "22712228-ff24-11ea-9d07-005056827a97",
"username": "admin",
"zoneid": "de1c4b6f-a58b-46e6-9418-1fd55a9f022c",
"zonename": "eu-de-vct5"
}
},
"jobresultcode": 0,
"jobresulttype": "object",
"jobstatus": 1,
"userid": "22712228-ff24-11ea-9d07-005056827a97"
}
|
|
@DK101010 a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
shwstppr
left a comment
There was a problem hiding this comment.
LGTM based on code changes and test import reported. Packaging working fine now
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian. SL-JID 554 |
|
@DK101010 when upgrading from version X to Y, CloudStack will apply all the upgrade scripts from versions between X and Y (e.g. from 4.15.0 to 4.16.0 has to apply DB upgrades from intermediate version 4.15.1) The upgrade scripts are executed in this way:
In short, as this PR is going into 4.16 you can place the DB update SQL for older PVLANs in the file Happy to help, please ping me if you need help with that P.S: on the issue #5202 the SQL update is proposed: |
@nvazquez Please don't oversee the remarks before and after the SQL in #5202:
Those I guess it is unfortunately not done by a simple sql update script 🤔 |
|
Thanks @mib1185 good remarks, I'll check further cc. @davidjumani |
|
There can only be one isolated secondary vlan per each primary vlan, but multiple community secondary vlan. |
|
cc @davidjumani |
|
@nvazquez @shwstppr @davidjumani - can you discuss and check with @DK101010 if it's possible to support backward compatibility or automatic fix post-upgrade? |
|
@rhtyd That's being tracked here #5202 |
|
@blueorangutan package |
|
@nvazquez a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian. SL-JID 926 |
|
@blueorangutan test centos7 vmware-67u3 |
|
@nvazquez a Trillian-Jenkins test job (centos7 mgmt + vmware-67u3) has been kicked to run smoke tests |
|
Trillian test result (tid-1723)
|
|
Ping @davidjumani can you review this - I think you worked on pvlan related feature so you may have some ideas to review/test this? cc @nvazquez |
|
@rhtyd as discussed in #5202 this PR is good to go, but needs a separate PR to address the upgrade for older pvlans (DB upgrade will not work) |
Description
In the past, the broadcast uri was changed to an "i" for isolated, as well as c for community.
see #4040
However, the ingest logic has not been adjusted, which means it's no longer possible to ingest a VM with a community
network.
For this reason I've adapted the condition and add correct pvlan type.
Important
All existing community network broadcast uri's in cloudstack before 4.15.1.0 must be updated manually or new created
because all community networks contains the letter i in the broadcast uri.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
Tested in own VMware env.