-
Notifications
You must be signed in to change notification settings - Fork 20
ENT-5725: Added vagrant provider for spawning VMs #156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regarding time and dns you might need to include this snippet from jenkins-vms that handles darwin/macos
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
return [ | ||
VagrantVM( | ||
"{}-{}".format(name, i + 1), | ||
"{}.{}".format(start_ip, end_ip + i), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you run cf-remote spawn
two times, the IPs will conflict?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, yes. I didn't come up with any better solution
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. |
Ticket: ENT-5725 Signed-off-by: Victor Moene <victor.moene@northern.tech>
be78500
to
73e9bd8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there are some failing test :)
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.sh
and find all the information we need (like what package manager it uses, etc...) then provision it with a modular script using the collected data.