LordGaav / proxmox-deploy

A cli-based deployment tool for Proxmox
GNU General Public License v3.0
149 stars 36 forks source link

Allow empty vlan ID #5

Closed dorogarcia closed 8 years ago

dorogarcia commented 8 years ago

Hello,

Should be good idea if script allows to use untagged networks.

# proxmox-deploy --proxmox-host XXXX --proxmox-user XXX --cloud-images-dir /mnt/nfs/images/
proxmox-deploy version 0.3 (build 7b45fa9) starting...
Asking user for configuration input
Storage to create disk on (Enter ? for a list of options) [XXX-ssd]: ?
Please enter one of:
        local-lvm
        XXX-ssd
        test1
Storage to create disk on (Enter ? for a list of options) [nl-ssd]: test1
Amount of CPUs: 1
Emulate which CPU family (Enter ? for a list of options) [host]:
Amount of Memory (MB): 512
Size of disk (GB): 8
Virtual Machine id [100]: 31337
Hostname (a FQDN is recommended): 31337
What Cloud image to upload (Enter ? for a list of options) [/mnt/nfs/images/trusty-server-cloudimg-amd64-disk1.img]:
Locale (Enter ? for a list of options) [en_US.UTF-8]:
Timezone (Enter ? for a list of options) [Europe/Amsterdam]:
Keyboard layout (Enter ? for a list of options) [us]:
SSH Public key for root user [2 entries]:
Run apt-get update after rollout [Yes]:
Run apt-get upgrade after rollout [No]:
Bootstrap with Chef [No]:
Configure networking [Yes]:
VLAN ID [1]: <------------------------- Allow empty vlan ID
Network device to configure [eth0]:
Network type (Enter ? for a list of options) [dhcp]:
Resize root filesystem [Yes]:
Install extra packages (space separated)) []:
Run commands after cloud init (space separated) []:
Reboot after cloud-init [No]:
Start VM after provisioning [No]: Yes

Starting provisioning process
Creating Virtual Machine
Traceback (most recent call last):
  File "/usr/local/bin/proxmox-deploy", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/proxmoxdeploy/cli.py", line 107, in main
    memory=proxmox['memory'], vlan_id=cloudinit['vlan_id'])
  File "/usr/local/lib/python2.7/dist-packages/proxmoxdeploy/proxmox.py", line 246, in create_vm
    memory=memory, net0=net0
  File "/usr/local/lib/python2.7/dist-packages/proxmoxer/core.py", line 96, in create
    return self.post(*args, **data)
  File "/usr/local/lib/python2.7/dist-packages/proxmoxer/core.py", line 87, in post
    return self(args)._request("POST", data=data)
  File "/usr/local/lib/python2.7/dist-packages/proxmoxer/core.py", line 75, in _request
    resp = self._store["session"].request(method, url, data=data or None, params=params)
  File "/usr/local/lib/python2.7/dist-packages/proxmoxer/backends/base_ssh.py", line 45, in request
    stdout, stderr = self._exec(full_cmd)
  File "/usr/local/lib/python2.7/dist-packages/proxmoxer/backends/openssh.py", line 42, in _exec
    ret = self.ssh_client.run(cmd, forward_ssh_agent=self.forward_ssh_agent)
  File "/usr/local/lib/python2.7/dist-packages/openssh_wrapper.py", line 185, in run
    raise SSHError(err.strip())
openssh_wrapper.SSHError: format error
tag: value must have a minimum value of 2
400 Parameter verification failed.
net0: invalid format - unable to parse network options

create nodes/pve/qemu -vmid <integer> [OPTIONS]
#

Regards.

LordGaav commented 8 years ago

I was under the impression that all instances must have a VLAN ID, but it seems you can also create them without one. Will see if it's easy to add.

In the mean time, the exception you're getting (value must have minimum value of 2) should be fixed in PVE 4.2-6+.

dorogarcia commented 8 years ago

Yes, because it uses ID "1" by default and this ID in use, if i type 2, everything works but after script creates vm i have to change vlan ID from 2 to empty.

Thanks :)

LordGaav commented 8 years ago

No, that message is actually part of this bug: https://bugzilla.proxmox.com/show_bug.cgi?id=952 .

Proxmox changed the minimum VLAN ID to 2, and enforced this suddenly during 4.1 and 4.2. It should now only generate a warning.

LordGaav commented 8 years ago

I created an pull request (#6) for this issue, but I can't test it at the moment. If you'd like, you can download the PR and test it for me.

dorogarcia commented 8 years ago

It works!

# proxmox-deploy --proxmox-host XXXXXX --proxmox-user XXXX --cloud-images-dir /mnt/nfs/images/
proxmox-deploy version 0.3 (build 7b45fa9) starting...

▽
Asking user for configuration input
Storage to create disk on (Enter ? for a list of options) [test1]:
Amount of CPUs: 1
Emulate which CPU family (Enter ? for a list of options) [host]:
Amount of Memory (MB): 512
Size of disk (GB): 10
Virtual Machine id [100]: 31337
Hostname (a FQDN is recommended): 31337
What Cloud image to upload (Enter ? for a list of options) [/mnt/nfs/images/trusty-server-cloudimg-amd64-disk1.img]:
Locale (Enter ? for a list of options) [en_US.UTF-8]:
Timezone (Enter ? for a list of options) [Europe/Amsterdam]:
Keyboard layout (Enter ? for a list of options) [us]:
SSH Public key for root user [2 entries]:
Run apt-get update after rollout [Yes]:
Run apt-get upgrade after rollout [No]:
Bootstrap with Chef [No]:
Configure networking [Yes]:
VLAN ID [1 or 'empty']: empty
Network device to configure [eth0]:
Network type (Enter ? for a list of options) [dhcp]:
Resize root filesystem [Yes]:
Install extra packages (space separated)) []:
Run commands after cloud init (space separated) []:
Reboot after cloud-init [No]: Yes
Start VM after provisioning [No]: Yes

Starting provisioning process
Creating Virtual Machine
Generating cloud-init seed files at /tmp/cloudinit-seed-isoDc3o5o
Generating cloud-init seed ISO at /tmp/cloudinit-seed-iso-zSn4yj.iso
Removing cloud-init temp files
Uploading cloud-init seed ISO to Proxmox
Uploading to flat storage
Transferring image to Proxmox
Setting disk size to 366K
Allocating virtual disk
Copying image into virtual disk
Removing temporary disk file
Uploading cloud image to Proxmox
Uploading to flat storage
Transferring image to Proxmox
Allocating virtual disk
Copying image into virtual disk
Removing temporary disk file
Resizing virtual disk
Adding serial console to VM
Starting VM
Virtual Machine provisioning completed
#

Thanks.