You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
VM stopped while Migration with Maintenance Mode (KVM) #3720
KVM with QEMU 2.12 and libwirtd 5.0.0, i think other other versions are also affected because not always there is the problem.
SUMMARY
STEPS TO REPRODUCE
Set a Host in Maintenance Mode
VM Migration is started
If a VM cant migrate it will hard stopped
after @andrijapanicsb started a discussion on mailing list "VMs crashing/stopped during live migration?" i opened this issue request to track down the problems.
@ustcweizhou gave some interesting hints to this problem.
i picked up specially your point three. i think its most interesting to track this down.
vm is stopped due to some cloudstack bugs. for example, when we put a
host to maintenance, the vm will be stopped if (1) no other host is Up in
same cluster, or (2) vm migration fails and no retry in cloudstack, or (3)
multiple vms are migrated to same destination at the same time but there is
no enough memory on the destination.
EXPECTED RESULTS
The expected result should be to stop the maintenance mode but dont switch off the virtual machines
I believe the biggest problem I saw was VM crashing due to qemu bugs/issue (i.e. recently saw this one “qemu-kvm general protection error in libtcmalloc.so.4.4.5”) – can’t speak for other issues, since I don’t recall having them with ACS 4.5/4.8 with Ubuntu 14.04 (qemu 2.0 initially, later upgraded to 2.5)
If not mistaken, there is indeed a behavior that if there is no enough capacities in the cluster (test with a single KVM host in the cluster), the VMs will be stopped – and that is a thing to change in my opinion. Maintenance should fail and host should be in ErrorInMaintenance mode.
If you want to do maintenance of that host, put the storage into the maintenance mode and you are good to go. Even better, make an additional parameter like “forceMaintenance” which will indeed stop VMs in order to reach Maintenance mode. Othewise will simply be in ErrorInMaintenance.
I really don’ recall having issues with 5 VMs/agent threads – and I’ve been doing a lot of maintenance with couple of hunders of VMs 2-3 years ago (ACS 4.8). This one should be reproduced first.
Regards,
Andrija Panic
Andrija Panic
Cloud Architect
s: +44 20 3603 0540 | m: +381 69 272 3690
e: andrija.panic@shapeblue.com | w: www.shapeblue.com | t: @shapeblue
a: Amadeus House, Floral Street, London WC2E 9DPUK
Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error.
Find out more about ShapeBlue and our range of CloudStack related services:
IaaS Cloud Design & Build | CSForge - rapid IaaS deployment framework
CloudStack Consulting | CloudStack Software Engineering
CloudStack Infrastructure Support | CloudStack Bootcamp Training Courses
I think @andrijapanicsb 's suggestion is good. Suppose we have a new parameter forceMaintenance in the command
(1) if there are vms running on the host. if there is no any other server in Up status and Enabled state in the cluster
(1.1) if forceMaintenance = true, stop all vms
(1.2) if forceMaintenance = false, throw exception, host is put to ErrorInMaintenance or Up status.
(2) if there are other servers in the cluster, all vms will be migrated away from the host
(2.1) if all vm migrations succeed, then host is put to Maintenance.
(2.2) if vm migration failed, then try to migrate vm to another host . If vm migration failed after 5 times (this can be configured)), then
(2.2.1) if forceMaintenance = true, schedule a task to stop/start the vm.
(2.2.2) if forceMaintenance = false, throw exception, host is put to ErrorInMaintenance.
iso could not be mounted or storage pool on destination host, i dont know why this is a problem, manually mounting was no problem. maybe anyone has information about that?
if QEMU or Host Version version are different machine type will change the flags <type arch='x86_64' machine='pc-i440fx-rhel7.6.0'>hvm</type>
i think this should be on view of the infrastructure admin.
@weizhouapache that sounds OK to me - I assume you handle capacity issues on a per VM basis.
@svenvogel 2.2.1 - if VM can't be live migrated - then stop it and start on another host to avoid permanent downtime - makes sense perfectly (if forceMaint=true)
@svenvogel if vm cannot be migrated after 5 times, to continue with the maintenance (because forceMaintenance is true), we need to stop it and start it on another server. make sense ?
additional we encounter the following problem.
iso could not be mounted or storage pool on destination host, i dont know why this is a problem, manually mounting was no problem. maybe anyone has information about that?
yes, it is one root cause of failed migration.
if QEMU or Host Version version are different machine type will change the flags <type arch='x86_64' machine='pc-i440fx-rhel7.6.0'>hvm</type>
i think this should be on view of the infrastructure admin.
If hosts have different cpu model or qemu version, they should use custom cpu or cpu flags. It is not an issue in my point of view.
Agree on that last point of QEMU or HOST versions - not an issue and has been like that forever (nor I think would be possible since that would change what the OS sees and might crash it).
@andrijapanicsb “forceMaintenance” is something that could help indeed; in some specific corner cases it would be interesting to have such a workaround.
I believe the biggest problem I saw was VM crashing due to qemu bugs/issue (i.e. recently saw this one “qemu-kvm general protection error in libtcmalloc.so.4.4.5”) – can’t speak for other issues, since I don’t recall having them with ACS 4.5/4.8 with Ubuntu 14.04 (qemu 2.0 initially, later upgraded to 2.5) If not mistaken, there is indeed a behavior that if there is no enough capacities in the cluster (test with a single KVM host in the cluster), the VMs will be stopped – and that is a thing to change in my opinion. Maintenance should fail and host should be in ErrorInMaintenance mode. If you want to do maintenance of that host, put the storage into the maintenance mode and you are good to go. Even better, make an additional parameter like “forceMaintenance” which will indeed stop VMs in order to reach Maintenance mode. Othewise will simply be in ErrorInMaintenance.
My 2 cents - in case of single host adding forceMaintenance is really going to complicate code unnecessarily. Marking host to maintenance and migration jobs for VMs are separate background tasks. Putting a host into maintenance is not going to be a frequent operation inmho worth the code complexity.
Perhaps sticking to the general theory - If Migrations cannot be completed and host cannot be put to maintenance safely, we put the host to ErrorInMaintenance state. At the same time we log/throw exception for informing the admins.
Admins can put the VMs off or snapshot or whatever works best - then they can manually shutdown all VMs on a host as needed and retry maintenance transition.
vm is stopped due to some cloudstack bugs. for example, when we put a
host to maintenance, the vm will be stopped if (1) no other host is Up in
same cluster, or (2) vm migration fails and no retry in cloudstack, or (3)
multiple vms are migrated to same destination at the same time but there is
no enough memory on the destination.
(1) has been tracked in #3707 and discussed by some comments in this ticket.
(2) is changed in #3425 but not done.
(3) is fixed by #3727 and #3728. which caused crashed vm in host maintenance on our platforms.
changed the title [-]VM stopped/crashing while Migration with Maintenance Mode (KVM)[/-][+]VM stopped while Migration with Maintenance Mode (KVM)[/+]on Mar 6, 2020
@rohityadavcloud@svenvogel should be fixed by PR #4212 which gives autonomy for admins to choose a strategy for such VMs, via global settings name host.maintenance.local.storage.strategy.
With that PR Admins can choose (wisely and knowing the eventual risks of each option) between:
error in maintenance when there are local storage VMs
stop local storage VMs and put in maintenance
or. migrate local storage VMs and put it in maintenance
Might require some upgrades on CloudStack documentation thought.
I would be +1 on closing this issue. Any thoughts @svenvogel?
Activity
svenvogel commentedon Nov 26, 2019
@ustcweizhou do you have some idea how we can these part 3?
andrijapanicsb commentedon Nov 26, 2019
weizhouapache commentedon Nov 27, 2019
@svenvogel @andrijapanicsb
I think @andrijapanicsb 's suggestion is good. Suppose we have a new parameter forceMaintenance in the command
(1) if there are vms running on the host. if there is no any other server in Up status and Enabled state in the cluster
(1.1) if forceMaintenance = true, stop all vms
(1.2) if forceMaintenance = false, throw exception, host is put to ErrorInMaintenance or Up status.
(2) if there are other servers in the cluster, all vms will be migrated away from the host
(2.1) if all vm migrations succeed, then host is put to Maintenance.
(2.2) if vm migration failed, then try to migrate vm to another host . If vm migration failed after 5 times (this can be configured)), then
(2.2.1) if forceMaintenance = true, schedule a task to stop/start the vm.
(2.2.2) if forceMaintenance = false, throw exception, host is put to ErrorInMaintenance.
any suggestion ?
svenvogel commentedon Nov 27, 2019
@ustcweizhou @andrijapanicsb i think this sounds good.
one question.
@ustcweizhou why we should stop and start them?
additional we encounter the following problem.
<type arch='x86_64' machine='pc-i440fx-rhel7.6.0'>hvm</type>i think this should be on view of the infrastructure admin.
andrijapanicsb commentedon Nov 27, 2019
@weizhouapache that sounds OK to me - I assume you handle capacity issues on a per VM basis.
@svenvogel 2.2.1 - if VM can't be live migrated - then stop it and start on another host to avoid permanent downtime - makes sense perfectly (if forceMaint=true)
andrijapanicsb commentedon Nov 27, 2019
CC @anuragaw since you were aware of the issue and want to review any code produced...
andrijapanicsb commentedon Nov 27, 2019
CC @rhtyd @PaulAngus @nvazquez
weizhouapache commentedon Nov 27, 2019
@svenvogel if vm cannot be migrated after 5 times, to continue with the maintenance (because forceMaintenance is true), we need to stop it and start it on another server. make sense ?
yes, it is one root cause of failed migration.
If hosts have different cpu model or qemu version, they should use custom cpu or cpu flags. It is not an issue in my point of view.
andrijapanicsb commentedon Nov 27, 2019
Agree on that last point of QEMU or HOST versions - not an issue and has been like that forever (nor I think would be possible since that would change what the OS sees and might crash it).
svenvogel commentedon Nov 27, 2019
@andrijapanicsb @ustcweizhou yes make sense. Agree. now i understand it.
GabrielBrascher commentedon Nov 27, 2019
@andrijapanicsb “forceMaintenance” is something that could help indeed; in some specific corner cases it would be interesting to have such a workaround.
anuragaw commentedon Nov 27, 2019
My 2 cents - in case of single host adding forceMaintenance is really going to complicate code unnecessarily. Marking host to maintenance and migration jobs for VMs are separate background tasks. Putting a host into maintenance is not going to be a frequent operation inmho worth the code complexity.
Perhaps sticking to the general theory -
If Migrations cannot be completed and host cannot be put to maintenance safely, we put the host to ErrorInMaintenance state. At the same time we log/throw exception for informing the admins.Admins can put the VMs off or snapshot or whatever works best - then they can manually shutdown all VMs on a host as needed and retry maintenance transition.
Thoughts @andrijapanicsb , @svenvogel , @GabrielBrascher , @ustcweizhou?
weizhouapache commentedon Nov 27, 2019
let's wait @anuragaw 's PR #3425 to be done.
3 remaining items
weizhouapache commentedon Dec 3, 2019
@svenvogel @andrijapanicsb
(1) has been tracked in #3707 and discussed by some comments in this ticket.
(2) is changed in #3425 but not done.
(3) is fixed by #3727 and #3728. which caused crashed vm in host maintenance on our platforms.
yadvr commentedon Mar 3, 2020
Is this fixed/addressed @svenvogel @weizhouapache @andrijapanicsb ?
svenvogel commentedon Mar 6, 2020
@rhtyd we will test this in the next week. i lost this in our track.
[-]VM stopped/crashing while Migration with Maintenance Mode (KVM)[/-][+]VM stopped while Migration with Maintenance Mode (KVM)[/+]svenvogel commentedon Mar 6, 2020
@andrijapanicsb changed. yes it stopped the VM thats right.
DaanHoogland commentedon Dec 11, 2020
this is on hold it seems, any volunteers to specify this and #3707 to sum up the desired outcome ? it seems to me there are a lot of ideas here but no consensus on functionality, @svenvogel @andrijapanicsb @weizhouapache @rhtyd @borisstoyanov @GabrielBrascher @anuragaw .
GabrielBrascher commentedon Dec 15, 2020
My 2 cents on this one would be to add a force maintenance parameter or global settings (I would prefer a force parameter though).
Here follows a draft of a proposal for this issue:
PR #4212 is focused on migrating or stopping local storage VMs of a host put in maintenance. However, it holds some similarities with this issue.
yadvr commentedon Jun 30, 2022
is this still an issue @GabrielBrascher @svenvogel and others?
GabrielBrascher commentedon Jun 30, 2022
@rohityadavcloud @svenvogel should be fixed by PR #4212 which gives autonomy for admins to choose a strategy for such VMs, via global settings name
host.maintenance.local.storage.strategy.With that PR Admins can choose (wisely and knowing the eventual risks of each option) between:
Might require some upgrades on CloudStack documentation thought.
I would be +1 on closing this issue. Any thoughts @svenvogel?
yadvr commentedon Aug 17, 2022
As per comment on PR, it appears fixed by #4534 and #4212 is also merged
Pl re-open if we got that wrong, thanks.