How to create Windows VM?

Hello,
when I try to install Windows inside VM, installation is all the times stucked at Win logo screen.

Is there any solution for this?
Thanks, Pavel

Hi Pavel,

Make sure your windows iso is not a corrupted one and please show your template content .

Hi,

I’m having the same issue trying to install windows10 on opennebula.
I’m using ISO downloaded from MS site, virtio-win.iso and a 100GB qcow2 disk.
here is the template:

TEMPLATE CONTENTS CONTEXT=[ NETWORK="YES", SSH_PUBLIC_KEY="$USER[SSH_PUBLIC_KEY]" ] CPU="1" DESCRIPTION="Windows 10 64bits Disk 100gb network staging" DISK=[ IMAGE="ocfs2-win-disk-100gb", IMAGE_UNAME="oneadmin" ] DISK=[ IMAGE="win10-eng-x64", IMAGE_UNAME="oneadmin" ] DISK=[ IMAGE="virtio-win-drivers", IMAGE_UNAME="oneadmin" ] FEATURES=[ ACPI="yes", APIC="yes", LOCALTIME="yes" ] GRAPHICS=[ LISTEN="0.0.0.0", TYPE="VNC" ] HYPERVISOR="kvm" INPUT=[ BUS="usb", TYPE="tablet" ] LOGO="images/logos/windows8.png" MEMORY="16384" NIC=[ MODEL="virtio", NETWORK="test", NETWORK_UNAME="oneadmin" ] OS=[ ARCH="x86_64", BOOT="cdrom,hd" ] SCHED_REQUIREMENTS="CLUSTER_ID=\"100\"" VCPU="4"

thanks!

Hi,
I used the same ISO to install Win inside Hyper-V and without problem. So, ISO is OK.
The same “stuck” happens when installing Win 2013 and also Win 2016.
This is my template:

TEMPLATE 32 INFORMATION
ID : 32
NAME : Windows-2012-R2-from-ISO
USER : oneadmin
GROUP : oneadmin
REGISTER TIME : 05/06 13:34:24

PERMISSIONS
OWNER : um-
GROUP : —
OTHER : —

TEMPLATE CONTENTS
CONTEXT=[
NETWORK=“YES”,
SET_HOSTNAME=“$NAME” ]
CPU=“2”
DISK=[
IMAGE=“WINDOWS-2016-TP5-ISO”,
IMAGE_UNAME=“oneadmin” ]
DISK=[
IMAGE=“Virtio-WIN-0.1.117.ISO”,
IMAGE_UNAME=“oneadmin” ]
DISK=[
IMAGE=“Windows-Server-2012-R2-OS”,
IMAGE_UNAME=“oneadmin” ]
GRAPHICS=[
LISTEN=“0.0.0.0”,
TYPE=“VNC” ]
HYPERVISOR=“kvm”
LOGO=“images/logos/windows8.png”
MEMORY=“10240”
NIC=[
NETWORK=“DEV-public”,
NETWORK_UNAME=“oneadmin” ]
NIC_DEFAULT=[
MODEL=“virtio” ]
OS=[
ARCH=“x86_64”,
BOOT=“cdrom” ]
RAW=[
DATA=“”,
TYPE=“kvm” ]

Looks like problem is in VirtIO in image, image should be defined with DEV_PREFIX=“sd”.

So I was able to start the machine by changing the kvm’s cpu parameter from virsh, installation went fine, but after stopping the vm, I was not able to start it again.

steps:

  • use that template to deploy a new vm
  • vm starts but hangs with the windows logo
  • from that ONE backend, in virsh:
  1. poweroff the vm
  2. edit the vm xml
  3. add:
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>core2duo</model>
    <feature policy='require' name='nx'/>
  </cpu>
  1. start vm and install

Stopping the vm and restarting it gives me:
Could not create domain from /var/lib/one//datastores/101/163/deployment.4

