From e6f011690894f86b048005d8183e8d56bc8fb603 Mon Sep 17 00:00:00 2001 From: Anatoliy Guskov Date: Fri, 27 Nov 2015 09:38:04 +0200 Subject: [PATCH 1/4] Fixed Checking KVM --- vrtManager/util.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/vrtManager/util.py b/vrtManager/util.py index b152e92..939e5b7 100644 --- a/vrtManager/util.py +++ b/vrtManager/util.py @@ -1,12 +1,11 @@ -import re import random import libxml2 import libvirt def is_kvm_available(xml): - capabilites = re.search('kvm', xml) - if capabilites: + kvm_domains = get_xml_path(xml, "//domain/@type='kvm'") + if kvm_domains > 0: return True else: return False From 84fe28e9d7998ababa1127321266ae10cbfcdbad Mon Sep 17 00:00:00 2001 From: andrem Date: Thu, 17 Mar 2016 17:19:55 -0300 Subject: [PATCH 2/4] adjust path to storage for url. --- webvirtcloud/urls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webvirtcloud/urls.py b/webvirtcloud/urls.py index 2acb208..0eff1a5 100644 --- a/webvirtcloud/urls.py +++ b/webvirtcloud/urls.py @@ -11,7 +11,7 @@ urlpatterns = patterns('', url(r'^compute/(?P[0-9]+)/storages/$', 'storages.views.storages', name='storages'), - url(r'^compute/(?P[0-9]+)/storage/(?P[\w\-\.]+)/$', + url(r'^compute/(?P[0-9]+)/storage/(?P[\w\-\.\/]+)/$', 'storages.views.storage', name='storage'), url(r'^compute/(?P[0-9]+)/networks/$', 'networks.views.networks', name='networks'), From fc56e66555ca7c365381ad2a39ec83df6f45a39f Mon Sep 17 00:00:00 2001 From: andrem Date: Fri, 18 Mar 2016 12:07:42 -0300 Subject: [PATCH 3/4] add migration for new column details for hypervisor. --- computes/migrations/0002_compute_details.py | 18 ++++++++++++++++++ computes/models.py | 1 + 2 files changed, 19 insertions(+) create mode 100644 computes/migrations/0002_compute_details.py diff --git a/computes/migrations/0002_compute_details.py b/computes/migrations/0002_compute_details.py new file mode 100644 index 0000000..1e0fdf5 --- /dev/null +++ b/computes/migrations/0002_compute_details.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + +class Migration(migrations.Migration): + + dependencies = [ + ('computes', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='Compute', + name='details', + field=models.CharField(max_length=50, null=True, blank=True), + ), + ] diff --git a/computes/models.py b/computes/models.py index 6ee7de8..df9bf02 100644 --- a/computes/models.py +++ b/computes/models.py @@ -6,6 +6,7 @@ class Compute(models.Model): hostname = models.CharField(max_length=20) login = models.CharField(max_length=20) password = models.CharField(max_length=14, blank=True, null=True) + details = models.CharField(max_length=50, null=True, blank=True) type = models.IntegerField() def __unicode__(self): From b6350e134e2c6ecf185de8af9398facf1f6c99a6 Mon Sep 17 00:00:00 2001 From: andrem Date: Fri, 18 Mar 2016 15:21:44 -0300 Subject: [PATCH 4/4] add details for local socket --- computes/forms.py | 2 ++ computes/templates/computes.html | 5 +++++ computes/templates/create_comp_block.html | 10 +++++++++- computes/templates/overview.html | 2 ++ computes/views.py | 7 +++++-- webvirtcloud/settings.py | 2 +- 6 files changed, 24 insertions(+), 4 deletions(-) diff --git a/computes/forms.py b/computes/forms.py index a626106..7dfcbe6 100644 --- a/computes/forms.py +++ b/computes/forms.py @@ -149,6 +149,8 @@ class ComputeEditHostForm(forms.Form): class ComputeAddSocketForm(forms.Form): name = forms.CharField(error_messages={'required': _('No hostname has been entered')}, max_length=20) + details = forms.CharField(error_messages={'required': _('No details has been entred')}, + max_length=50) def clean_name(self): name = self.cleaned_data['name'] diff --git a/computes/templates/computes.html b/computes/templates/computes.html index 7c1c28f..2ffc6f4 100644 --- a/computes/templates/computes.html +++ b/computes/templates/computes.html @@ -45,6 +45,11 @@ {% else %}

{% trans "Not Connected" %}

{% endif %} + {% if compute.details %} +

{% trans compute.details %}

+ {% else %} +

{% trans "No details available" %}

+ {% endif %} diff --git a/computes/templates/create_comp_block.html b/computes/templates/create_comp_block.html index 57e327a..9e9a965 100644 --- a/computes/templates/create_comp_block.html +++ b/computes/templates/create_comp_block.html @@ -141,6 +141,14 @@ + +
+ +
+ +
+
+ -{% endif %} \ No newline at end of file +{% endif %} diff --git a/computes/templates/overview.html b/computes/templates/overview.html index 09d5d83..8bfad6e 100644 --- a/computes/templates/overview.html +++ b/computes/templates/overview.html @@ -40,6 +40,7 @@

{% trans "Logical CPUs" %}

{% trans "Processor" %}

{% trans "Connection" %}

+

{% trans "Details" %}

{{ hostname }}

@@ -49,6 +50,7 @@

{{ logical_cpu }}

{{ model_cpu }}

{{ uri_conn }}

+

{{ compute.details }}

diff --git a/computes/views.py b/computes/views.py index 39af4d0..30d81b3 100644 --- a/computes/views.py +++ b/computes/views.py @@ -36,14 +36,15 @@ def computes(request): 'status': connection_manager.host_is_up(compute.type, compute.hostname), 'type': compute.type, 'login': compute.login, - 'password': compute.password + 'password': compute.password, + 'details': compute.details }) return compute_data error_messages = [] computes = Compute.objects.filter() computes_info = get_hosts_status(computes) - + if request.method == 'POST': if 'host_del' in request.POST: compute_id = request.POST.get('host_id', '') @@ -104,6 +105,7 @@ def computes(request): if form.is_valid(): data = form.cleaned_data new_socket_host = Compute(name=data['name'], + details=data['details'], hostname='localhost', type=CONN_SOCKET, login='', @@ -122,6 +124,7 @@ def computes(request): compute_edit.hostname = data['hostname'] compute_edit.login = data['login'] compute_edit.password = data['password'] + compute.edit_details = data['details'] compute_edit.save() return HttpResponseRedirect(request.get_full_path()) else: diff --git a/webvirtcloud/settings.py b/webvirtcloud/settings.py index a163fa3..d318ea9 100644 --- a/webvirtcloud/settings.py +++ b/webvirtcloud/settings.py @@ -8,7 +8,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(__file__)) SECRET_KEY = '4y(f4rfqc6f2!i8_vfuu)kav6tdv5#sc=n%o451dm+th0&3uci' -DEBUG = False +DEBUG = True TEMPLATE_DEBUG = DEBUG