apache / cloudstack

Apache CloudStack is an opensource Infrastructure as a Service (IaaS) cloud computing platform
https://cloudstack.apache.org/
Apache License 2.0
2.09k stars 1.11k forks source link

Existing VM migrated from proxmox to cloudstack not working #7586

Closed Noelantogerorge closed 1 year ago

Noelantogerorge commented 1 year ago
ISSUE TYPE
COMPONENT NAME

iNSTANCE

CLOUDSTACK VERSION

4.18

CONFIGURATION

Advance networking

OS / ENVIRONMENT

All on Ubuntu 22.04 Cloudstack version 4.18

SUMMARY

I am trying to bring an existing VM which is running on proxmox to cloudstack. I had downloaded the qcow2 VM file and created a templete for that on cloudstack. After deploying it as VM Instane in cloudstack it is showing No bootable device. I checked the downloaded qcow2 file on kvm and it is running.

STEPS TO REPRODUCE

Try to bring a qcow2 vm img on cloudstack

EXPECTED RESULTS

VM should come up

ACTUAL RESULTS

It is showing no bootable device. I had checked with multiple files and even same file I can bring the VM on KVM

DaanHoogland commented 1 year ago

@Noelantogerorge did you try installing the qcow template file on kvm directly, or did you just verify that the original from which the tamplate was created did run? Or more general Can you give more resolution to you "STEPS TO REPRODUCE" paragraph, please? It is hard to see what went wrong (not a proxmox user myself)

kiranchavala commented 1 year ago

@Noelantogerorge

Could you also please provide the complete management server log

Noelantogerorge commented 1 year ago

@DaanHoogland I had downloaded qcow2 file from proxmox and created a template of it on cloudstack Then created a new instance of that template. After instance is up when I check the console it is showing No bootdevice to load

So inorder to make sure my qcow2 image is not having any issue I just use virsh-install command to bring this qcow2 img vm on KVM directly. I could see that VM started and I was able to login to that guest VM

Please find me management and Agent log attached. Logs.zip

Noelantogerorge commented 1 year ago

Below is my command to run the qcow2 img on kvm virt-install \ --name test \ --ram 4090 \ --vcpus 2 \ --disk path=/data/dgs/test.qcow2,format=qcow2 \ --graphics none \ --console pty,target_type=serial \ --os-type linux \ --os-variant ubuntu22.04 \ --import

DaanHoogland commented 1 year ago

I had downloaded qcow2 file from proxmox and created a template of it on cloudstack Then created a new instance of that template. After instance is up when I check the console it is showing No bootdevice to load

So inorder to make sure my qcow2 image is not having any issue I just use virsh-install command to bring this qcow2 img vm on KVM directly. I could see that VM started and I was able to login to that guest VM

Can you check if it is BIOS or UEFI? that is not automatically detected by cloudstack and might be a reason booting fails.

Noelantogerorge commented 1 year ago

its UEFI - secure boot

Noelantogerorge commented 1 year ago

Tried with advance boot option and bood mode to uefi - secure. but didn't start the VM as host doen't support uefi deployement. Cannot deploy to specified host as host does n't support uefi vm deployment, returning. I will check how to enable uefi on kvm host. If you have any documentation please share me

kiranchavala commented 1 year ago

@Noelantogerorge

  1. Try the following steps

Edit the file /etc/libvirt/qemu.conf and add the following line

nvram = ["/usr/share/OVMF/OVMF_CODE.secboot.fd:/usr/share/OVMF/OVMF_VARS.fd"]

  1. Restart the cloud stack agent and libvirtd or force reconnect the host

service libvirtd restart service cloudstack-agent restart

  1. Check the db entry value for host.uefi.enable

mysql> select * from host_details; +----+---------+----------------------------------------------------+------------------------------------------------------+ | id | host_id | name | value | +----+---------+----------------------------------------------------+------------------------------------------------------+ | 1 | 1 | Host.OS.Kernel.Version | 5.15.0-35-generic | | 2 | 1 | com.cloud.network.Networks.RouterPrivateIpStrategy | HostLocal | | 3 | 1 | Host.OS.Version | 22.04 | | 4 | 1 | host.volume.encryption | true | | 5 | 1 | secured | true | | 6 | 1 | Host.OS | Ubuntu | | 8 | 1 | password | Nl8+U+aEYhs7XQmf6Jz9Q6b5JmGqbO4fvV3xfDT+KgNYfd19g8us | | 14 | 1 | username | root | | 28 | 1 | host.uefi.enable | true | +----+---------+----------------------------------------------------+------------------------------------------------------+ 9 rows in set (0.00 sec)

  1. Register a uefi template

https://repo.almalinux.org/almalinux/8/cloud/x86_64/images/

  1. Try to deploy a vm

If you are still facing the issue, then please try with Centos 8 host/ instead of Ubuntu 22.04.2 as i think it could be a limitation

