[PATCH] detect-virt: do not return exit failure code when the state is none

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently the systemd-detect-virt returns exit failure code when it
detected none state. But actually the none state is still a valid
state but not a process failed.

This patch changes the logic to return success code when the state
is none. It can avoid that subsequent activity is blocked by the
failure code of systemd-detect-virt process.

For example:
 # Hotplug physical memory
 SUBSYSTEM=="memory", ACTION=="add", PROGRAM="/usr/bin/systemd-detect-virt", \
 RESULT!="zvm", ATTR{state}=="offline", ATTR{state}="online_movable", \
 TAG+="tmpfs"

In the above rule, the ATTR{state} can not be set to "online_movable"
when the systemd-detect-virt returns exit failure on a phyical
environment.

Cc: Michal Hocko <mhocko at suse.com> 
Cc: Franck Bui <fbui at suse.com> 
Cc: GM Chen <guomin.chen at suse.com>
Signed-off-by: "Lee, Chun-Yi" <jlee at suse.com>
---
 src/detect-virt/detect-virt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/detect-virt/detect-virt.c b/src/detect-virt/detect-virt.c
index 197e526b0..71f0d1817 100644
--- a/src/detect-virt/detect-virt.c
+++ b/src/detect-virt/detect-virt.c
@@ -178,5 +178,5 @@ int main(int argc, char *argv[]) {
         if (!arg_quiet)
                 puts(virtualization_to_string(r));
 
-        return r != VIRTUALIZATION_NONE ? EXIT_SUCCESS : EXIT_FAILURE;
+        return EXIT_SUCCESS;
 }
-- 
2.12.3



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux