Skip to content

misc: vmm: add streamlined logging to every event #7484#7505

Closed
JuKu wants to merge 1 commit intocloud-hypervisor:mainfrom
JuKu:github-issue-7484
Closed

misc: vmm: add streamlined logging to every event #7484#7505
JuKu wants to merge 1 commit intocloud-hypervisor:mainfrom
JuKu:github-issue-7484

Conversation

@JuKu
Copy link

@JuKu JuKu commented Nov 25, 2025

Add streamlined logging to every event.
#7484

@JuKu JuKu requested a review from a team as a code owner November 25, 2025 02:43
@rbradford
Copy link
Member

I'm not sure if this is really what we want to do - what's your use case for this?

Copy link
Member

@phip1611 phip1611 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally I think it is beneficial if we unify the usage of event! by adding it to every API event and pair it with a matching info!, therefore I created #7484 as you already noticed. Thanks for addressing this!

You missed one aspect of the ticket tho. A few event! calls are missing for some VM events and you didn't add them yet unfortunately. For example, vm_add_fs doesn't emit an event but I think it should. (I think this is just missing so far and was never left out intentionally?).

Further, there is a typo in the commit message. Its vmm not vvm. Please read and accept our contributing guidelines regarding several style and commit checks.

}

fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
info!("vdpa reset: id={}", self.id);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not next to the event! line. It could be that we log here but not emit an event in the following as we fail in the following lines and return early

pub const HANDLED_SIGNALS: [i32; 2] = [SIGTERM, SIGINT];

/// Get VM identifier (UUID if available, otherwise process ID)
fn vm_id(&self) -> String {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this information in its current form is useful at all.

One Cloud Hypervisor instance can only run exactly one VM. Giving names and UUIDs to VMMs should be up to the management layer (i.e., libvirt). I'm in favor of removing this.


fn vm_pause(&mut self) -> result::Result<(), VmError> {
let state = self.vm.as_ref().and_then(|vm| vm.get_state().ok());
info!("request to pause VM: {}, state={:?}", self.vm_id(), state);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
info!("request to pause VM: {}, state={:?}", self.vm_id(), state);
info!("request to pause VM: old_state={:?}", state);

No need to print any VM id here. We can only stop the VM, not any VM as there is exactly one.


fn vm_resume(&mut self) -> result::Result<(), VmError> {
let state = self.vm.as_ref().and_then(|vm| vm.get_state().ok());
info!("request to resume VM: {}, state={:?}", self.vm_id(), state);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

}

/// Get VM identifier (UUID if available, otherwise process ID)
fn vm_id(&self) -> String {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, duplicated code?

@phip1611 phip1611 changed the title misc: vvm: add streamlined logging to every event #7484 misc: vmm: add streamlined logging to every event #7484 Nov 25, 2025
@rbradford
Copy link
Member

I think we should close this PR as #7512 has landed now and that has a generalised solution to what I think this PR was trying to achieve?

@phip1611
Copy link
Member

I think we should close this PR as #7512 has landed now and that has a generalised solution to what I think this PR was trying to achieve?

yes, sounds good!

@rbradford rbradford closed this Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants