-
Notifications
You must be signed in to change notification settings - Fork 1.3k
server: keep networks order and ips while move a vm with multiple networks #4602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
server: keep networks order and ips while move a vm with multiple networks #4602
Conversation
DaanHoogland
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new code looks good, moveVMToUser is 500 lines in a single method. this deserves refactoring and the logic remains hardly verifyable by code review. testing required ;)
|
@blueorangutan package |
|
@shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos7 ✖centos8 ✔debian. JID-2586 |
|
@blueorangutan test |
|
@shwstppr a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-3411)
|
|
@ustcweizhou maybe it due to Simulator env but while assigning a new user, VM lost one NIC while IP for default network remained the same. Is this expected behaviour? After assigning new user, |
@shwstppr I will look into it. |
|
@weizhouapache that's the adv zone created by https://github.com/apache/cloudstack/blob/master/setup/dev/advanced.cfg but it would be a good idea to test SG envs as well |
@rhtyd thanks. I will investigate it. |
@shwstppr (1) if there is no network in api request, (2) if there is a list of networks in api request, this pr fixes
hence I think your testing result is same as expected. I will add a commit to take L2 network into consideration. |
|
@blueorangutan package |
|
@shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos7 ✖centos8 ✔debian. JID-2595 |
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-3439)
|
shwstppr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Tested on local simulator env,
> list virtualmachines id=8fbb3706-c542-4224-a274-6f40c490804a
{
"count": 1,
"virtualmachine": [
{
"account": "admin",
"affinitygroup": [],
"bootmode": "legacy",
"boottype": "Bios",
"cpunumber": 1,
"cpuspeed": 500,
"created": "2021-01-29T12:13:29+0530",
"details": {},
"displayname": "t5",
"displayvm": true,
"domain": "ROOT",
"domainid": "b4924318-6146-11eb-9c0f-a0afbd4a2d60",
"guestosid": "b48662d8-6146-11eb-9c0f-a0afbd4a2d60",
"haenable": false,
"hostid": "e4090dc6-ba83-4a6a-ad43-09a0c8879b1d",
"hostname": "SimulatedAgent.2466f4c8-49df-47b7-804d-b5306163368b",
"hypervisor": "Simulator",
"id": "8fbb3706-c542-4224-a274-6f40c490804a",
"instancename": "i-2-10-QA",
"isdynamicallyscalable": false,
"memory": 512,
"name": "t5",
"nic": [
{
"broadcasturi": "vlan://4321",
"extradhcpoption": [],
"gateway": "10.9.9.1",
"id": "c534fbc5-d5f8-40b8-876b-affb4ad6ce98",
"ipaddress": "10.9.9.23",
"isdefault": true,
"isolationuri": "vlan://4321",
"macaddress": "1e:00:9a:00:01:af",
"netmask": "255.255.255.0",
"networkid": "8f3b4910-008a-49e5-a305-74a5edff3254",
"networkname": "sh2",
"secondaryip": [],
"traffictype": "Guest",
"type": "Shared"
},
{
"broadcasturi": "vlan://1234",
"extradhcpoption": [],
"gateway": "10.9.8.1",
"id": "37ea01ba-7fc7-4506-806c-4464b5b745a7",
"ipaddress": "10.9.8.12",
"isdefault": false,
"isolationuri": "vlan://1234",
"macaddress": "1e:00:7f:00:01:90",
"netmask": "255.255.255.0",
"networkid": "12cf0569-f05d-44a2-88cf-d9b5b04eefe9",
"networkname": "sh1",
"secondaryip": [],
"traffictype": "Guest",
"type": "Shared"
}
],
"osdisplayname": "CentOS 5.6 (64-bit)",
"ostypeid": "b48662d8-6146-11eb-9c0f-a0afbd4a2d60",
"passwordenabled": false,
"rootdeviceid": 0,
"rootdevicetype": "ROOT",
"securitygroup": [],
"serviceofferingid": "6338335e-5ee7-4fcc-a0cb-4746ff0d35e3",
"serviceofferingname": "Small Instance",
"state": "Running",
"tags": [],
"templatedisplaytext": "CentOS 5.6 (64-bit) no GUI (Simulator)",
"templateid": "4a0360b8-6147-11eb-9c0f-a0afbd4a2d60",
"templatename": "CentOS 5.6 (64-bit) no GUI (Simulator)",
"userid": "b494f70a-6146-11eb-9c0f-a0afbd4a2d60",
"username": "admin",
"zoneid": "25849759-355c-49be-b004-664f34d77a65",
"zonename": "Sandbox-simulator"
}
]
}
(localcloud) 🐱 > stop virtualmachine id=8fbb3706-c542-4224-a274-6f40c490804a
{
"virtualmachine": {
"account": "admin",
"affinitygroup": [],
"cpunumber": 1,
"cpuspeed": 500,
"cpuused": "10%",
"created": "2021-01-29T12:13:29+0530",
"details": {
"Message.ReservedCapacityFreed.Flag": "false"
},
"diskioread": 0,
"diskiowrite": 0,
"diskkbsread": 0,
"diskkbswrite": 0,
"displayname": "t5",
"displayvm": true,
"domain": "ROOT",
"domainid": "b4924318-6146-11eb-9c0f-a0afbd4a2d60",
"guestosid": "b48662d8-6146-11eb-9c0f-a0afbd4a2d60",
"haenable": false,
"hypervisor": "Simulator",
"id": "8fbb3706-c542-4224-a274-6f40c490804a",
"instancename": "i-2-10-QA",
"isdynamicallyscalable": false,
"jobid": "99369c1f-a616-4ecf-b74a-2e46ecb40714",
"jobstatus": 0,
"memory": 512,
"memoryintfreekbs": 0,
"memorykbs": 0,
"memorytargetkbs": 0,
"name": "t5",
"networkkbsread": 32768,
"networkkbswrite": 16384,
"nic": [
{
"broadcasturi": "vlan://4321",
"extradhcpoption": [],
"gateway": "10.9.9.1",
"id": "c534fbc5-d5f8-40b8-876b-affb4ad6ce98",
"ipaddress": "10.9.9.23",
"isdefault": true,
"isolationuri": "vlan://4321",
"macaddress": "1e:00:9a:00:01:af",
"netmask": "255.255.255.0",
"networkid": "8f3b4910-008a-49e5-a305-74a5edff3254",
"networkname": "sh2",
"secondaryip": [],
"traffictype": "Guest",
"type": "Shared"
},
{
"broadcasturi": "vlan://1234",
"extradhcpoption": [],
"gateway": "10.9.8.1",
"id": "37ea01ba-7fc7-4506-806c-4464b5b745a7",
"ipaddress": "10.9.8.12",
"isdefault": false,
"isolationuri": "vlan://1234",
"macaddress": "1e:00:7f:00:01:90",
"netmask": "255.255.255.0",
"networkid": "12cf0569-f05d-44a2-88cf-d9b5b04eefe9",
"networkname": "sh1",
"secondaryip": [],
"traffictype": "Guest",
"type": "Shared"
}
],
"osdisplayname": "CentOS 5.6 (64-bit)",
"ostypeid": "b48662d8-6146-11eb-9c0f-a0afbd4a2d60",
"passwordenabled": false,
"rootdeviceid": 0,
"rootdevicetype": "ROOT",
"securitygroup": [],
"serviceofferingid": "6338335e-5ee7-4fcc-a0cb-4746ff0d35e3",
"serviceofferingname": "Small Instance",
"state": "Stopped",
"tags": [],
"templatedisplaytext": "CentOS 5.6 (64-bit) no GUI (Simulator)",
"templateid": "4a0360b8-6147-11eb-9c0f-a0afbd4a2d60",
"templatename": "CentOS 5.6 (64-bit) no GUI (Simulator)",
"userid": "b494f70a-6146-11eb-9c0f-a0afbd4a2d60",
"username": "admin",
"zoneid": "25849759-355c-49be-b004-664f34d77a65",
"zonename": "Sandbox-simulator"
}
}
(localcloud) 🐱 > assign virtualmachine virtualmachineid=8fbb3706-c542-4224-a274-6f40c490804a account=admin1 domainid=b4924318-6146-11eb-9c0f-a0afbd4a2d60 networkids=8f3b4910-008a-49e5-a305-74a5edff3254,12cf0569-f05d-44a2-88cf-d9b5b04eefe9
{
"virtualmachine": {
"account": "admin1",
"affinitygroup": [],
"cpunumber": 1,
"cpuspeed": 500,
"cpuused": "10%",
"created": "2021-01-29T12:13:29+0530",
"details": {
"Message.ReservedCapacityFreed.Flag": "false"
},
"diskioread": 0,
"diskiowrite": 0,
"diskkbsread": 0,
"diskkbswrite": 0,
"displayname": "t5",
"displayvm": true,
"domain": "ROOT",
"domainid": "b4924318-6146-11eb-9c0f-a0afbd4a2d60",
"guestosid": "b48662d8-6146-11eb-9c0f-a0afbd4a2d60",
"haenable": false,
"hypervisor": "Simulator",
"id": "8fbb3706-c542-4224-a274-6f40c490804a",
"instancename": "i-2-10-QA",
"isdynamicallyscalable": false,
"memory": 512,
"memoryintfreekbs": 0,
"memorykbs": 0,
"memorytargetkbs": 0,
"name": "t5",
"networkkbsread": 32768,
"networkkbswrite": 16384,
"nic": [
{
"broadcasturi": "vlan://4321",
"extradhcpoption": [],
"gateway": "10.9.9.1",
"id": "c8604d05-6fff-47c1-baa1-4f50ab5d6bd5",
"ipaddress": "10.9.9.23",
"isdefault": true,
"isolationuri": "vlan://4321",
"macaddress": "1e:00:44:00:01:af",
"netmask": "255.255.255.0",
"networkid": "8f3b4910-008a-49e5-a305-74a5edff3254",
"networkname": "sh2",
"secondaryip": [],
"traffictype": "Guest",
"type": "Shared"
},
{
"broadcasturi": "vlan://1234",
"extradhcpoption": [],
"gateway": "10.9.8.1",
"id": "57dbdd3c-96de-4e1e-be8d-745ccf75e932",
"ipaddress": "10.9.8.12",
"isdefault": false,
"isolationuri": "vlan://1234",
"macaddress": "1e:00:d0:00:01:90",
"netmask": "255.255.255.0",
"networkid": "12cf0569-f05d-44a2-88cf-d9b5b04eefe9",
"networkname": "sh1",
"secondaryip": [],
"traffictype": "Guest",
"type": "Shared"
}
],
"osdisplayname": "CentOS 5.6 (64-bit)",
"ostypeid": "b48662d8-6146-11eb-9c0f-a0afbd4a2d60",
"passwordenabled": false,
"rootdeviceid": 0,
"rootdevicetype": "ROOT",
"securitygroup": [],
"serviceofferingid": "6338335e-5ee7-4fcc-a0cb-4746ff0d35e3",
"serviceofferingname": "Small Instance",
"state": "Stopped",
"tags": [],
"templatedisplaytext": "CentOS 5.6 (64-bit) no GUI (Simulator)",
"templateid": "4a0360b8-6147-11eb-9c0f-a0afbd4a2d60",
"templatename": "CentOS 5.6 (64-bit) no GUI (Simulator)",
"userid": "b494f70a-6146-11eb-9c0f-a0afbd4a2d60",
"username": "admin",
"zoneid": "25849759-355c-49be-b004-664f34d77a65",
"zonename": "Sandbox-simulator"
}
}
* 4.14: server: select root disk based on user input during vm import (#4591) kvm: Use Q35 chipset for UEFI x86_64 (#4576) server: fix wrong error message when create isolated network without SourceNat (#4624) server: add possibility to scale vm to current customer offerings (#4622) server: keep networks order and ips while move a vm with multiple networks (#4602) server: throw exception when update vm nic on L2 network (#4625) doc: fix typo in install notes (#4633)
* 4.15: server: select root disk based on user input during vm import (#4591) kvm: Use Q35 chipset for UEFI x86_64 (#4576) server: fix wrong error message when create isolated network without SourceNat (#4624) server: add possibility to scale vm to current customer offerings (#4622) server: keep networks order and ips while move a vm with multiple networks (#4602) server: throw exception when update vm nic on L2 network (#4625) doc: fix typo in install notes (#4633)
Description
This PR fixes an issue when move a vm from an account to another account.
Steps to reproduce the issue
(1) create a vm with multiple shared networks (in advanced zone, or advanced zone with security groups)
(2) create another account (in same domain who can also access the shared networks)
(3) move vm to new account, with a list of networkid
expected result: the vm has nics on the networks in same order as specified in API request, and nics have the same ips as before
actual result: network order is not same as specified, ips are changed.
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?