-
Notifications
You must be signed in to change notification settings - Fork 307
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
[ENHANCEMENT] Harvester supports clear VMI objects automatically when VM is power-off from inside VM #5081
Comments
cc @bk201 @markhillgit @ibrokethecloud @Vicente-Cheng @starbops : welcome your feedback on this enhancement. |
gentle ping @w13915984028, wondering which Harvester version did you used ? Since I've done some research based on the lastest commit in master branch and found that below resources are all correctly released.
c.c. @FrankYang0529, @bk201 Here's how I conduct the checksI've created a Harvester with one node on my laptop and created one VM. vm descriptionName: test Namespace: default Labels: harvesterhci.io/creator=harvester harvesterhci.io/os=ubuntu Annotations: harvesterhci.io/vmRunStrategy: RerunOnFailure harvesterhci.io/volumeClaimTemplates: [{"metadata":{"name":"test-disk-0-u0qfn","annotations":{"harvesterhci.io/imageId":"default/image-kh6hj"}},"spec":{"accessModes":["ReadWrit... kubevirt.io/latest-observed-api-version: v1 kubevirt.io/storage-observed-api-version: v1 network.harvesterhci.io/ips: [] API Version: kubevirt.io/v1 Kind: VirtualMachine Metadata: Creation Timestamp: 2024-02-21T01:47:04Z Finalizers: kubevirt.io/virtualMachineControllerFinalize harvesterhci.io/VMController.UnsetOwnerOfPVCs Generation: 2 Resource Version: 3598009 UID: f1b74817-4221-4304-b904-3d185d9c61bf Spec: Run Strategy: RerunOnFailure Template: Metadata: Annotations: harvesterhci.io/sshNames: [] Creation Timestamp: Labels: harvesterhci.io/vmName: test Spec: Affinity: Node Affinity: Required During Scheduling Ignored During Execution: Node Selector Terms: Match Expressions: Key: network.harvesterhci.io/mgmt Operator: In Values: true Architecture: amd64 Domain: Cpu: Cores: 2 Sockets: 1 Threads: 1 Devices: Disks: Boot Order: 1 Disk: Bus: virtio Name: disk-0 Disk: Bus: virtio Name: cloudinitdisk Inputs: Bus: usb Name: tablet Type: tablet Interfaces: Bridge: Mac Address: 76:a3:07:37:03:4b Model: virtio Name: default Features: Acpi: Enabled: true Machine: Type: q35 Memory: Guest: 8092Mi Resources: Limits: Cpu: 2 Memory: 8Gi Requests: Cpu: 125m Memory: 5461Mi Eviction Strategy: LiveMigrate Hostname: test Networks: Multus: Network Name: default/my-dhcp Name: default Termination Grace Period Seconds: 120 Volumes: Name: disk-0 Persistent Volume Claim: Claim Name: test-disk-0-u0qfn Cloud Init No Cloud: Network Data Secret Ref: Name: test-8vknj Secret Ref: Name: test-8vknj Name: cloudinitdisk Status: Conditions: Last Probe Time: Last Transition Time: 2024-02-21T03:56:46Z Status: True Type: Ready Last Probe Time: Last Transition Time: Status: True Type: LiveMigratable Created: true Desired Generation: 2 Observed Generation: 2 Printable Status: Running Ready: true Volume Snapshot Statuses: Enabled: false Name: disk-0 Reason: 2 matching VolumeSnapshotClasses for longhorn-image-kh6hj Enabled: false Name: cloudinitdisk Reason: Snapshot is not supported for this volumeSource type [cloudinitdisk] Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal SuccessfulCreate 13m (x3 over 143m) virtualmachine-controller Started the virtual machine by creating the new virtual machine instance test Normal SuccessfulDelete 13m virtualmachine-controller Stopped the virtual machine by deleting the virtual machine instance 335f75ea-3756-487e-8d50-0f5d130eec1d And then run
my dhcp settingsoption broadcast-address 192.168.100.255; option routers 192.168.100.1; option subnet-mask 255.255.255.0; |
@brandboat Thanks. I double checked in Harvester v1.3.0 (with latest kubevirt), when a VM is poweroff from inside it, then: The pod is
As the pod is For IP requested from DHCP server, I am not sure it is right released after poweroff or until the lease time is due. What do you observed? Please set the lease to be e.g. 1 hour then check it. For PCI-passthrough/vgpu, I have no hardware to test yet. |
@w13915984028 Thanks for the comment,
Sorry I forgot to provide the default/max lease time in dhcpd.conf
and in the dhcp lease file (mine was in
As you can see the binding state is |
@ibrokethecloud Can you help check the vGPU/PCI device part? wonder if a completed pod still occupies resources? |
Hi @ibrokethecloud, I found after one VM with pcidevice shutdown voluntarily, the pcidevice could be assigned to another VM (by editing VM manifest, front-end prevents this). However, it makes the origin VM not able to boot up since the pcidevice is occupied by the new VM. Detailed steps:
IMHO, for the backend part, even if the power off VM pod releases the pcidevice, we maybe should prevent the pcidevice from being re-assigned to another VM, which could lead to the above situation, thanks. |
Close because the completed pod doesn't occupy the resources in the description. |
Is your enhancement related to a problem? Please describe.
When a VM is power-off from inside the VM, the corresponding VMI object is left, it is backed by a k8s POD.
This POD has
In the scenario like IaaS, when a user power-off it's VM, it is surely better to remove the VMI object.
Describe the solution you'd like
This is also a substory of #5007
Describe alternatives you've considered
Additional context
#3261
#4659
#4725
#4999
The text was updated successfully, but these errors were encountered: