ENT-5725: Added vagrant provider for spawning VMs#156
ENT-5725: Added vagrant provider for spawning VMs#156larsewi merged 1 commit intocfengine:masterfrom
Conversation
craigcomstock
left a comment
There was a problem hiding this comment.
looks like a great start! I have added some notes on things we have solved in jenkins-vms regarding various bits.
| node.vm.provider "virtualbox" do |vb| | ||
| vb.memory = VM_MEMORY | ||
| vb.cpus = VM_CPUS | ||
| vb.customize [ "guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 1000 ] |
There was a problem hiding this comment.
regarding time and dns you might need to include this snippet from jenkins-vms that handles darwin/macos
cf_remote/Vagrantfile
Outdated
| # previously working Vagrantfiles: | ||
| # https://fedoraproject.org/wiki/Changes/Vagrant_2.2_with_QEMU_Session#Upgrade.2Fcompatibility_impact | ||
| v.qemu_use_session = false | ||
| override.vm.synced_folder "./", "/vagrant", type: :rsync |
There was a problem hiding this comment.
synced folders are also tricky for older distributions like debian-9:
here are some workarounds for centos-7 and old debians:
429b367 to
8ff3c80
Compare
8ff3c80 to
c96596d
Compare
c96596d to
be78500
Compare
larsewi
left a comment
There was a problem hiding this comment.
Looks great 🚀 Some smaller comments
While reviewing your PR, I never understood what the config argument to ssh and scp is for, or why it's necessary. Could you explain?
When you spawn a vagrant VM, vagrant generates a ssh config file with a private key and everything set up correctly. You can inspect it by running The variable "config" is simply the path to the vagrant-ssh-config file inside the VM's directory. If it is not None, then the connection will connect using it. |
be78500 to
73e9bd8
Compare
larsewi
left a comment
There was a problem hiding this comment.
Looks like there are some failing test :)
73e9bd8 to
fa2fa4f
Compare
I was thinking we could improve the Vagrantfile and other mechanics, like default provisioning scripts, in future iterations |
6af64fc to
1f44cbe
Compare
1f44cbe to
3887067
Compare
933db4f to
ab2189b
Compare
b69818e to
cd1e18a
Compare
Ticket: ENT-5725 Signed-off-by: Victor Moene <victor.moene@northern.tech>
cd1e18a to
76e6304
Compare
| else: | ||
| print("VM '%s' not found in the clouds" % vm_uuid) | ||
| del vms_info[group_name] | ||
| if ssh_config and group_name in ssh_config: |
There was a problem hiding this comment.
Makes it easier to read
| if ssh_config and group_name in ssh_config: | |
| if ssh_config and (group_name in ssh_config): |
| if cpus is None: | ||
| cpus = 1 | ||
| if memory is None: | ||
| memory = 1024 |
There was a problem hiding this comment.
Is this Mega Bytes?
| memory = 1024 | |
| memory = 1024 # MB |
It was a bit hard to know exactly what approach to take so if you have any better ideas I am interested
This doesn't exactly work yet, because
I am not sure how we should provision the created vms. We could:
nt-discovery.shand find all the information we need (like what package manager it uses, etc...) then provision it with a modular script using the collected data.