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

Libxml2 converted to lxml, django framework upgrade to 1.11.x and some bug fixes

This commit is contained in:
catborise 2018-06-27 10:20:51 +03:00
parent beea57189c
commit ace30ca952
16 changed files with 265 additions and 106 deletions

1
.gitignore vendored
View file

@ -9,3 +9,4 @@ console/cert.pem*
tags tags
dhcpd.* dhcpd.*
webvirtcloud/settings.py webvirtcloud/settings.py
*migrations/*

View file

@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-06-25 12:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0009_auto_20171026_0805'),
]
operations = [
migrations.AlterField(
model_name='userattributes',
name='max_cpus',
field=models.IntegerField(default=1, help_text=b'-1 for unlimited. Any integer value'),
),
migrations.AlterField(
model_name='userattributes',
name='max_disk_size',
field=models.IntegerField(default=20, help_text=b'-1 for unlimited. Any integer value'),
),
migrations.AlterField(
model_name='userattributes',
name='max_instances',
field=models.IntegerField(default=1, help_text=b'-1 for unlimited. Any integer value'),
),
migrations.AlterField(
model_name='userattributes',
name='max_memory',
field=models.IntegerField(default=2048, help_text=b'-1 for unlimited. Any integer value'),
),
]

View file

@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-06-25 13:13
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0010_auto_20180625_1236'),
]
operations = [
migrations.AlterField(
model_name='userattributes',
name='max_cpus',
field=models.IntegerField(default=1, help_text=b'-1 for unlimited. Any integer value', validators=[django.core.validators.MinValueValidator(-1)]),
),
migrations.AlterField(
model_name='userattributes',
name='max_disk_size',
field=models.IntegerField(default=20, help_text=b'-1 for unlimited. Any integer value', validators=[django.core.validators.MinValueValidator(-1)]),
),
migrations.AlterField(
model_name='userattributes',
name='max_instances',
field=models.IntegerField(default=1, help_text=b'-1 for unlimited. Any integer value', validators=[django.core.validators.MinValueValidator(-1)]),
),
migrations.AlterField(
model_name='userattributes',
name='max_memory',
field=models.IntegerField(default=2048, help_text=b'-1 for unlimited. Any integer value', validators=[django.core.validators.MinValueValidator(-1)]),
),
]

View file

@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-06-25 13:31
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import re
class Migration(migrations.Migration):
dependencies = [
('accounts', '0011_auto_20180625_1313'),
]
operations = [
migrations.AlterField(
model_name='userattributes',
name='max_cpus',
field=models.IntegerField(default=1, help_text=b'-1 for unlimited. Any integer value', validators=[django.core.validators.RegexValidator(re.compile('^-?\\d+\\Z'), code='invalid', message='Enter a valid integer.')]),
),
migrations.AlterField(
model_name='userattributes',
name='max_disk_size',
field=models.IntegerField(default=20, help_text=b'-1 for unlimited. Any integer value', validators=[django.core.validators.RegexValidator(re.compile('^-?\\d+\\Z'), code='invalid', message='Enter a valid integer.')]),
),
migrations.AlterField(
model_name='userattributes',
name='max_instances',
field=models.IntegerField(default=1, help_text=b'-1 for unlimited. Any integer value', validators=[django.core.validators.RegexValidator(re.compile('^-?\\d+\\Z'), code='invalid', message='Enter a valid integer.')]),
),
migrations.AlterField(
model_name='userattributes',
name='max_memory',
field=models.IntegerField(default=2048, help_text=b'-1 for unlimited. Any integer value', validators=[django.core.validators.RegexValidator(re.compile('^-?\\d+\\Z'), code='invalid', message='Enter a valid integer.')]),
),
]

View file

@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-06-25 13:58
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import re
class Migration(migrations.Migration):
dependencies = [
('accounts', '0012_auto_20180625_1331'),
]
operations = [
migrations.AlterField(
model_name='userattributes',
name='max_cpus',
field=models.IntegerField(default=1, help_text=b'-1 for unlimited. Any integer value', validators=[django.core.validators.RegexValidator(re.compile('^-?\\d+\\Z'), code='invalid', message='Enter a valid integer.'), django.core.validators.MinValueValidator(-1)]),
),
migrations.AlterField(
model_name='userattributes',
name='max_disk_size',
field=models.IntegerField(default=20, help_text=b'-1 for unlimited. Any integer value', validators=[django.core.validators.RegexValidator(re.compile('^-?\\d+\\Z'), code='invalid', message='Enter a valid integer.'), django.core.validators.MinValueValidator(-1)]),
),
migrations.AlterField(
model_name='userattributes',
name='max_instances',
field=models.IntegerField(default=1, help_text=b'-1 for unlimited. Any integer value', validators=[django.core.validators.RegexValidator(re.compile('^-?\\d+\\Z'), code='invalid', message='Enter a valid integer.'), django.core.validators.MinValueValidator(-1)]),
),
migrations.AlterField(
model_name='userattributes',
name='max_memory',
field=models.IntegerField(default=2048, help_text=b'-1 for unlimited. Any integer value', validators=[django.core.validators.RegexValidator(re.compile('^-?\\d+\\Z'), code='invalid', message='Enter a valid integer.'), django.core.validators.MinValueValidator(-1)]),
),
]

View file

@ -2,6 +2,7 @@ from django.db import models
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.conf import settings from django.conf import settings
from instances.models import Instance from instances.models import Instance
from django.core.validators import integer_validator, MinValueValidator
class UserInstance(models.Model): class UserInstance(models.Model):
@ -26,10 +27,10 @@ class UserSSHKey(models.Model):
class UserAttributes(models.Model): class UserAttributes(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE) user = models.OneToOneField(User, on_delete=models.CASCADE)
can_clone_instances = models.BooleanField(default=True) can_clone_instances = models.BooleanField(default=True)
max_instances = models.IntegerField(default=1) max_instances = models.IntegerField(default=1, help_text="-1 for unlimited. Any integer value", validators=[integer_validator,MinValueValidator(-1),])
max_cpus = models.IntegerField(default=1) max_cpus = models.IntegerField(default=1, help_text="-1 for unlimited. Any integer value", validators=[integer_validator,MinValueValidator(-1)])
max_memory = models.IntegerField(default=2048) max_memory = models.IntegerField(default=2048, help_text="-1 for unlimited. Any integer value", validators=[integer_validator,MinValueValidator(-1)])
max_disk_size = models.IntegerField(default=20) max_disk_size = models.IntegerField(default=20, help_text="-1 for unlimited. Any integer value", validators=[integer_validator,MinValueValidator(-1)])
@staticmethod @staticmethod
def create_missing_userattributes(user): def create_missing_userattributes(user):

View file

@ -92,25 +92,25 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label">{% trans "Max instances" %}</label> <label class="col-sm-4 control-label">{% trans "Max instances" %}</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input type="text" name="userattributes_max_instances" class="form-control" value="{{ user.userattributes.max_instances }}"> <input type="text" name="userattributes_max_instances" class="form-control" value="{{ user.userattributes.max_instances}}" required="True" >
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label">{% trans "Max cpus" %}</label> <label class="col-sm-4 control-label">{% trans "Max cpus" %}</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input type="text" name="userattributes_max_cpus" class="form-control" value="{{ user.userattributes.max_cpus }}"> <input type="text" name="userattributes_max_cpus" class="form-control" value="{{ user.userattributes.max_cpus }}" required="True">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label">{% trans "Max memory (MB)" %}</label> <label class="col-sm-4 control-label">{% trans "Max memory (MB)" %}</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input type="text" name="userattributes_max_memory" class="form-control" value="{{ user.userattributes.max_memory }}"> <input type="text" name="userattributes_max_memory" class="form-control" value="{{ user.userattributes.max_memory}}" required="True">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label">{% trans "Max disk size (GB)" %}</label> <label class="col-sm-4 control-label">{% trans "Max disk size (GB)" %}</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input type="text" name="userattributes_max_disk_size" class="form-control" value="{{ user.userattributes.max_disk_size }}"> <input type="text" name="userattributes_max_disk_size" class="form-control" value="{{ user.userattributes.max_disk_size }}" required="True">
</div> </div>
</div> </div>
</div> </div>

View file

@ -1,12 +1,11 @@
from django.conf.urls import url from django.conf.urls import url
from django.contrib import auth
from django.contrib.auth import views as auth_views
from . import views from . import views
urlpatterns = [ urlpatterns = [
url(r'^login/$', 'django.contrib.auth.views.login', url(r'^login/$', auth_views.LoginView.as_view(template_name='login.html'), name='login'),
{'template_name': 'login.html'}, name='login'), url(r'^logout/$', auth_views.LogoutView.as_view(template_name='logout.html'), name='logout'),
url(r'^logout/$', 'django.contrib.auth.views.logout', url(r'^profile/$', views.profile, name='profile'), url(r'^$', views.accounts, name='accounts'),
{'template_name': 'logout.html'}, name='logout'),
url(r'^profile/$', views.profile, name='profile'),
url(r'^$', views.accounts, name='accounts'),
url(r'^profile/(?P<user_id>[0-9]+)/$', views.account, name='account'), url(r'^profile/(?P<user_id>[0-9]+)/$', views.account, name='account'),
] ]

View file

@ -8,6 +8,8 @@ from accounts.models import *
from instances.models import Instance from instances.models import Instance
from accounts.forms import UserAddForm from accounts.forms import UserAddForm
from django.conf import settings from django.conf import settings
from django.core.validators import ValidationError
@login_required @login_required
@ -92,21 +94,30 @@ def accounts(request):
UserAttributes.configure_user(new_user) UserAttributes.configure_user(new_user)
return HttpResponseRedirect(request.get_full_path()) return HttpResponseRedirect(request.get_full_path())
if 'edit' in request.POST: if 'edit' in request.POST:
CHECKBOX_MAPPING = {'on': True, 'off': False, }
user_id = request.POST.get('user_id', '') user_id = request.POST.get('user_id', '')
user_pass = request.POST.get('user_pass', '') user_pass = request.POST.get('user_pass', '')
user_edit = User.objects.get(id=user_id) user_edit = User.objects.get(id=user_id)
user_edit.set_password(user_pass)
user_edit.is_staff = request.POST.get('user_is_staff', False) if user_pass != '': user_edit.set_password(user_pass)
user_edit.is_superuser = request.POST.get('user_is_superuser', False) user_edit.is_staff = CHECKBOX_MAPPING.get(request.POST.get('user_is_staff', 'off'))
user_edit.is_superuser = CHECKBOX_MAPPING.get(request.POST.get('user_is_superuser', 'off'))
user_edit.save() user_edit.save()
userattributes = user_edit.userattributes UserAttributes.create_missing_userattributes(user_edit)
userattributes.can_clone_instances = request.POST.get('userattributes_can_clone_instances', False) user_edit.userattributes.can_clone_instances = CHECKBOX_MAPPING.get(request.POST.get('userattributes_can_clone_instances', 'off'))
userattributes.max_instances = request.POST.get('userattributes_max_instances', 0) user_edit.userattributes.max_instances = request.POST.get('userattributes_max_instances', 0)
userattributes.max_cpus = request.POST.get('userattributes_max_cpus', 0) user_edit.userattributes.max_cpus = request.POST.get('userattributes_max_cpus', 0)
userattributes.max_memory = request.POST.get('userattributes_max_memory', 0) user_edit.userattributes.max_memory = request.POST.get('userattributes_max_memory', 0)
userattributes.max_disk_size = request.POST.get('userattributes_max_disk_size', 0) user_edit.userattributes.max_disk_size = request.POST.get('userattributes_max_disk_size', 0)
userattributes.save()
try:
user_edit.userattributes.clean_fields()
except ValidationError as exc:
error_messages.append(exc)
else:
user_edit.userattributes.save()
return HttpResponseRedirect(request.get_full_path()) return HttpResponseRedirect(request.get_full_path())
if 'block' in request.POST: if 'block' in request.POST:
user_id = request.POST.get('user_id', '') user_id = request.POST.get('user_id', '')

View file

@ -123,7 +123,7 @@ def computes(request):
compute_edit.hostname = data['hostname'] compute_edit.hostname = data['hostname']
compute_edit.login = data['login'] compute_edit.login = data['login']
compute_edit.password = data['password'] compute_edit.password = data['password']
compute.edit_details = data['details'] #compute_edit.details = data['details']
compute_edit.save() compute_edit.save()
return HttpResponseRedirect(request.get_full_path()) return HttpResponseRedirect(request.get_full_path())
else: else:

View file

@ -444,8 +444,8 @@ class wvmConnect(object):
def get_net_device(self): def get_net_device(self):
netdevice = [] netdevice = []
def get_info(ctx): def get_info(ctx):
dev_type = util.get_xpath(ctx, '/device/capability/@type') dev_type = util.get_xpath('/device/capability/@type')
interface = util.get_xpath(ctx, '/device/capability/interface') interface = util.get_xpath('/device/capability/interface')
return (dev_type, interface) return (dev_type, interface)
for dev in self.wvm.listAllDevices(0): for dev in self.wvm.listAllDevices(0):
xml = dev.XMLDesc(0) xml = dev.XMLDesc(0)
@ -456,17 +456,17 @@ class wvmConnect(object):
def get_host_instances(self): def get_host_instances(self):
vname = {} vname = {}
def get_info(ctx): def get_info(doc):
mem = util.get_xpath(ctx, "/domain/currentMemory") mem = util.get_xpath(doc, "/domain/currentMemory")
mem = int(mem) / 1024 mem = int(mem) / 1024
cur_vcpu = util.get_xpath(ctx, "/domain/vcpu/@current") cur_vcpu = util.get_xpath(doc, "/domain/vcpu/@current")
if cur_vcpu: if cur_vcpu:
vcpu = cur_vcpu vcpu = cur_vcpu
else: else:
vcpu = util.get_xpath(ctx, "/domain/vcpu") vcpu = util.get_xpath(doc, "/domain/vcpu")
title = util.get_xpath(ctx, "/domain/title") title = util.get_xpath(doc, "/domain/title")
title = title if title else '' title = title if title else ''
description = util.get_xpath(ctx, "/domain/description") description = util.get_xpath(doc, "/domain/description")
description = description if description else '' description = description if description else ''
return (mem, vcpu, title, description) return (mem, vcpu, title, description)
for name in self.get_instances(): for name in self.get_instances():

View file

@ -3,11 +3,11 @@ from vrtManager.connection import wvmConnect
from vrtManager.util import get_xml_path from vrtManager.util import get_xml_path
def cpu_version(ctx): def cpu_version(doc):
for info in ctx.xpathEval('/sysinfo/processor/entry'): for info in doc.xpath('/sysinfo/processor/entry'):
elem = info.xpathEval('@name')[0].content elem = info.xpath('@name')[0]
if elem == 'version': if elem == 'version':
return info.content return info
return 'Unknown' return 'Unknown'

View file

@ -203,10 +203,10 @@ class wvmInstance(wvmConnect):
def get_net_device(self): def get_net_device(self):
def get_mac_ipaddr(net, mac_host): def get_mac_ipaddr(net, mac_host):
def fixed(ctx): def fixed(doc):
for net in ctx.xpathEval('/network/ip/dhcp/host'): for net in doc.xpath('/network/ip/dhcp/host'):
mac = net.xpathEval('@mac')[0].content mac = net.xpath('@mac')[0]
host = net.xpathEval('@ip')[0].content host = net.xpath('@ip')[0]
if mac == mac_host: if mac == mac_host:
return host return host
return None return None
@ -215,9 +215,9 @@ class wvmInstance(wvmConnect):
def networks(ctx): def networks(ctx):
result = [] result = []
for net in ctx.xpathEval('/domain/devices/interface'): for net in ctx.xpath('/domain/devices/interface'):
mac_host = net.xpathEval('mac/@address')[0].content mac_host = net.xpath('mac/@address')[0]
nic_host = net.xpathEval('source/@network|source/@bridge|source/@dev|target/@dev')[0].content nic_host = net.xpath('source/@network|source/@bridge|source/@dev|target/@dev')[0]
try: try:
net = self.get_network(nic_host) net = self.get_network(nic_host)
ip = get_mac_ipaddr(net, mac_host) ip = get_mac_ipaddr(net, mac_host)
@ -229,7 +229,7 @@ class wvmInstance(wvmConnect):
return util.get_xml_path(self._XMLDesc(0), func=networks) return util.get_xml_path(self._XMLDesc(0), func=networks)
def get_disk_device(self): def get_disk_device(self):
def disks(ctx): def disks(doc):
result = [] result = []
dev = None dev = None
volume = None volume = None
@ -237,13 +237,14 @@ class wvmInstance(wvmConnect):
src_fl = None src_fl = None
disk_format = None disk_format = None
disk_size = None disk_size = None
for disk in ctx.xpathEval('/domain/devices/disk'):
device = disk.xpathEval('@device')[0].content for disk in doc.xpath('/domain/devices/disk'):
device = disk.xpath('@device')[0]
if device == 'disk': if device == 'disk':
try: try:
dev = disk.xpathEval('target/@dev')[0].content dev = disk.xpath('target/@dev')[0]
src_fl = disk.xpathEval('source/@file|source/@dev|source/@name|source/@volume')[0].content src_fl = disk.xpath('source/@file|source/@dev|source/@name|source/@volume')[0]
disk_format = disk.xpathEval('driver/@type')[0].content disk_format = disk.xpath('driver/@type')[0]
try: try:
vol = self.get_volume_by_path(src_fl) vol = self.get_volume_by_path(src_fl)
volume = vol.name() volume = vol.name()
@ -263,19 +264,19 @@ class wvmInstance(wvmConnect):
return util.get_xml_path(self._XMLDesc(0), func=disks) return util.get_xml_path(self._XMLDesc(0), func=disks)
def get_media_device(self): def get_media_device(self):
def disks(ctx): def disks(doc):
result = [] result = []
dev = None dev = None
volume = None volume = None
storage = None storage = None
src_fl = None src_fl = None
for media in ctx.xpathEval('/domain/devices/disk'): for media in doc.xpath('/domain/devices/disk'):
device = media.xpathEval('@device')[0].content device = media.xpath('@device')[0]
if device == 'cdrom': if device == 'cdrom':
try: try:
dev = media.xpathEval('target/@dev')[0].content dev = media.xpath('target/@dev')
try: try:
src_fl = media.xpathEval('source/@file')[0].content src_fl = media.xpath('source/@file')
vol = self.get_volume_by_path(src_fl) vol = self.get_volume_by_path(src_fl)
volume = vol.name() volume = vol.name()
stg = vol.storagePoolLookupByVolume() stg = vol.storagePoolLookupByVolume()
@ -487,8 +488,7 @@ class wvmInstance(wvmConnect):
return socket return socket
def get_console_type(self): def get_console_type(self):
console_type = util.get_xml_path(self._XMLDesc(0), console_type = util.get_xml_path(self._XMLDesc(0),"/domain/devices/graphics/@type")
"/domain/devices/graphics/@type")
return console_type return console_type
def set_console_type(self, console_type): def set_console_type(self, console_type):

View file

@ -166,11 +166,11 @@ class wvmNetwork(wvmConnect):
return bool(util.get_xml_path(xml, "/network/ip/dhcp/bootp/@file")) return bool(util.get_xml_path(xml, "/network/ip/dhcp/bootp/@file"))
def get_mac_ipaddr(self): def get_mac_ipaddr(self):
def network(ctx): def network(doc):
result = [] result = []
for net in ctx.xpathEval('/network/ip/dhcp/host'): for net in doc.xpath('/network/ip/dhcp/host'):
host = net.xpathEval('@ip')[0].content host = net.xpath('@ip')[0].text
mac = net.xpathEval('@mac')[0].content mac = net.xpathEval('@mac')[0].text
result.append({'host': host, 'mac': mac}) result.append({'host': host, 'mac': mac})
return result return result

View file

@ -1,5 +1,5 @@
import random import random
import libxml2 import lxml.etree as etree
import libvirt import libvirt
import string import string
@ -86,42 +86,44 @@ def get_xml_path(xml, path=None, func=None):
of a passed function (receives xpathContext as its only arg) of a passed function (receives xpathContext as its only arg)
""" """
doc = None doc = None
ctx = None #ctx = None
result = None result = None
try: #try:
doc = libxml2.parseDoc(xml) doc = etree.fromstring(xml)
ctx = doc.xpathNewContext() #ctx = doc.xpathNewContext()
if path: if path:
result = get_xpath(ctx, path) result = get_xpath(doc, path)
elif func: elif func:
result = func(ctx) result = func(doc)
else: else:
raise ValueError("'path' or 'func' is required.") raise ValueError("'path' or 'func' is required.")
finally: #finally:
if doc: #if doc:
doc.freeDoc() # doc.freeDoc()
if ctx: #if ctx:
ctx.xpathFreeContext() # ctx.xpathFreeContext()
return result return result
def get_xpath(ctx, path): def get_xpath(doc, path):
result = None result = None
ret = ctx.xpathEval(path)
ret = doc.xpath(path)
if ret is not None: if ret is not None:
if type(ret) == list: if type(ret) == list:
if len(ret) >= 1: if len(ret) >= 1:
result = ret[0].content if hasattr(ret[0],'text'):
result = ret[0].text
else:
result = ret[0]
else: else:
result = ret result = ret
return result return result
def pretty_mem(val): def pretty_mem(val):
val = int(val) val = int(val)
if val > (10 * 1024 * 1024): if val > (10 * 1024 * 1024):

View file

@ -1,9 +1,17 @@
from django.conf.urls import patterns, include, url from django.conf.urls import include, url
from instances.views import instances, instance, index
from storages.views import storages, storage
from networks.views import networks, network
from secrets.views import secrets
from create.views import create_instance
from interfaces.views import interfaces, interface
from console.views import console
# from django.contrib import admin # from django.contrib import admin
urlpatterns = patterns('', urlpatterns = [
url(r'^$', 'instances.views.index', name='index'), url(r'^$', index, name='index'),
url(r'^instances/$', 'instances.views.instances', name='instances'), url(r'^instances/$', instances, name='instances'),
url(r'^instance/', include('instances.urls')), url(r'^instance/', include('instances.urls')),
url(r'^accounts/', include('accounts.urls')), url(r'^accounts/', include('accounts.urls')),
@ -11,23 +19,15 @@ urlpatterns = patterns('',
url(r'^logs/', include('logs.urls')), url(r'^logs/', include('logs.urls')),
url(r'^datasource/', include('datasource.urls')), url(r'^datasource/', include('datasource.urls')),
url(r'^compute/(?P<compute_id>[0-9]+)/storages/$', url(r'^compute/(?P<compute_id>[0-9]+)/storages/$', storages, name='storages'),
'storages.views.storages', name='storages'), url(r'^compute/(?P<compute_id>[0-9]+)/storage/(?P<pool>[\w\-\.\/]+)/$', storage, name='storage'),
url(r'^compute/(?P<compute_id>[0-9]+)/storage/(?P<pool>[\w\-\.\/]+)/$', url(r'^compute/(?P<compute_id>[0-9]+)/networks/$', networks, name='networks'),
'storages.views.storage', name='storage'), url(r'^compute/(?P<compute_id>[0-9]+)/network/(?P<pool>[\w\-\.]+)/$', network, name='network'),
url(r'^compute/(?P<compute_id>[0-9]+)/networks/$', url(r'^compute/(?P<compute_id>[0-9]+)/interfaces/$', interfaces, name='interfaces'),
'networks.views.networks', name='networks'), url(r'^compute/(?P<compute_id>[0-9]+)/interface/(?P<iface>[\w\-\.\:]+)/$', interface, name='interface'),
url(r'^compute/(?P<compute_id>[0-9]+)/network/(?P<pool>[\w\-\.]+)/$', url(r'^compute/(?P<compute_id>[0-9]+)/secrets/$', secrets, name='secrets'),
'networks.views.network', name='network'), url(r'^compute/(?P<compute_id>[0-9]+)/create/$', create_instance, name='create_instance'),
url(r'^compute/(?P<compute_id>[0-9]+)/interfaces/$',
'interfaces.views.interfaces', name='interfaces'),
url(r'^compute/(?P<compute_id>[0-9]+)/interface/(?P<iface>[\w\-\.\:]+)/$',
'interfaces.views.interface', name='interface'),
url(r'^compute/(?P<compute_id>[0-9]+)/secrets/$',
'secrets.views.secrets', name='secrets'),
url(r'^compute/(?P<compute_id>[0-9]+)/create/$',
'create.views.create_instance', name='create_instance'),
url(r'^console/$', 'console.views.console', name='console'), url(r'^console/$', console, name='console'),
# (r'^admin/', include(admin.site.urls)), # (r'^admin/', include(admin.site.urls)),
) ]