http://docs.cloudstack.apache.org/en/latest/installguide/hypervisor/kvm.html?highlight=uefi#uefi-legacy-secureboot

Please refer the Limitations

https://cwiki.apache.org/confluence/display/CLOUDSTACK/Enable+UEFI+booting+for+Instance

Noelantogerorge commented 1 year ago

@kiranchavala I had deployed these changes and I could able to spin up the instance using advance option as UEFI secure. Instance spinned up but still same error on console of VM I am getting no bootable device image

kiranchavala commented 1 year ago

Hi @Noelantogerorge

Could you check if you are able to boot a alma linux image

https://repo.almalinux.org/almalinux/8/cloud/x86_64/images/

Noelantogerorge commented 1 year ago

hi @kiranchavala

I added a templete of https://repo.almalinux.org/almalinux/8/cloud/x86_64/images/AlmaLinux-8-GenericCloud-UEFI-latest.x86_64.qcow2 and try to start a instance with uefi secure ends up in below screen

image

Noelantogerorge commented 1 year ago

@kiranchavala do we need to create uefi.properties file as discussed on this session https://github.com/apache/cloudstack/pull/3638

Noelantogerorge commented 1 year ago

Hi, I had detached disk from that VM and attached to another running VM and I could find that disk is not showing any partition. please find the below screenshot and high lighted part is the disk of migrated VM

instance

I had tried with other VM also even I downloaded vmdk file from VMware ESXI server and converted to qcow2 format. I can easly spin up it on KVM and also bring that qcow2 img on proxmox but on cloudstack it is showing same issue no bootable disk

kiranchavala commented 1 year ago

@Noelantogerorge

I tested the uefi issue only on Centos 7. I believe there are issues with ubuntu 22.04 and booting UEFI images

yes we need to create the uefiproperties file

  1. Create a file with the following content /etc/cloudstack/agent/uefi.properties

guest.nvram.template.secure=/usr/share/edk2/ovmf/OVMF_VARS.secboot.fd guest.nvram.template.legacy=/usr/share/edk2/ovmf/OVMF_VARS.fd guest.loader.secure=/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd guest.nvram.path=/var/lib/libvirt/qemu/nvram guest.loader.legacy=/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd

  1. Edit the file /etc/libvirt/qemu.conf and add the following line

nvram = ["/usr/share/OVMF/OVMF_CODE.secboot.fd:/usr/share/OVMF/OVMF_VARS.fd"]

  1. Restart the cloud stack agent and libvirtd or force reconnect the host

service libvirtd restart service cloudstack-agent restart

Noelantogerorge commented 1 year ago

@kiranchavala Hi Thank for the update... Today on a test machine with 4.17 version of cloudstack I could easly deploy this same qcow2 img. Its working fine. I was able to deploy in uefi mode and also on normal boot mode. KVM is on ubuntu 22.04.. I think some setting on my production enviornment is causing the issue. I can't able to figure it out what might be the issue.

DaanHoogland commented 1 year ago

@Noelantogerorge is that production env newer than your test env? (i.e. 4.18 vs 4.17?) In other words would you say this is a regression in 4.18?

Noelantogerorge commented 1 year ago

Hi @DaanHoogland and @kiranchavala My production is on 4.18 and yesterday I test it on 4.17. Today I had started a 4.18 test enviornment and tried the same qcow2 img and that too worked. I think some setting on my production enviornment is causing the issue. I had cross check the global setings with two enviornment and couldn't get any change. Trying to figure out what might be the issue as mgmt and agent log is not showing much data.

Noelantogerorge commented 1 year ago

@DaanHoogland have you ever gone through below error while migrating VM from one host to another

Error : Exception during migrate: org.libvirt.LibvirtException: Cannot get interface MTU on 'brenp21-774': No such device

I was trying to move a vm from one host to another but it is hsowing this error. Didn't get much document about configuring this migration so I belive cloudstack should tack care of migration when I click migrate button

DaanHoogland commented 1 year ago

@Noelantogerorge , no i haven't is that bridge part of your host configuration or is this created by proxmox? Also is this still the migration from proxmox to xloudstack problem or are you talking to a migration for a fully ACS managed virtual machine?

Noelantogerorge commented 1 year ago

@DaanHoogland No, I have 2 host connected. This is not part of migration from proxmox to cloudstack.No issues I think my network cofiguration mismatch on KVM

Noelantogerorge commented 1 year ago

@DaanHoogland and @kiranchavala I was able to solve the issue. qcow2 img was working fine but when I register it as a template it is getting corrupted and so instance is not comming up. I figure out that I was using a repo to register template and repo root location was on our SAS drive. So I change the repo root location to that system root drive and copied the qcow2 img on root drive and registered it. It was working. No idea why it causes corruption when copying from SAS as same drive is used on proxmox. Anyway it is cleared now.. Thank you so much for the support....