Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Better support for dynamic changes to page event callbacks
[palacios.git] / v3_config_guest.pl
index a925cc7..04180a6 100755 (executable)
@@ -9,12 +9,12 @@ These guests *should* work for any host embedding (e.g., Kitten) but
 there may be hidden Linux assumptions.
 
 The tool assumes you have already built Palacios, the Linux embedding,
-and the Linux user-sapce tools.  If you haven't done this, hit CTRL-C
+and the Linux user-space tools.  If you haven't done this, hit CTRL-C
 now, configure and build Palacios, the user-space tools, and run
-v3_config.pl.
+v3_config_v3vee.pl.
 
 This tool also assumes that you have the environment produced by
-v3_config.pl sourced:
+v3_config_v3vee.pl sourced:
 
   source ./ENV
 
@@ -83,6 +83,7 @@ if ($config{numcores}>1) {
   }
 }
 
+do_swapping(\%config, $pdir);
 
 print "We will give your guest the default performance tuning characteristics\n";
 $config{perftune_block} .= <<PERFTUNE
@@ -154,7 +155,7 @@ if (is_palacios_core_feature_enabled($pdir,"V3_CONFIG_MPTABLE")) {
   print "We will include a classic MPTABLE constructor to describe your machine to the guest\n";
   add_device(\%config, "MPTABLE", "mptable");
 } else {
-  if ($numcores>1 &&  is_palacios_core_feature_enabled($pdir,"V3_CONFIG_BOCHSBIOS")) {
+  if ($config{numcores}>1 &&  is_palacios_core_feature_enabled($pdir,"V3_CONFIG_BOCHSBIOS")) {
     print "This is a multicore guest, and your Palacios configuration uses the classic BOCHS BIOS\n".
       "but does not have the MPTABLE constructor enabled...  This guest will almost\n".
        "certainly fail to work.  Do you want to continue anyway? [n] :";
@@ -191,6 +192,8 @@ print "\nWe will now consider storage controllers and devices.\n\n";
 do_storage(\%config, $pdir, $dir, $name, "pci0", "southbridge");
 
 
+
+
 #
 # Network interfaces (attached to PCI bus)
 #
@@ -200,6 +203,33 @@ do_network(\%config, $pdir, $dir, $name, "pci0", "southbridge");
 
 
 #
+# Sanity-check - is there something bootable?
+#
+#
+if (!($config{havecd} && !($config{havehd}))) {
+  print "The guest's storage configuration does not have either a CD or an HD.  \n";
+  print "This means the guest BIOS will have nothing local to boot.  \n";
+  if (!($config{havenic})) { 
+    print "The guest also does does not have a NIC, which means the BIOS cannot\n";
+    print "do a network boot.\n";
+  } else {
+    print "The guest does have a NIC, so a network boot is possible, if the\n";
+    print "BIOS supports it.\n";
+  }
+  print "If this is not your intent, you probably want to CTRL-C and try again.\n";
+}
+
+print "The BIOS boot sequence will be set to CD,HD.   If you need to change this\n";
+print "later, edit the <bootseq> block within the NVRAM device.\n";
+
+#
+# NVRAM 
+#
+# Note: do_storage *must* have placed an IDE named ide0 in order for this to work
+#
+do_device(\%config, $pdir, "V3_CONFIG_NVRAM", "NVRAM", "nvram", 1, undef, "     <storage>ide0</storage>\n     <bootseq>cd,hd</bootseq>\n"); #must have
+
+#
 #
 # Generic Catch-all Device
 #
@@ -213,6 +243,7 @@ $target = PAL;
 print $target "<vm class=\"PC\">\n\n";
 print $target file_setup(\%config), "\n";
 print $target memory_setup(\%config), "\n";
+print $target swapping_setup(\%config), "\n";
 print $target paging_setup(\%config), "\n";
 print $target memmap_setup(\%config), "\n";
 print $target numa_setup(\%config), "\n";
@@ -226,7 +257,14 @@ print $target "</vm>\n";
 
 close(PAL);
 
-print "\n\nYour guest is now ready in the directory $dir\n";
+print "\n\nYour guest is now ready in the directory $dir\n\n";
+print "To run it, do:\n\n";
+print "  cd $dir\n";
+print "  v3_create -b $name.pal $name\n";
+print "  v3_launch /dev/v3-vmN (N given by v3_create)\n\n";
+print "Other useful tools:\n\n";
+print "  v3_console (CGA console)\n";
+print "  v3_stream (connect to stream, for example, serial port)\n\n";
 
 exit;
 
@@ -367,6 +405,28 @@ sub get_numa_data() {
   return %numa;
 }
 
+
+sub do_swapping {
+  my ($cr, $pdir) = @_;
+
+  my $canswap = is_palacios_core_feature_enabled($pdir,"V3_CONFIG_SWAPPING");
+  my $mem = $cr->{mem};
+
+  if ($canswap) { 
+    #Config for swapping
+    $cr->{swapping} = yn_question("Do you want to use swapping?", "n", "y", "n");
+    
+    if ($cr->{swapping} eq "y") { 
+      $cr->{swap_alloc} = quant_question("How much memory do you want to allocate [MB] ?", $mem/2);
+      print "We will use the default swapping strategy.\n";
+      $cr->{swap_strat} = "default";
+      print "What file do you want to swap to? [./swap.bin] ";
+      $cr->{swap_file} = get_user("./swap.bin");
+    }
+  }
+
+} 
+
 sub do_device {
   my ($cr,$pdir,$feature, $class, $id, $hardfail, $optblob, $nestblob) =@_;
 
@@ -411,10 +471,10 @@ sub do_consoles_and_ports {
   print "The CGA and VGA options are mutually exclusive\n";
   print "THe VGA and PARAGRAPH options are mutually exclusive\n";
   
-  if (!($cancga || $canvga || $canserial || $canvirioconsole)) { 
+  if (!($cancga || $canvga || $canserial || $canvirtioconsole)) { 
     print "Hmm... No console mechanism is enabled in your Palacios build...\n";
     print "  This is probably not what you want...\n";
-}
+  }
   
   $didcga=0;
   if ($cancga) { 
@@ -476,10 +536,11 @@ sub do_consoles_and_ports {
     }
   }
   
-  if (!($didcga || $didvga || $didserial || $didvirioconsole || $didparagraph)) { 
+  if (!($didcga || $didvga || $didserial || $didvirtioconsole || $didparagraph)) { 
     print "You have configured your guest without any obvious way of interacting with it....\n";
     print "  This is probably not what you want...\n";
   } 
+
 } 
 
 
@@ -570,7 +631,7 @@ sub do_network {
        $host=get_user("eth0");
        add_device($cr,"NIC_BRIDGE","net$num-back",undef,
                   "    <frontend tag=\"net$num\" />\n".
-                  "    <hostnic>$host</hostnic>\n");
+                  "    <hostnic name=\"$host\" />\n");
     }
 
     if ($back eq "vnet") { 
@@ -580,6 +641,10 @@ sub do_network {
     }
     $num++;
   }
+
+  if ($num>0) { 
+    $cr->{havenic}=1;
+  }
  }
 
 
@@ -626,7 +691,9 @@ sub do_storage {
       do_storage_backend($cr, $pdir, $dir, $name, "virtioblk$i", "data$i", "");
     }
   }
-}
+
+}      
+
 
 
 sub do_storage_backend {
@@ -670,7 +737,6 @@ sub do_storage_backend {
     print "  * FILEDISK - the data is kept in a host file (common) : ".($canfiledisk ? "available" : "UNAVAILABLE")."\n";
     print "  * NETDISK - the data is accessed via the network (uncommon) : ".($cannetdisk ? "available" : "UNAVAILABLE")."\n";
     print "  * TMPDISK - the data is kept in memory and discarded (common) : ".($cantmpdisk ? "available" : "UNAVAILABLE")."\n";
-    print "  * RAMDISK - the data is kept in memory (common) : ".($canramdisk ? "available" : "UNAVAILABLE")."\n";
     while (1) {
       print "Which option do you want for this device? {".join(", ",@disks)."} [] : ";
       $type = get_user("");
@@ -703,9 +769,11 @@ sub do_storage_backend {
       if ($what eq "cd") { 
        $attach.="     <model>V3VEE CDROM</model>\n".
                  "     <type>CDROM</type>\n".$frontendblock;
+       $cr->{havecd}=1;
       } else {
        $attach.="     <model>V3VEE HD</model>\n".
                  "     <type>HD</type>\n".$frontendblock;
+       $cr->{havehd}=1;
       }
       $attach.="    </frontend>\n";
 
@@ -940,6 +1008,14 @@ sub extensions_setup  {
   return $s;
 }
 
+sub swapping_setup {
+  my $cr=shift;
+  if (defined($cr->{swapping}) && $cr->{swapping} eq "y") { 
+    return " <swapping enable=\"y\">\n  <allocated>".$cr->{swap_alloc}."</allocated>\n  <file>".$cr->{swap_file}."</file>\n  <strategy>".$cr->{swap_strat}."</strategy>\n </swapping>\n";
+  } else {
+    return " <!-- there is no swapping configuration, but you can add one manually -->\n";
+  }
+}
 sub telemetry_setup  {
   my $cr=shift;
   return " <telemetry>".$cr->{telemetry}."</telemetry>\n";