besides the info I posted earlier in this thread, for windows 10 I had to do the following extra things:

  • get a windows disk image and make to mount it with prefix “sd”, so it will be mounted as something like “sda”. Use this way during the initial installation with the windows install cd.
  • also, mount this iso during installation: https://fedoraproject.org/wiki/Windows_Virtio_Drivers
    install drivers during installation, or if possible, after installation.
  • after install completes, make sure the template/image show device prefix as “vd” so the disk will be mounted as “vda”

Windows should boot normally now

Still not working.
I tried mounting the following options with no luck:

  • qcow2 disk as sd
  • installation ISO disk as sd
  • without VirtIO disk
  • without any disk, only the installation ISO

Always the same error and after reboot, shows the windows logo:

there is a thread here: http://ubuntuforums.org/showthread.php?t=2289210
with some tips about windows 10 and KVM. (changing cpu type)

Another option could be to install windows 10 using virtualbox, then convert the image using qemu-img and import it to opennebula. Workaround, yes, but get you where you want to go.

Hi,

I’m currently trying to create a Windows Server 2016 vm. I’m still stuck at boot process and get the same error like emot.

Im working with a proconfigured image that I created with virtualbox. So the VirtIo drivers are already installed and I enabled remote control.
After creating the image I converted it to the qcow2 format using qemu-img.

This is my OpenNebula template:

CONTEXT=[NETWORK=“YES”]
CPU=“2”
DISK=[DRIVER=“qcow2”,IMAGE=“winserv16”,IMAGE_UNAME=“oneadmin”,READONLY=“no”,TARGET=“vda”]
FEATURES=[ACPI=“yes”,APIC=“yes”,LOCALTIME=“yes”]
GRAPHICS=[LISTEN=“0.0.0.0”,RANDOM_PASSWD=“YES”,TYPE=“VNC”]
HYPERVISOR=“kvm”
INPUT=[BUS=“usb”,TYPE=“tablet”]
MEMORY=“16384”
NIC=[NETWORK=“TestNetz”,NETWORK_UNAME=“oneadmin”]
NIC_DEFAULT=[MODEL=“virtio”]
OS=[ARCH=“x86_64”,BOOT=“cdrom,hd”]
PCI=[CLASS=“0300”,DEVICE=“6798”,VENDOR=“1002”]
SUNSTONE_NETWORK_SELECT=“NO”
VCPU=“2”

The previous post references http://ubuntuforums.org/showthread.php?t=2289210.
This is their conclusion:

Summary is to change the CPU type to (core2duo), add a feature flag (nx) and to hide KVM from the guest, then complete the upgrade...once finished you can revert the changes.
QEMU: -cpu core2duo,+nx,kvm=off
Libvirt:
Code:
<features>
  <acpi/>
  <kvm>
    <hidden state='on'/>
  </kvm>
</features>
<cpu mode='custom' match='exact'>
  <model fallback='allow'>core2duo</model>
  <feature policy='require' name='nx'/>
</cpu>

How can I add the needed Qemu options to my template? Same for the libvirt changes?
Has anyone tried it so far and was successful?

Sorry if some of the questions are obvious im pretty new to OpenNebula…

I’ve successfully booted Windows 10 by adding this section to my template:

RAW=[
  DATA="<cpu><model fallback='allow'>core2duo</model></cpu>",
  TYPE="kvm" ]

This will add the required options to the libvirt XML that is generated from the template. You may need to ensure that the RAW template attribute is not restricted in oned.conf.

2 Likes

Thanks @Paul_Batchelor! I can run windows 10 now.

Hi,

I have set this RAW data value in my Windows 10 template but it cannot deploy the virtual machine:

