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

[libvirt] libvirt and bios image file selection



libvirt xml config does not have possibility to select another bios
file for qemu or kvm.

As to XEN and other hypervisors, I dont know how it is realized. But
for kvm/qemu here is a patch.

Now it can be controlled via xml domain config:

<biosfile>bios-alternative.bin</biosfile>

Miroslav Scaldov
diff -r -c libvirt-0.6.5.old/src/domain_conf.c libvirt-0.6.5/src/domain_conf.c
*** libvirt-0.6.5.old/src/domain_conf.c	2009-06-25 17:45:54.000000000 +0400
--- libvirt-0.6.5/src/domain_conf.c	2009-09-01 10:57:03.000000000 +0400
***************
*** 2222,2227 ****
--- 2222,2230 ----
      if (virXPathULong(conn, "string(./currentMemory[1])", ctxt, &def->memory) < 0)
          def->memory = def->maxmem;
  
+     def->cpumodel = virXPathString(conn, "string(./cpumodel[1])", ctxt);
+     def->cpumodel = virXPathString(conn, "string(./biosfile[1])", ctxt);
+ 
      if (virXPathULong(conn, "string(./vcpu[1])", ctxt, &def->vcpus) < 0)
          def->vcpus = 1;
  
diff -r -c libvirt-0.6.5.old/src/domain_conf.h libvirt-0.6.5/src/domain_conf.h
*** libvirt-0.6.5.old/src/domain_conf.h	2009-06-17 12:30:44.000000000 +0400
--- libvirt-0.6.5/src/domain_conf.h	2009-09-01 10:56:12.000000000 +0400
***************
*** 459,464 ****
--- 459,466 ----
  
      unsigned long memory;
      unsigned long maxmem;
+     char *cpumodel;
+     char *biosfile;
      unsigned long vcpus;
      int cpumasklen;
      char *cpumask;
diff -r -c libvirt-0.6.5.old/src/qemu_conf.c libvirt-0.6.5/src/qemu_conf.c
*** libvirt-0.6.5.old/src/qemu_conf.c	2009-07-03 17:07:21.000000000 +0400
--- libvirt-0.6.5/src/qemu_conf.c	2009-09-01 11:37:11.000000000 +0400
***************
*** 973,978 ****
--- 973,980 ----
           strstr(emulator, "x86_64")))
          cpu = "qemu32";
  
+     if(def->cpumodel) cpu = def->cpumodel;
+ 
  #define ADD_ARG_SPACE                                                   \
      do { \
          if (qargc == qarga) {                                           \
***************
*** 1065,1070 ****
--- 1067,1078 ----
      ADD_ARG_LIT(emulator);
      ADD_ARG_LIT("-S");
  
+     if(def->biosfile)
+     {
+         ADD_ARG_LIT("-bios");
+         ADD_ARG_LIT(def->biosfile);
+     }
+ 
      /* This should *never* be NULL, since we always provide
       * a machine in the capabilities data for QEMU. So this
       * check is just here as a safety in case the unexpected

Attachment: signature.asc
Description: PGP signature


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