[libvirt] libvirt and "kvm -cpu=qemu32" problem

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

 



Problem is that the images of windows 2003 server, windows 2000 and
some other do not start and go to BSOD due to processor mismatch if
they were created under either qemu or vmware, or from
bare-metal installed OS.

By default libvirt starts kvm with "-cpu=qemu32" option instead of, for
example, "-cpu=pentium3".

There is patch for libvirt-0.6.5 to avoid this problem.
Now libvirt takes into account <cpumodel> node from .xml domain config,
which overrides libvirt's default -cpu option for kvm.

I think, this patch is vital, because of it helps to avoid a waste of
time with reinstalling and reconfiguring windows server images.

<domain type='kvm'>
  <name>w2k3s</name>
  <uuid>e2725d10-7ada-4f71-eea7-fa6cc1a541ee</uuid>
  <memory>262144</memory>
  <currentMemory>262144</currentMemory>
  <vcpu>1</vcpu>
  <cpumodel>pentium3</cpumodel>			<------
  <os>
    <type arch='i686'>hvm</type>
    <boot dev='hd'/>
  </os>

Sorry for not patching GIT-version, GIT is hard to compile in a small
time.
diff -crB libvirt-0.6.5.o/src/domain_conf.c libvirt-0.6.5/src/domain_conf.c
*** libvirt-0.6.5.o/src/domain_conf.c	2009-06-25 17:45:54.000000000 +0400
--- libvirt-0.6.5/src/domain_conf.c	2009-08-28 11:55:42.000000000 +0400
***************
*** 2222,2227 ****
--- 2222,2229 ----
      if (virXPathULong(conn, "string(./currentMemory[1])", ctxt, &def->memory) < 0)
          def->memory = def->maxmem;
  
+     def->cpumodel = virXPathString(conn, "string(./cpumodel[1])", ctxt);
+ 
      if (virXPathULong(conn, "string(./vcpu[1])", ctxt, &def->vcpus) < 0)
          def->vcpus = 1;
  
diff -crB libvirt-0.6.5.o/src/domain_conf.h libvirt-0.6.5/src/domain_conf.h
*** libvirt-0.6.5.o/src/domain_conf.h	2009-06-17 12:30:44.000000000 +0400
--- libvirt-0.6.5/src/domain_conf.h	2009-08-28 11:54:53.000000000 +0400
***************
*** 459,464 ****
--- 459,465 ----
  
      unsigned long memory;
      unsigned long maxmem;
+     char *cpumodel;
      unsigned long vcpus;
      int cpumasklen;
      char *cpumask;
diff -crB libvirt-0.6.5.o/src/qemu_conf.c libvirt-0.6.5/src/qemu_conf.c
*** libvirt-0.6.5.o/src/qemu_conf.c	2009-07-03 17:07:21.000000000 +0400
--- libvirt-0.6.5/src/qemu_conf.c	2009-08-28 11:56:58.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) {                                           \
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]