source: trunk/vmctl/vmctl @ 59

Last change on this file since 59 was 33, checked in by zev, 17 years ago

r22250@galvatron: zev | 2007-07-23 00:46:21 -0400

  • prelimary work on server-side installer script from before I got distracted trying to get block-attach to actually work
  • Property svn:executable set to *
File size: 644 bytes
Line 
1#!/usr/bin/env perl
2use warnings;
3use strict;
4
5my $subcmd = shift;
6
7my %cmds = ("install" => \&install);
8
9
10if (exists $cmds{$subcmd}) {
11  $cmds{$subcmd}->();
12} else {
13  print "No such subcommand: '$subcmd'\n";
14}
15
16sub install {
17  my ($installer, $host_device) = @ARGV;
18  $host_device =~ s#^/dev/##;
19  my $installer_hostname = "magic";
20  my $guest_dev = $host_device;
21  $guest_dev =~ tr#/#_#;
22
23  run("xm", "block-attach", $installer, "phys:$host_device", "$guest_dev", "rw");
24  run("remctl", $installer_hostname, "installer", "install", $guest_dev);
25  run("xm", "block-detach", $installer, $guest_dev, "rw");
26}
27
28sub run {
29  system("echo", @_);
30}
Note: See TracBrowser for help on using the repository browser.