Set VM name with hyperv provider

968 views
Skip to first unread message

Nicola

unread,
Feb 9, 2015, 3:41:35 AM2/9/15
to vagra...@googlegroups.com
Hi to all,
in my vagrant project  I've a gui where the users put into a box the name of the development environment. I want that this name is used in the vagrantfile to set the name for the hostname and for the name of the vm in hyperv. It's possible?

Thanks

Nicola


Alvaro Miranda Aguilera

unread,
Feb 9, 2015, 3:20:35 PM2/9/15
to vagra...@googlegroups.com
Hello Nicola,

In the vagrantfile you should be able to define a hyperv block to set
serveral options, one is the name on the gui

https://docs.vagrantup.com/v2/hyperv/configuration.html

vmname (string) - Name of virtual mashine as shown in Hyper-V manager.
Defaults is taken from box image XML.

I haven't done it, so please try this:

config.vm.provider "hyperv" do |hv|
hv.vmname = testmachine"
end
> --
> You received this message because you are subscribed to the Google Groups
> "Vagrant" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vagrant-up+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Alvaro Miranda Aguilera

unread,
Feb 9, 2015, 3:21:21 PM2/9/15
to vagra...@googlegroups.com
typo,.. missing a quote

config.vm.provider "hyperv" do |hv|
hv.vmname = "testmachine"
end

Nicola

unread,
Feb 10, 2015, 3:51:08 AM2/10/15
to vagra...@googlegroups.com
Hello Alvaro, I try to do like your example bit I've this error:

There are errors in the configuration of this machine. Please fix
the following errors and try again:

Hyper-V:
* The following settings shouldn't exist: cpus, memory, vmname

And my vagrantfile is this:

config.vm.provider "hyperv" do |hv|
  hv.vmname = "vm_name"
  hv.cpus = "1"
  hv.memory = "512"
end

Have you any idea?
Nicola

Alvaro Miranda Aguilera

unread,
Feb 10, 2015, 4:10:01 AM2/10/15
to vagra...@googlegroups.com
Nicola, always share the full vagrantfile please..

Alvaro Miranda Aguilera

unread,
Feb 10, 2015, 4:11:29 AM2/10/15
to vagra...@googlegroups.com
Also, ensure you are in the latest version..

vagrant version

:)


On Tue, Feb 10, 2015 at 10:09 PM, Alvaro Miranda Aguilera

Nicola

unread,
Feb 10, 2015, 9:15:30 AM2/10/15
to vagra...@googlegroups.com
I'm on the latest release of Vagrant (1.7.2) and seems that configuration is not supported...

Ahmet Arsan

unread,
May 8, 2016, 2:36:27 PM5/8/16
to Vagrant
It seems my entire hyper-v config is being ignored. Were you able to get this working? I am trying to set vmname and memory but not working. 

Alvaro Miranda Aguilera

unread,
May 8, 2016, 5:59:19 PM5/8/16
to vagra...@googlegroups.com
Hello,

Can you send a new email and share your Vagrantfile for review?

You did reply to a email thread a bit outdated.

Thanks
Alvaro.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages