Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: python
python:
- "2.7"
env:
- DJANGO=1.11.14
- DJANGO=1.11.21
install:
- pip install -r dev/requirements.txt
script:
Expand Down
45 changes: 40 additions & 5 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
# vi: set ft=ruby :

Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.hostname = "webvirtcloud"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.provision "shell", inline: <<-SHELL
# Default machine, if name not specified...
config.vm.define "dev", primary: true do |dev|
dev.vm.box = "ubuntu/bionic64"
dev.vm.hostname = "webvirtcloud"
dev.vm.network "private_network", ip: "192.168.33.10"
dev.vm.provision "shell", inline: <<-SHELL
sudo sh /vagrant/dev/libvirt-bootstrap.sh
sudo sed -i 's/auth_tcp = \"sasl\"/auth_tcp = \"none\"/g' /etc/libvirt/libvirtd.conf
sudo service libvirt-bin restart
Expand All @@ -14,5 +16,38 @@ Vagrant.configure(2) do |config|
virtualenv /vagrant/venv
source /vagrant/venv/bin/activate
pip install -r /vagrant/dev/requirements.txt
SHELL
SHELL
end
# To start this machine run "vagrant up prod"
# To enter this machine run "vagrant ssh prod"
config.vm.define "prod", autostart: false do |prod|
prod.vm.box = "ubuntu/bionic64"
prod.vm.hostname = "webvirtcloud"
prod.vm.network "private_network", ip: "192.168.33.11"
#prod.vm.synced_folder ".", "/srv/webvirtcloud"
prod.vm.provision "shell", inline: <<-SHELL
sudo mkdir /srv/webvirtcloud
sudo cp -R /vagrant/* /srv/webvirtcloud
sudo sh /srv/webvirtcloud/dev/libvirt-bootstrap.sh
sudo sed -i 's/auth_tcp = \"sasl\"/auth_tcp = \"none\"/g' /etc/libvirt/libvirtd.conf
sudo service libvirt-bin restart
sudo adduser vagrant libvirtd
sudo chown -R vagrant:vagrant /srv/webvirtcloud
sudo apt-get -y install python-virtualenv python-dev python-lxml python-pip libvirt-dev zlib1g-dev libxslt1-dev nginx supervisor libsasl2-modules gcc pkg-config python-guestfs
virtualenv /srv/webvirtcloud/venv
source /srv/webvirtcloud/venv/bin/activate
pip install -r /srv/webvirtcloud/dev/requirements.txt
sudo cp /srv/webvirtcloud/conf/supervisor/webvirtcloud.conf /etc/supervisor/conf.d
sudo cp /srv/webvirtcloud/conf/nginx/webvirtcloud.conf /etc/nginx/conf.d
sudo cp /srv/webvirtcloud/webvirtcloud/settings.py.template /srv/webvirtcloud/webvirtcloud/settings.py
sudo sed "s/SECRET_KEY = ''/SECRET_KEY = '"`python /srv/webvirtcloud/conf/runit/secret_generator.py`"'/" -i /srv/webvirtcloud/webvirtcloud/settings.py
python /srv/webvirtcloud/manage.py migrate
sudo rm /etc/nginx/sites-enabled/default
sudo chown -R www-data:www-data /srv/webvirtcloud
sudo service nginx restart
sudo service supervisor restart
SHELL
end
end


4 changes: 4 additions & 0 deletions conf/runit/secret_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import random, string

haystack = string.ascii_letters + string.digits + string.punctuation
print(''.join([random.SystemRandom().choice(haystack.replace('/','').replace('\'', '').replace('\"','')) for _ in range(50)]))
2 changes: 1 addition & 1 deletion instances/templates/add_instance_network_block.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load i18n %}
{% if request.user.is_superuser and status == 5 %}
{% if request.user.is_superuser %}
<a href="#addInstanceNetwork" type="button" class="btn btn-success pull-right" data-toggle="modal">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
</a>
Expand Down
13 changes: 4 additions & 9 deletions instances/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ def migrate_instance(new_compute, instance, live=False, unsafe=False, xml_del=Fa

conn.change_network(network_data)
addlogmsg(request.user.username, instance.name, msg)
msg = _("Network Devices are changed. Please reboot instance to activate.")
msg = _("Network Device Config is changed. Please shutdown instance to activate.")
if conn.get_status() != 5: messages.success(request, msg)
return HttpResponseRedirect(request.get_full_path() + '#network')

Expand All @@ -729,11 +729,7 @@ def migrate_instance(new_compute, instance, live=False, unsafe=False, xml_del=Fa
(source, source_type) = get_network_tuple(request.POST.get('add-net-network'))

conn.add_network(mac, source, source_type, nwfilter=nwfilter)

addlogmsg(request.user.username, instance.name, msg)
msg = _("Network Device is added. Please reboot instance to activate.")
if conn.get_status() != 5: messages.success(request, msg)

return HttpResponseRedirect(request.get_full_path() + '#network')

if 'delete_network' in request.POST:
Expand All @@ -742,8 +738,6 @@ def migrate_instance(new_compute, instance, live=False, unsafe=False, xml_del=Fa

conn.delete_network(mac_address)
addlogmsg(request.user.username, instance.name, msg)
msg = _("Network Device is deleted. Please reboot instance to activate.")
if conn.get_status() != 5: messages.success(request, msg)
return HttpResponseRedirect(request.get_full_path() + '#network')

if 'add_owner' in request.POST:
Expand Down Expand Up @@ -928,7 +922,7 @@ def get_userinstances_info(instance):
all_host_vms = {}
status = connection_manager.host_is_up(comp.type, comp.hostname)

if status:
if status is True:
conn = wvmHostDetails(comp, comp.login, comp.password, comp.type)
comp_node_info = conn.get_node_info()
comp_mem = conn.get_memory_usage()
Expand All @@ -949,7 +943,8 @@ def get_userinstances_info(instance):
refresh_instance_database(comp_info, vm, info)

conn.close()

else:
raise libvirtError("Problem occured with {} - {}".format(comp.name, status))
return all_host_vms


Expand Down
18,206 changes: 9 additions & 18,197 deletions static/js/ace.js

Large diffs are not rendered by default.

Loading