myoung34 / vagrant-ovirt4

oVirt v4 provider for Vagrant
MIT License
36 stars 23 forks source link

Successfully upped box reports its state as "preparing" #140

Open GervaisdeM opened 3 years ago

GervaisdeM commented 3 years ago

Box finishes coming up (after a very long puppet run) but never reports its state as "up" and is stuck displaying "preparing"

    customer_qa_ov: Puppet run succeeded, with resources changed.
==> customer_qa_ov: Running provisioner: shell...
    customer_qa_ov: Running: /tmp/vagrant-shell20210113-28168-1o9ssih.sh
[gervais@cobweb.dgi ovirt]$ 
[gervais@cobweb.dgi ovirt]$ vagrant global-status 
id       name        provider state                                directory                           
-------------------------------------------------------------------------------------------------------
ae2c269  ir_dev_vm   vsphere vagrant_vsphere.states.short_running /home/gervais/vagrant/vsphere       
7f8b497  customer_qa_ov ovirt4  preparing                            /home/gervais/vagrant/ovirt     

If I suspend the box and resume it, it does report "up" :)

daFritz84 commented 3 years ago

Can you create a minimal example, i.e. Vagrantfile that has this kind of behaviour? I'm thinking of a minimal vm definition with an ansible provisioner which executes a pause maybe.

GervaisdeM commented 3 years ago

Not using ansible these days... I made a shell script (hope that still tests what you want)

[gervais@vpn-dgi ovirt] (add-ovirt) $ cat echo_hello.sh 
#!/bin/bash

echo "hello"
exit 0

With a basic Vagrantfile, the VM comes up and runs the shell provisioner. It still says that the state is "preparing" in vagrant global-status.

[gervais@vpn-dgi ovirt] (add-ovirt) $ vagrant up
Bringing machine 'default' up with 'ovirt4' provider...
==> default: Creating VM with the following settings...
==> default:  -- Name:          ovirt-gervais-test-box.dgi
==> default:  -- Cluster:       Default
==> default:  -- Template:      vagrantbase_bionic64
==> default:  -- Console Type:  vnc
==> default:  -- BIOS Serial:   
==> default:  -- Optimized For: server
==> default:  -- Description:   
==> default:  -- Comment:       
==> default:  -- Memory:        
==> default:  ---- Memory:      4096 MiB
==> default:  ---- Maximum:     4096 MiB
==> default:  ---- Guaranteed:  4096 MiB
==> default:  -- Cpu:           
==> default:  ---- Cores:       1
==> default:  ---- Sockets:     2
==> default:  ---- Threads:     2
==> default:  -- Cloud-Init:    false
==> default: Waiting for VM to become "ready" to start...
==> default: Starting VM.
==> default: Waiting for VM to get an IP address...
==> default: Got IP: 192.168.169.142
==> default: Machine is booted and ready for use!
    default: 
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: 
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Rsyncing folder: /home/gervais/vagrant/ovirt/ => /vagrant
==> default: Setting hostname...
==> default: Running provisioner: shell...
    default: Running: /tmp/vagrant-shell20210118-7208-q3mgt9.sh
    default: hello
[gervais@vpn-dgi ovirt] (add-ovirt) $ vagrant global-status 
id       name    provider state     directory                           
------------------------------------------------------------------------
e4de363  default ovirt4 preparing /home/gervais/vagrant/ovirt         

The above shows information about all known Vagrant environments
on this machine. This data is cached and may not be completely
up-to-date. To interact with any of the machines, you can go to
that directory and run Vagrant, or you can use the ID directly
with Vagrant commands from any directory. For example:
"vagrant destroy 1a2b3c4d"
daFritz84 commented 3 years ago

Nice, that will definitely do. I will try to reproduce this issue and see if I can come up with a fix.

GervaisdeM commented 3 years ago

Found something interesting when testing snapshot issue... Seems that taking any action on the vm makes it check the status again and it then reports as "up."

==> default: Running provisioner: shell...
    default: Running: /tmp/vagrant-shell20210119-15674-t0ag9.sh
    default: hello
[gervais@vpn-dgi ovirt] (add-ovirt) $ vagrant global-status 
id       name    provider state     directory                           
------------------------------------------------------------------------
aa79f98  default ovirt4 preparing /home/gervais/vagrant/ovirt         

The above shows information about all known Vagrant environments
on this machine. This data is cached and may not be completely
up-to-date. To interact with any of the machines, you can go to
that directory and run Vagrant, or you can use the ID directly
with Vagrant commands from any directory. For example:
"vagrant destroy 1a2b3c4d"
[gervais@vpn-dgi ovirt] (add-ovirt) $ vagrant snapshot save mysnapshot
==> default: Retrieving list of snapshots...
==> default: Creating snapshot...
[gervais@vpn-dgi ovirt] (add-ovirt) $ vagrant global-status 
id       name    provider state  directory                           
---------------------------------------------------------------------
aa79f98  default ovirt4 up     /home/gervais/vagrant/ovirt         

The above shows information about all known Vagrant environments
on this machine. This data is cached and may not be completely
up-to-date. To interact with any of the machines, you can go to
that directory and run Vagrant, or you can use the ID directly
with Vagrant commands from any directory. For example:
"vagrant destroy 1a2b3c4d"