[oneadmin@vdicone01 100]$ cat /var/log/one/17.log
Sun Feb 5 01:06:13 2017 [Z0][VM][I]: New state is ACTIVE
Sun Feb 5 01:06:13 2017 [Z0][VM][I]: New LCM state is PROLOG
Sun Feb 5 01:07:18 2017 [Z0][VM][I]: New LCM state is BOOT
Sun Feb 5 01:07:18 2017 [Z0][VMM][I]: Generating deployment file: /var/lib/one/vms/17/deployment.0
Sun Feb 5 01:07:19 2017 [Z0][VMM][I]: Successfully execute transfer manager driver operation: tm_context.
Sun Feb 5 01:07:19 2017 [Z0][VMM][I]: ExitCode: 0
Sun Feb 5 01:07:19 2017 [Z0][VMM][I]: Successfully execute network driver operation: pre.
Sun Feb 5 01:07:19 2017 [Z0][VMM][I]: Command execution fail: cat << EOT | /var/tmp/one/vmm/kvm/deploy ‘/var/lib/one//datastores/0/17/deployment.0’ ‘vdicnode01-priv’ 17 vdicnode01-priv
Sun Feb 5 01:07:19 2017 [Z0][VMM][I]: error: Failed to create domain from /var/lib/one//datastores/0/17/deployment.0
Sun Feb 5 01:07:19 2017 [Z0][VMM][I]: error: unsupported configuration: guest and host CPU are not compatible: Host CPU does not provide required features: monitor
Sun Feb 5 01:07:19 2017 [Z0][VMM][E]: Could not create domain from /var/lib/one//datastores/0/17/deployment.0
Sun Feb 5 01:07:19 2017 [Z0][VMM][I]: ExitCode: 255
Sun Feb 5 01:07:19 2017 [Z0][VMM][I]: Failed to execute virtualization driver operation: deploy.
Sun Feb 5 01:07:19 2017 [Z0][VMM][E]: Error deploying virtual machine: Could not create domain from /var/lib/one//datastores/0/17/deployment.0
Sun Feb 5 01:07:19 2017 [Z0][VM][I]: New LCM state is BOOT_FAILURE

Anybody has eperienced the same issue?

My template:

CONTEXT = [
NETWORK = “YES”,
SSH_PUBLIC_KEY = “$USER[SSH_PUBLIC_KEY]” ]
CPU = “1”
DISK = [
DRIVER = “qcow2”,
IMAGE = “Windows10-BaseImage”,
IMAGE_UNAME = “oneadmin” ]
FEATURES = [
ACPI = “yes”,
APIC = “yes”,
LOCALTIME = “yes” ]
GRAPHICS = [
KEYMAP = “es”,
LISTEN = “0.0.0.0”,
TYPE = “SPICE” ]
INPUT = [
BUS = “usb”,
TYPE = “mouse” ]
INPUT = [
BUS = “usb”,
TYPE = “tablet” ]
LOGO = “images/logos/windows8.png”
MEMORY = “1024”
NIC = [
NETWORK = “VDI”,
NETWORK_UNAME = “oneadmin” ]
OS = [
ARCH = “x86_64”,
ROOT = “hd” ]
RAW = [
DATA = “core2duo”,
TYPE = “kvm” ]
USER_INPUTS = [
MEMORY = “O|fixed|| |1024” ]
VCPU = “2”

Hi Oscar,

You need to set the data section exactly as I have it in the previous example -

RAW=[
  DATA="<cpu><model fallback='allow'>core2duo</model></cpu>",
  TYPE="kvm" ]

“core2duo” by itself isn’t valid XML and libvirt is failing to create the VM on the hypervisor as the domain xml is corrupted.

Hi,

Sorry for the delay, I have had a heavy problem in my enviroment and I have not been able to fix it until now!

I attache the template of the VM where one can see that I have set it exactly as you suggest:

http://paste.fedoraproject.org/555403/69261501/

RAW = [
DATA = “core2duo”,
TYPE = “kvm” ]

But I’m getting the following errors:

Sun Feb 12 20:04:49 2017 [Z0][ReM][D]: Req:8976 UID:0 VirtualMachineAction invoked , “resume”, 17
Sun Feb 12 20:04:49 2017 [Z0][DiM][D]: Resuming VM 17
Sun Feb 12 20:04:49 2017 [Z0][ReM][D]: Req:8976 UID:0 VirtualMachineAction result SUCCESS, 17
Sun Feb 12 20:04:50 2017 [Z0][VMM][D]: Message received: LOG I 17 Successfully execute transfer manager driver operation: tm_context.

