Skip to contentSkip to conversation

lib/tst_virt.c: Add fallback when not using Microsoft Hyper-V hypervisor

PATCH New Yang Xu 4 participants 5 messages Jun 10, 2021 Library code

lore
Share & tools
lore

Yang Xu

author
#0 lore raw

PATCH 1/1 lib/tst_virt.c: Add fallback when not using Microsoft Hyper-V hypervisor

If we don't use Microsoft Hyper-V hypervisorm, getrusage04 will report the following error:

getrusage04    1  TBROK  :  tst_virt.c:175: invalid virt_type flag: 6
getrusage04    2  TBROK  :  tst_virt.c:175: Remaining cases broken

We should add is_hyperv() function when try_systemd_detect_virt returns -1. But it is a bit complexd according to systemd-detect-virt implementation[1]. Microsoft Hyper-V hypervisor detection has been introduced since long time ago, most system should support it.

[1]https://github.com/systemd/systemd/blob/main/src/basic/virt.c

---
 lib/tst_virt.c | 1 +
 1 file changed, 1 insertion(+)
lib/tst_virt.c +1 -0
index 14c4d526c..d23d7f564 100644
@@ -166,6 +166,7 @@ int tst_is_virt(int virt_type)
 	case VIRT_IBMZ_LPAR:
 	case VIRT_IBMZ_ZVM:
 		return is_ibmz(virt_type);
+	case VIRT_HYPERV:
 	case VIRT_OTHER:
 		return 0;
 	}
Signature · 1 line
2.23.0
#1 lore raw

PATCH 1/1 lib/tst_virt.c: Add fallback when not using Microsoft Hyper-V hypervisor

Quoted 1 line · Yang Xu

If we don't use Microsoft Hyper-V hypervisorm, getrusage04 will report the

s/hypervisorm/hypervisor/

Quoted 6 lines

following error:

getrusage04    1  TBROK  :  tst_virt.c:175: invalid virt_type flag: 6
getrusage04    2  TBROK  :  tst_virt.c:175: Remaining cases broken

We should add is_hyperv() function when try_systemd_detect_virt returns -1. But it is a bit complexd according to systemd-detect-virt implementation[1].

s/complexd/complex/

Quoted 7 lines

Microsoft Hyper-V hypervisor detection has been introduced since long time ago, most system should support it.

[1]https://github.com/systemd/systemd/blob/main/src/basic/virt.c

Thanks for fixing this.

Best regards,
Krzysztof

Quoted 17 lines
---
 lib/tst_virt.c | 1 +
 1 file changed, 1 insertion(+)
lib/tst_virt.c +1 -0
index 14c4d526c..d23d7f564 100644
@@ -166,6 +166,7 @@ int tst_is_virt(int virt_type)
 	case VIRT_IBMZ_LPAR:
 	case VIRT_IBMZ_ZVM:
 		return is_ibmz(virt_type);
+	case VIRT_HYPERV:
 	case VIRT_OTHER:
 		return 0;
 	}
#2 lore raw

PATCH 1/1 lib/tst_virt.c: Add fallback when not using Microsoft Hyper-V hypervisor

Hi all,

Quoted 4 lines · Yang Xu
Quoted 1 line

If we don't use Microsoft Hyper-V hypervisorm, getrusage04 will report the

s/hypervisorm/hypervisor/

+1

Quoted 8 lines
Quoted 6 lines

following error:

getrusage04    1  TBROK  :  tst_virt.c:175: invalid virt_type flag: 6
getrusage04    2  TBROK  :  tst_virt.c:175: Remaining cases broken

We should add is_hyperv() function when try_systemd_detect_virt returns -1. But it is a bit complexd according to systemd-detect-virt implementation[1].

s/complexd/complex/

+1

Thanks!

Kind regards,
Petr

#3 lore raw

PATCH 1/1 lib/tst_virt.c: Add fallback when not using Microsoft Hyper-V hypervisor

Hi All
Thanks for your review. I have merged this patch with correcting two typos.

Best Regards
Yang Xu

Quoted 24 lines

Hi all,

Quoted 4 lines · Yang Xu
Quoted 1 line

If we don't use Microsoft Hyper-V hypervisorm, getrusage04 will report the

s/hypervisorm/hypervisor/

+1

Quoted 8 lines
Quoted 6 lines

following error:

getrusage04    1  TBROK  :  tst_virt.c:175: invalid virt_type flag: 6
getrusage04    2  TBROK  :  tst_virt.c:175: Remaining cases broken

We should add is_hyperv() function when try_systemd_detect_virt returns -1. But it is a bit complexd according to systemd-detect-virt implementation[1].

s/complexd/complex/

+1

Thanks!

Kind regards,
Petr

#4 lore raw

PATCH 1/1 lib/tst_virt.c: Add fallback when not using Microsoft Hyper-V hypervisor

In reply to Yang Xu

Hi!

Quoted 9 lines

If we don't use Microsoft Hyper-V hypervisorm, getrusage04 will report the following error:

getrusage04    1  TBROK  :  tst_virt.c:175: invalid virt_type flag: 6
getrusage04    2  TBROK  :  tst_virt.c:175: Remaining cases broken

We should add is_hyperv() function when try_systemd_detect_virt returns -1. But it is a bit complexd according to systemd-detect-virt implementation[1]. Microsoft Hyper-V hypervisor detection has been introduced since long time ago, most system should support it.

Sorry for missing this, Reviewed-by: Cyril Hrubis <[email protected]>

Signature · 2 lines
Cyril Hrubis
[email protected]