1Sys::Detect::VirtualizaUtsieorn(C3o)ntributed Perl DocumSeynst:a:tDieotnect::Virtualization(3)
2
3
4

NAME

6       Sys::Detect::Virtualization - Detect if a UNIX system is running as a
7       virtual machine
8

VERSION

10       Version 0.107
11

SYNOPSIS

13           use Sys::Detect::Virtualization;
14
15           my $detector = eval { Sys::Detect::Virtualization->new() };
16           if( $@ ) {
17               print "Detector may not be supported for your platform.  Error was: $@\n";
18           }
19
20           my @found = $detector->detect();
21           if( @found ) {
22               print "Possible virtualized system.  May be running under:\n";
23               print "\t$_\n" for @found;
24           }
25

DESCRIPTION

27       This module attempts to detect whether or not a system is running as a
28       guest under virtualization, using various heuristics.
29

METHODS

31   Class Methods
32       new ( $args )
33           Construct a new detector object.  On success, returns the object.
34           On failure, dies.
35
36           This constructor will fail if the system is not running a supported
37           OS.  Currently, only Linux is supported.
38
39           $args is an optional hash reference containing additional arguments
40           for the constructor.  Currently supported are:
41
42           verbose
43               Set to 1 if we should output verbose debugging, 0 otherwise.
44               Defaults to 0.
45
46           ignore_host
47               Set to 1 if we should report no virtualization if a
48               virtualization host (as opposed to guest) is detected.
49               Defaults to 1.
50
51   Instance Methods
52       detect ( )
53           Runs detection heuristics.  Returns a list of possible
54           virtualization systems, or an empty list if none were detected.
55
56           Possible hits are returned in order of most likely to least likely.
57
58           Note that the failure to detect does NOT mean the system is not
59           virtualized -- it simply means we couldn't detect it.
60
61       guess ( )
62           Runs detection heuristics and returns a single answer based on the
63           "best guess" available.
64
65           Currently, this is defined as the virt platform with the most
66           heuristic hits.
67
68   Internal Methods
69       You probably shouldn't ever need to call these
70
71       get_detectors ( )
72           Returns a list of all detector subroutines for the given instance.
73
74       _find_bin ( $command )
75           Returns full path to given command by searching $ENV{PATH}.  If not
76           present in the path variable, the directories /usr/sbin, /usr/bin,
77           /sbin, and /bin are appended.
78
79       _fh_apply_patterns ( $fh, $patterns )
80           Check, linewise, the data from $fh against the patterns in
81           $patterns.
82
83           $patterns is a listref read pairwise.  The first item of each pair
84           is the pattern, and the second item of each pair is a list of names
85           of virt solutions detected by the pattern.
86
87       _check_command_output ( $command, $patterns )
88           Check, linewise, the output of $command against the patterns in
89           $patterns.
90
91           $patterns is a listref read pairwise.  The first item of each pair
92           is the pattern, and the second item of each pair is the name of the
93           virt solution detected by the pattern.
94
95       _check_file_contents ( $fileglob, $patterns )
96           Check, linewise, the content of each filename in $fileglob against
97           the patterns in $patterns.
98
99           $fileglob is a glob that returns zero or more filenames.
100
101           $patterns is a listref read pairwise.  The first item of each pair
102           is the pattern, and the second item of each pair is the name of the
103           virt solution detected by the pattern.
104
105       _check_path_exists ( $paths )
106           Checks for the existence of each path in $paths.
107
108           $paths is a listref read pairwise.  The first item of each pair is
109           the path name, and the second item of each pair is the name of the
110           virt solution detected by the existence of that $path.
111

AUTHOR

113       Dave O'Neill, <dmo@dmo.ca>
114

BUGS

116       Known issues:
117
118       •   No support for non-Linux platforms.  Feel free to contribute an
119           appropriate Sys::Detect::Virtualization::foo class for your
120           platform.
121
122       •   No weighting of tests so that high-confidence checks can be done
123           first.  Patches welcome.
124
125       Please report any bugs or feature requests to
126       "bug-sys-detect-virtualization at rt.cpan.org", or through the web
127       interface at
128       <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Sys-Detect-Virtualization>.
129       I will be notified, and then you'll automatically be notified of
130       progress on your bug as I make changes.
131

SUPPORT

133       You can find documentation for this module with the perldoc command.
134
135           perldoc Sys::Detect::Virtualization
136
137       You can also look for information at:
138
139       •   RT: CPAN's request tracker
140
141           <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Sys-Detect-Virtualization>
142
143       •   AnnoCPAN: Annotated CPAN documentation
144
145           <http://annocpan.org/dist/Sys-Detect-Virtualization>
146
147       •   CPAN Ratings
148
149           <http://cpanratings.perl.org/d/Sys-Detect-Virtualization>
150
151       •   Search CPAN
152
153           <http://search.cpan.org/dist/Sys-Detect-Virtualization/>
154
155       •   The author's blog
156
157           <http://www.dmo.ca/blog/>
158
160       Copyright (C) 2009 Roaring Penguin Software Inc.
161
162       This program is free software; you can redistribute it and/or modify it
163       under the terms of either: the GNU General Public License as published
164       by the Free Software Foundation; or the Artistic License.
165
166       See http://dev.perl.org/licenses/ for more information.
167
168
169
170perl v5.38.0                      2023-07-21    Sys::Detect::Virtualization(3)
Impressum