summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2012-03-16 11:47:25 -0700
committerStephen Hemminger <shemminger@vyatta.com>2012-03-16 11:47:25 -0700
commit868f348533d99b05782cd8bfedb18b9f91b393bc (patch)
treecccce849abefc47dd69ba31597428a929dd28c96
parentf072c4f6fc6d9692c558b786c5b6a3f48de7b297 (diff)
downloadvyatta-biosdevname-868f348533d99b05782cd8bfedb18b9f91b393bc.tar.gz
vyatta-biosdevname-868f348533d99b05782cd8bfedb18b9f91b393bc.zip
Add flag to allow running in Vm
There are cases (like SRIOV or pci pass through) where it might be worth running in VM.
-rw-r--r--src/bios_dev_name.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/bios_dev_name.c b/src/bios_dev_name.c
index e2f8454..dd47fc3 100644
--- a/src/bios_dev_name.c
+++ b/src/bios_dev_name.c
@@ -15,6 +15,7 @@
static struct bios_dev_name_opts opts;
int nopirq;
+int allow_vm;
int smver_mjr;
int smver_mnr;
@@ -27,6 +28,7 @@ static void usage(void)
fprintf(stderr, " --policy [physical | all_ethN ]\n");
fprintf(stderr, " --prefix [string] string use for embedded NICs (default='em')\n");
fprintf(stderr, " --smbios [x.y] Require SMBIOS x.y or greater\n");
+ fprintf(stderr, " --invm Still run in VM\n");
fprintf(stderr, " --nopirq Don't use $PIR table for slot numbers\n");
fprintf(stderr, " Example: biosdevname -i eth0\n");
fprintf(stderr, " returns: em1\n");
@@ -61,6 +63,7 @@ parse_opts(int argc, char **argv)
{"policy", required_argument, 0, 'p'},
{"prefix", required_argument, 0, 'P'},
{"nopirq", no_argument, 0, 'x'},
+ {"invm", no_argument, 0, 'V'},
{"smbios", required_argument, 0, 's'},
{0, 0, 0, 0}
};
@@ -88,6 +91,9 @@ parse_opts(int argc, char **argv)
case 'x':
nopirq = 1;
break;
+ case 'V':
+ allow_vm = 1;
+ break;
default:
usage();
exit(1);
@@ -152,7 +158,7 @@ int main(int argc, char *argv[])
if (!running_as_root())
exit(3);
- if (running_in_virtual_machine())
+ if (!allow_vm && running_in_virtual_machine())
exit(4);
cookie = setup_bios_devices(opts.namingpolicy, opts.prefix);
if (!cookie) {