vagrant-service-manager
vagrant-service-manager copied to clipboard
Identify VM with human readable name
ATM, the possible way to uniquely identify a vagrant VM is using the machine uuid or its subset of strings. And its trivial to retrieve the name of the VM, however since it is uuid, its not human readable.
This issue is to investigate if we can identify a VM using human-readable name. This depends on
- Naming a VM
- Identify the named VM
There could be different ways we can name a VM, however IMO the closer and more accepted way of naming a VM is as you name the VM in Vagrantfile.
Identifying the a named VM could be done if using the native vagrant way of naming VM and doing lookup in vagrant registry for names and associates VMs.
Some more context on it https://github.com/projectatomic/vagrant-service-manager/pull/123#issuecomment-199693747
@navidshaikh
My VBoxManage list vms
show this:
git:(fix-80) ✗ VBoxManage list vms
"win7-ie10_default_1456812636294_67555" {4edcfa84-627c-446d-8ba4-311c6c2b134b}
"vagrant-devtools_default_1458233788740_76759" {7ef9b907-1bd1-4d39-92e5-2a3c572128d0}
"test_adb_default_1458279527566_54262" {19d3a56b-2f73-428f-b34b-edffe8ec2ca5}
"vagrant-service-manager_default_1458631498366_50888" {c317d42e-636f-4182-b0d1-391cb2e15341}
Are you talking about this name vagrant-service-manager_default_1458631498366_50888
?
@budhrg Check excerpts from https://www.vagrantup.com/docs/virtualbox/configuration.html
VIRTUAL MACHINE NAME
You can customize the name that appears in the VirtualBox GUI by setting the name property. By default, Vagrant sets it to the containing folder of the Vagrantfile plus a timestamp of when the machine was created. By setting another name, your VM can be more easily identified.
config.vm.provider "virtualbox" do |v|
v.name = "my_vm"
end
So it is user defined setting?
So it is user defined setting?
That could be one of the possible way. Since this is something we need to investigate and come up with easy and feasible way to name a VM. Naming a VM should be simple enough for user experience.
When you say possible way
here then is it we need to set virtual machine name to some format internally and if user set it explicitly through Vagrantfile, it will take it from there?
@budhrg you are talking about VBoxManage
and yes, there the name can be set. In fact we do that in openshift-vagrant. However, we need to investigate a Vagrant solution which works with other providers as well.
Will this user-generated name actually work with vagrant commands? I was under the impression the id was all that worked.
bexelbie@bexelbie:~/Vagrant$ vagrant global-status
id name provider state directory
----------------------------------------------------------------------
0294c6d default libvirt running /home/bexelbie/Vagrant/foo
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"
bexelbie@bexelbie:~/Vagrant$ vagrant ssh default
A Vagrant environment or target machine is required to run this
command. Run `vagrant init` to create a new Vagrant environment. Or,
get an ID of a target machine from `vagrant global-status` to run
this command on. A final option is to change to a directory with a
Vagrantfile and to try again.
bexelbie@bexelbie:~/Vagrant$ vagrant ssh 0294c6d
Last login: Thu Mar 31 12:25:11 2016 from 192.168.121.1
[vagrant@localhost ~]$ logout
Connection to 192.168.121.50 closed.
bexelbie@bexelbie:~/Vagrant$ ls
delete_all_2016.03.31 foo
bexelbie@bexelbie:~/Vagrant$ vagrant ssh
A Vagrant environment or target machine is required to run this
command. Run `vagrant init` to create a new Vagrant environment. Or,
get an ID of a target machine from `vagrant global-status` to run
this command on. A final option is to change to a directory with a
Vagrantfile and to try again.
bexelbie@bexelbie:~/Vagrant$
Will this user-generated name actually work with vagrant commands? I was under the impression the id was all that worked.
This needs to be investigated