1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-25 15:45:23 +00:00

Merge pull request #260 from busyrack/master

Max length increased and public port
This commit is contained in:
Anatoliy Guskov 2019-11-20 16:36:52 +02:00 committed by GitHub
commit 68107aee58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 19 deletions

1
.gitignore vendored
View file

@ -3,6 +3,7 @@ venv
.vscode .vscode
.idea .idea
.DS_* .DS_*
.webvirtcloud
*.pyc *.pyc
db.sqlite3* db.sqlite3*
console/cert.pem* console/cert.pem*

View file

@ -6,7 +6,7 @@ from computes.models import Compute
class ComputeAddTcpForm(forms.Form): class ComputeAddTcpForm(forms.Form):
name = forms.CharField(error_messages={'required': _('No hostname has been entered')}, name = forms.CharField(error_messages={'required': _('No hostname has been entered')},
max_length=20) max_length=64)
hostname = forms.CharField(error_messages={'required': _('No IP / Domain name has been entered')}, hostname = forms.CharField(error_messages={'required': _('No IP / Domain name has been entered')},
max_length=100) max_length=100)
login = forms.CharField(error_messages={'required': _('No login has been entered')}, login = forms.CharField(error_messages={'required': _('No login has been entered')},
@ -45,7 +45,7 @@ class ComputeAddTcpForm(forms.Form):
class ComputeAddSshForm(forms.Form): class ComputeAddSshForm(forms.Form):
name = forms.CharField(error_messages={'required': _('No hostname has been entered')}, name = forms.CharField(error_messages={'required': _('No hostname has been entered')},
max_length=20) max_length=64)
hostname = forms.CharField(error_messages={'required': _('No IP / Domain name has been entered')}, hostname = forms.CharField(error_messages={'required': _('No IP / Domain name has been entered')},
max_length=100) max_length=100)
login = forms.CharField(error_messages={'required': _('No login has been entered')}, login = forms.CharField(error_messages={'required': _('No login has been entered')},
@ -82,7 +82,7 @@ class ComputeAddSshForm(forms.Form):
class ComputeAddTlsForm(forms.Form): class ComputeAddTlsForm(forms.Form):
name = forms.CharField(error_messages={'required': _('No hostname has been entered')}, name = forms.CharField(error_messages={'required': _('No hostname has been entered')},
max_length=20) max_length=64)
hostname = forms.CharField(error_messages={'required': _('No IP / Domain name has been entered')}, hostname = forms.CharField(error_messages={'required': _('No IP / Domain name has been entered')},
max_length=100) max_length=100)
login = forms.CharField(error_messages={'required': _('No login has been entered')}, login = forms.CharField(error_messages={'required': _('No login has been entered')},
@ -122,7 +122,7 @@ class ComputeAddTlsForm(forms.Form):
class ComputeEditHostForm(forms.Form): class ComputeEditHostForm(forms.Form):
host_id = forms.CharField() host_id = forms.CharField()
name = forms.CharField(error_messages={'required': _('No hostname has been entered')}, name = forms.CharField(error_messages={'required': _('No hostname has been entered')},
max_length=20) max_length=64)
hostname = forms.CharField(error_messages={'required': _('No IP / Domain name has been entered')}, hostname = forms.CharField(error_messages={'required': _('No IP / Domain name has been entered')},
max_length=100) max_length=100)
login = forms.CharField(error_messages={'required': _('No login has been entered')}, login = forms.CharField(error_messages={'required': _('No login has been entered')},
@ -152,7 +152,7 @@ class ComputeEditHostForm(forms.Form):
class ComputeAddSocketForm(forms.Form): class ComputeAddSocketForm(forms.Form):
name = forms.CharField(error_messages={'required': _('No hostname has been entered')}, name = forms.CharField(error_messages={'required': _('No hostname has been entered')},
max_length=20) max_length=64)
details = forms.CharField(error_messages={'required': _('No details has been entred')}, details = forms.CharField(error_messages={'required': _('No details has been entred')},
max_length=50) max_length=50)

View file

@ -2,8 +2,8 @@ from django.db import models
class Compute(models.Model): class Compute(models.Model):
name = models.CharField(max_length=20) name = models.CharField(max_length=64)
hostname = models.CharField(max_length=20) hostname = models.CharField(max_length=64)
login = models.CharField(max_length=20) login = models.CharField(max_length=20)
password = models.CharField(max_length=14, blank=True, null=True) password = models.CharField(max_length=14, blank=True, null=True)
details = models.CharField(max_length=50, null=True, blank=True) details = models.CharField(max_length=50, null=True, blank=True)

View file

@ -3,7 +3,7 @@ from django.shortcuts import render
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from instances.models import Instance from instances.models import Instance
from vrtManager.instance import wvmInstance from vrtManager.instance import wvmInstance
from webvirtcloud.settings import WS_PORT from webvirtcloud.settings import WS_PUBLIC_PORT
from webvirtcloud.settings import WS_PUBLIC_HOST from webvirtcloud.settings import WS_PUBLIC_HOST
from libvirt import libvirtError from libvirt import libvirtError
@ -38,7 +38,7 @@ def console(request):
console_websocket_port = None console_websocket_port = None
console_passwd = None console_passwd = None
ws_port = console_websocket_port if console_websocket_port else WS_PORT ws_port = console_websocket_port if console_websocket_port else WS_PUBLIC_PORT
ws_host = WS_PUBLIC_HOST if WS_PUBLIC_HOST else request.get_host() ws_host = WS_PUBLIC_HOST if WS_PUBLIC_HOST else request.get_host()
if ':' in ws_host: if ':' in ws_host:

View file

@ -8,7 +8,7 @@ from webvirtcloud.settings import QEMU_CONSOLE_LISTEN_ADDRESSES
class FlavorAddForm(forms.Form): class FlavorAddForm(forms.Form):
label = forms.CharField(label="Name", label = forms.CharField(label="Name",
error_messages={'required': _('No flavor name has been entered')}, error_messages={'required': _('No flavor name has been entered')},
max_length=20) max_length=64)
vcpu = forms.IntegerField(label="VCPU", vcpu = forms.IntegerField(label="VCPU",
error_messages={'required': _('No VCPU has been entered')}, ) error_messages={'required': _('No VCPU has been entered')}, )
disk = forms.IntegerField(label="HDD", disk = forms.IntegerField(label="HDD",
@ -21,7 +21,7 @@ class FlavorAddForm(forms.Form):
have_symbol = re.match('^[a-zA-Z0-9._-]+$', label) have_symbol = re.match('^[a-zA-Z0-9._-]+$', label)
if not have_symbol: if not have_symbol:
raise forms.ValidationError(_('The flavor name must not contain any special characters')) raise forms.ValidationError(_('The flavor name must not contain any special characters'))
elif len(label) > 20: elif len(label) > 64:
raise forms.ValidationError(_('The flavor name must not exceed 20 characters')) raise forms.ValidationError(_('The flavor name must not exceed 20 characters'))
try: try:
Flavor.objects.get(label=label) Flavor.objects.get(label=label)
@ -32,7 +32,7 @@ class FlavorAddForm(forms.Form):
class NewVMForm(forms.Form): class NewVMForm(forms.Form):
name = forms.CharField(error_messages={'required': _('No Virtual Machine name has been entered')}, name = forms.CharField(error_messages={'required': _('No Virtual Machine name has been entered')},
max_length=20) max_length=64)
vcpu = forms.IntegerField(error_messages={'required': _('No VCPU has been entered')}) vcpu = forms.IntegerField(error_messages={'required': _('No VCPU has been entered')})
host_model = forms.BooleanField(required=False) host_model = forms.BooleanField(required=False)
disk = forms.IntegerField(required=False) disk = forms.IntegerField(required=False)
@ -57,7 +57,7 @@ class NewVMForm(forms.Form):
have_symbol = re.match('^[a-zA-Z0-9._-]+$', name) have_symbol = re.match('^[a-zA-Z0-9._-]+$', name)
if not have_symbol: if not have_symbol:
raise forms.ValidationError(_('The name of the virtual machine must not contain any special characters')) raise forms.ValidationError(_('The name of the virtual machine must not contain any special characters'))
elif len(name) > 20: elif len(name) > 64:
raise forms.ValidationError(_('The name of the virtual machine must not exceed 20 characters')) raise forms.ValidationError(_('The name of the virtual machine must not exceed 20 characters'))
return name return name

View file

@ -105,7 +105,7 @@
<label class="col-sm-3 control-label">{% trans "Name" %}</label> <label class="col-sm-3 control-label">{% trans "Name" %}</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input type="text" class="form-control" name="name" <input type="text" class="form-control" name="name"
placeholder="{% trans "Name" %}" maxlength="14" required placeholder="{% trans "Name" %}" maxlength="64" required
pattern="[a-zA-Z0-9\.\-_]+"> pattern="[a-zA-Z0-9\.\-_]+">
<input type="hidden" name="vcpu" value="{{ flavor.vcpu }}"> <input type="hidden" name="vcpu" value="{{ flavor.vcpu }}">
<input type="hidden" name="memory" value="{{ flavor.memory }}"> <input type="hidden" name="memory" value="{{ flavor.memory }}">
@ -183,7 +183,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">{% trans "Console Password" %}</label> <label class="col-sm-3 control-label">{% trans "Console Password" %}</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input type="password" class="form-control" name="console_pass" placeholder="{% trans "Console Password" %}" maxlength="14"> <input type="password" class="form-control" name="console_pass" placeholder="{% trans "Console Password" %}" maxlength="64">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -255,7 +255,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">{% trans "Name" %}</label> <label class="col-sm-3 control-label">{% trans "Name" %}</label>
<div class="col-sm-7"> <div class="col-sm-7">
<input type="text" class="form-control" name="name" placeholder="{% trans "Name" %}" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+"> <input type="text" class="form-control" name="name" placeholder="{% trans "Name" %}" maxlength="64" required pattern="[a-zA-Z0-9\.\-_]+">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -368,7 +368,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">{% trans "Console Password" %}</label> <label class="col-sm-3 control-label">{% trans "Console Password" %}</label>
<div class="col-sm-7"> <div class="col-sm-7">
<input type="password" class="form-control" name="console_pass" placeholder="{% trans "Console Password" %}" maxlength="14"> <input type="password" class="form-control" name="console_pass" placeholder="{% trans "Console Password" %}" maxlength="64">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -413,7 +413,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">{% trans "Name" %}</label> <label class="col-sm-3 control-label">{% trans "Name" %}</label>
<div class="col-sm-7"> <div class="col-sm-7">
<input type="text" class="form-control" name="name" placeholder="{% trans "Name" %}" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+"> <input type="text" class="form-control" name="name" placeholder="{% trans "Name" %}" maxlength="64" required pattern="[a-zA-Z0-9\.\-_]+">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -527,7 +527,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">{% trans "Console Password" %}</label> <label class="col-sm-3 control-label">{% trans "Console Password" %}</label>
<div class="col-sm-7"> <div class="col-sm-7">
<input type="password" class="form-control" name="console_pass" placeholder="{% trans "Console Password" %}" maxlength="14"> <input type="password" class="form-control" name="console_pass" placeholder="{% trans "Console Password" %}" maxlength="64">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">

View file

@ -104,6 +104,9 @@ WS_PORT = 6080
WS_HOST = '0.0.0.0' WS_HOST = '0.0.0.0'
# Websock public port # Websock public port
WS_PUBLIC_PORT = '443'
# Websock public host
WS_PUBLIC_HOST = None WS_PUBLIC_HOST = None
# Websock SSL connection # Websock SSL connection