Sun Feb 12 20:04:50 2017 [Z0][VMM][D]: Message received: LOG I 17 ExitCode: 0

Sun Feb 12 20:04:50 2017 [Z0][VMM][D]: Message received: LOG I 17 Successfully execute network driver operation: pre.

Sun Feb 12 20:04:50 2017 [Z0][VMM][D]: Message received: LOG I 17 Command execution fail: cat << EOT | /var/tmp/one/vmm/kvm/deploy ‘/var/lib/one//datastores/0/17/deployment.3’ ‘vdicnode01-priv’ 17 vdicnode01-priv

Sun Feb 12 20:04:50 2017 [Z0][VMM][D]: Message received: LOG I 17 error: Failed to create domain from /var/lib/one//datastores/0/17/deployment.3

> Sun Feb 12 20:04:50 2017 [Z0][VMM][D]: Message received: LOG I 17 error: unsupported configuration: guest and host CPU are not compatible: Host CPU does not provide required features: monitor

Sun Feb 12 20:04:50 2017 [Z0][VMM][D]: Message received: LOG E 17 Could not create domain from /var/lib/one//datastores/0/17/deployment.3

Sun Feb 12 20:04:50 2017 [Z0][VMM][D]: Message received: LOG I 17 ExitCode: 255

Sun Feb 12 20:04:50 2017 [Z0][VMM][D]: Message received: LOG I 17 Failed to execute virtualization driver operation: deploy.

Sun Feb 12 20:04:50 2017 [Z0][VMM][D]: Message received: DEPLOY FAILURE 17 Could not create domain from /var/lib/one//datastores/0/17/deployment.3

Thanks a lot

Hi Oscar

The only obvious issue I see in your template is that you have two INPUT sections. I’d suggest removing one of them. (you should keep the type=“TABLET” one as that won’t offset the mouse pointer in VNC (not sure about spice as we don’t use it)

Cheers

Hi,

I have removed one of the INPUT sections:

https://paste.fedoraproject.org/paste/EDnRzNockeFEtTcdpRJPPV5M1UNdIGYhyRLivL9gydE=

But I still get the same error… :frowning:

Thanks a lot.

hi oscar,

this might be worth a look, as can be seen in this bugreport, this message might be caused by differences between the CPU’s in your cluster. In the example posted there, the “monitor” flag is only present on the first core of a CPU.
EDIT: forgot to post the link: https://bugzilla.redhat.com/show_bug.cgi?id=873926

Can you check if you see something similar in the CPU model you use?
Check if you see any differences in the features of your cores by using:
“cat /proc/cpuinfo” on your virtualization servers.

I attach the info you have requested:

[root@vdicnode02 opt]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 42
model name : Intel(R) Core™ i7-2600K CPU @ 3.40GHz
stepping : 7
microcode : 0x29
cpu MHz : 3399.334
cache size : 8192 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx hypervisor lahf_lm ida arat epb pln pts dtherm tpr_shadow vnmi ept vpid tsc_adjust
bogomips : 6800.05
clflush size : 64
cache_alignment : 64
address sizes : 42 bits physical, 48 bits virtual
power management:

processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 42
model name : Intel(R) Core™ i7-2600K CPU @ 3.40GHz
stepping : 7
microcode : 0x29
cpu MHz : 3399.334
cache size : 8192 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx hypervisor lahf_lm ida arat epb pln pts dtherm tpr_shadow vnmi ept vpid tsc_adjust
bogomips : 6800.05
clflush size : 64
cache_alignment : 64
address sizes : 42 bits physical, 48 bits virtual
power management:

I added the link to the bugreport, i forgot that earlier. The cpuinfo you pasted shows 2 cores of one host, right ?

Do you have any servers in your cluster with different CPU’s, i.e. other generation, or intel or amd mixed ?
You can check the capabilities of your hosts with:
“virsh capabilities” and look for any differences between CPU functions.

With “virsh dumpxml (name of VM)” you can check for things like:
<feature policy='require' name='monitor'/> that might be there.

more info: https://bugzilla.redhat.com/show_bug.cgi?id=873926