Skip to content

Commit

Permalink
Fixed copyright
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Hamilton committed Aug 22, 2018
1 parent db6b938 commit 179f107
Show file tree
Hide file tree
Showing 27 changed files with 74 additions and 343 deletions.
51 changes: 16 additions & 35 deletions docs/source/quickstart.rst
Expand Up @@ -17,7 +17,7 @@ uses KVM hypervisors.
Simulation Demonstration
------------------------

Installation
Testpool Installation
------------

We'll install Testpool from Debian.
Expand Down Expand Up @@ -64,6 +64,10 @@ We'll install Testpool from Debian.

http://127.0.0.1:8000/testpool/view/dashboard

Alternatively, *tpl-demo* can be run with *--product docker*. Don't run
tpl-demo if going through the next section in the **Short Tour**.


A Short Tour
------------

Expand All @@ -79,7 +83,7 @@ manage several hypervisors. Testpool supports KVM which is required for
this demonstration.

To expedite this guide, Testpool content is installed on the KVM hypervisor.
For final installation, Testpool can be installed either the hypervisor or a
For final installation, Testpool can be installed either on the hypervisor or a
separate system. The differences will be identified during the installation
steps.

Expand All @@ -106,7 +110,7 @@ For this quick start guide, we'll need a single VM named test.template on
the hypervisor which is off and ready to be cloned. When the VMs starts
it must use DHCP to acquire its IP address. What the VM is running is
not important and there are good instructions on the internet for setting up a
KVM hypervisor and creating a VM. For installing KVM on Ubuntu 16.04, refer
KVM hypervisor and creating a VM. For installing KVM on Ubuntu 18.04, refer
to this site https://help.ubuntu.com/community/KVM/Installation. Once complete, you will need the following information:

- user and password that can install VMs. This is the user that is part of
Expand All @@ -115,52 +119,29 @@ to this site https://help.ubuntu.com/community/KVM/Installation. Once complete,
hypervisor

For the rest of this guide, we'll assume the user tadmin with password
'password'. Since Testpool is installed on the hypervisor, the IP address used is
localhost.
'password'. Since Testpool is installed on the hypervisor, the IP address used
is localhost.

Now a single VM is required which represents the template that is managed
and cloned by Testpool. Using virt-manager, these instructions will create
an Ubuntu 16.04 server VM.

#. sudo apt-get install virt-manager
#. Run virt-manager
#. From File, choose *Add Connection*.
#. If applicable, choose *Connect to remote host*
#. Run **virt-manager**
#. From File, choose **Add Connection**.
#. If applicable, choose **Connect to remote host**
#. Enter admin for **Username** and IP address for the **Hostname**. This may
be either localhost or the IP address of the KVM hypervisor.
The default ssh method will probably work.
#. Now connect and enter the user password.
#. Select Hypervisor in the virt-manager,
#. Choose **Create a new virtual manager**.
#. Choose **Network Install (HTTP, FTP or NFS)** then Forward.
#. For URL, enter **http://us.archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/** The URL changes periodically, check the Ubuntu site for the
#. For URL, enter **http://us.archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/** The URL changes periodically, check the Ubuntu site for the
latest valid links.


Testpool Installation
---------------------

We'll install Testpool from source.

#. Download Testpool from github release area::

wget https://github.com/testcraftsman/testpool/archive/v0.0.7.tar.gz
tar -xf testpool-0.0.7.tar.gz

#. Install several required packages::

cd testpool
cat requirements.system | sudo xargs apt-get install -y
sudo apt-file update
sudo pip install -qr requirements.txt

#. Run Testpool database. In a shell run::

./bin/tpl-db runserver -v 3

#. In a second shell, run the Testpool daemon::

./bin/tpl-daemon -v
#. Choose appropriate RAM and CPU. For a demo, select 512 and 1 CPU.
#. Create a disk with 5 GiB of space.
#. Then select Finish fro the network setup.

A Short Tour
------------
Expand Down
18 changes: 1 addition & 17 deletions examples/conftest.py
@@ -1,20 +1,4 @@
# (c) 2015 Mark Hamilton, <mark.lee.hamilton@gmail.com>
#
# This file is part of testpool
#
# Testbed is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Testbed is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Testdb. If not, see <http://www.gnu.org/licenses/>.

# Copyright (c) 2015-2018 Mark Hamilton, All rights reserved
""" Populate test database for examples.
Check to see if the user has created an example test profile, if not
Expand Down
23 changes: 23 additions & 0 deletions examples/tpldemo.py
Expand Up @@ -80,6 +80,7 @@ def release(self, rsrc):

FAKE_POOL_NAMES = ["ubuntu16.04", "centos7.0", "vmware", "ESX6.5"]
DOCKER_POOL_NAMES = ["nginx"]
KVM_POOL_NAMES = ["ubuntu1804"]


class PoolBaseIfc(object):
Expand Down Expand Up @@ -148,13 +149,35 @@ def sleep(self):
time.sleep(10)


class KvmPool(PoolBaseIfc):
""" Handle KVM demo. """

def add(self):
""" Add docker pool. """

resource_maxes = [5]
template_name = "test.template"
for (name, resource_max) in zip(KVM_POOL_NAMES, resource_maxes):
logging.info("adding pool %s", name)
self.rest.pool_add(name, "qemu:///system", self.product,
template_name, resource_max)
return KVM_POOL_NAMES

def sleep(self):
""" Sleep between docker operations. """
# pylint: disable=no-self-use
time.sleep(120)


def pool_base_get(rest, product):
""" Return appropriate pool manager. """

if product == "fake":
return FakePool(rest, product)
elif product == "docker":
return DockerPool(rest, product)
elif product == "kvm":
return KvmPool(rest, product)
else:
raise ValueError("unsupported product %s" % product)

Expand Down
2 changes: 1 addition & 1 deletion testpool/__init__.py
@@ -1,2 +1,2 @@
# (c) 2015 Mark Hamilton, <mark.lee.hamilton@gmail.com>
# Copyright (c) 2015-2018 Mark Hamilton, All rights reserved
""" Hold general testbed content. """
50 changes: 0 additions & 50 deletions testpool/core/\

This file was deleted.

2 changes: 1 addition & 1 deletion testpool/core/api.py
@@ -1,4 +1,4 @@
# (c) 2015 Mark Hamilton, <mark.lee.hamilton@gmail.com>
# Copyright (c) 2015-2018 Mark Hamilton, All rights reserved
""" Pool API. """


Expand Down
2 changes: 1 addition & 1 deletion testpool/core/commands.py
@@ -1,4 +1,4 @@
# (c) 2015 Mark Hamilton, <mark.lee.hamilton@gmail.com>
# Copyright (c) 2015-2018 Mark Hamilton, All rights reserved
"""
Contains functionality common to extensions.
"""
Expand Down
2 changes: 1 addition & 1 deletion testpool/core/ext.py
@@ -1,4 +1,4 @@
# (c) 2015 Mark Hamilton, <mark.lee.hamilton@gmail.com>
# Copyright (c) 2015-2018 Mark Hamilton, All rights reserved
""" Code that handles extensions. """
import sys
import unittest
Expand Down
2 changes: 1 addition & 1 deletion testpool/core/logger.py
@@ -1,4 +1,4 @@
# (c) 2015 Mark Hamilton, <mark.lee.hamilton@gmail.com>
# Copyright (c) 2015-2018 Mark Hamilton, All rights reserved
"""
Contains functionality common to extensions.
Handles logging.
Expand Down
2 changes: 1 addition & 1 deletion testpool/core/pool.py
@@ -1,4 +1,4 @@
# (c) 2015 Mark Hamilton, <mark.lee.hamilton@gmail.com>
# Copyright (c) 2015-2018 Mark Hamilton, All rights reserved
"""
Fake pools used for development.
Expand Down
2 changes: 1 addition & 1 deletion testpool/core/resource.py
@@ -1,4 +1,4 @@
# (c) 2015 Mark Hamilton, <mark.lee.hamilton@gmail.com>
# Copyright (c) 2015-2018 Mark Hamilton, All rights reserved
"""
Fake pools used for development.
Expand Down
2 changes: 1 addition & 1 deletion testpool/core/server.py
@@ -1,4 +1,4 @@
# (c) 2015 Mark Hamilton, <mark.lee.hamilton@gmail.com>
# Copyright (c) 2015-2018 Mark Hamilton, All rights reserved
""" Test pool Server.
Server algorithm. resources, given a current state, can be assigned an action
Expand Down
17 changes: 1 addition & 16 deletions testpool/db/djconfig/settings/components/base.py
@@ -1,19 +1,4 @@
# (c) 2015 Mark Hamilton, <mark.lee.hamilton@gmail.com>
#
# This file is part of testpool
#
# Testbed is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Testbed is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Testdb. If not, see <http://www.gnu.org/licenses/>.
# Copyright (c) 2015-2018 Mark Hamilton, All rights reserved
"""
Django settings for djconfig project.
Expand Down
17 changes: 1 addition & 16 deletions testpool/db/testpool_docker/api.py
@@ -1,19 +1,4 @@
# (c) 2015 Mark Hamilton, <mark.lee.hamilton@gmail.com>
#
# This file is part of testpool
#
# Testbed is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Testbed is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Testdb. If not, see <http://www.gnu.org/licenses/>.
# Copyright (c) 2015-2018 Mark Hamilton, All rights reserved
"""
Holds views for tests results.
"""
Expand Down
17 changes: 1 addition & 16 deletions testpool/db/testpool_docker/urls.py
@@ -1,19 +1,4 @@
# (c) 2015 Mark Hamilton, <mark.lee.hamilton@gmail.com>
#
# This file is part of testpool
#
# Testbed is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Testbed is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Testdb. If not, see <http://www.gnu.org/licenses/>.
# Copyright (c) 2015-2018 Mark Hamilton, All rights reserved
""" URLS pools. """

from django.conf.urls import url
Expand Down
26 changes: 10 additions & 16 deletions testpool/db/testpool_pool/api.py
@@ -1,19 +1,4 @@
# (c) 2015 Mark Hamilton, <mark.lee.hamilton@gmail.com>
#
# This file is part of testpool
#
# Testbed is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Testbed is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Testdb. If not, see <http://www.gnu.org/licenses/>.
# Copyright (c) 2015-2018 Mark Hamilton, All rights reserved
"""
Holds views for tests results.
"""
Expand Down Expand Up @@ -200,6 +185,8 @@ def pool_add(request, pool_name):

LOGGER.info("testpool_pool.api.pool_add %s", pool_name)

print "MARK: 1"

if request.method != 'POST':
msg = "pool_add method %s unsupported" % request.method
logging.error(msg)
Expand All @@ -221,22 +208,29 @@ def pool_add(request, pool_name):
msg = "pool_add requires product"
return JsonResponse({"msg": msg}, status=404)

print "MARK: 2"
resource_max = request.GET["resource_max"]
template_name = request.GET["template_name"]
connection = request.GET["connection"]
product = request.GET["product"]

print "MARK: 2", product
try:
resource_max = int(resource_max)
pool1 = testpool.core.algo.pool_add(connection, product, pool_name,
resource_max, template_name)
print "MARK: 3", product, pool1
serializer = PoolSerializer(pool1)

print "MARK: 4", product, pool1
return JSONResponse(serializer.data)
except Pool.DoesNotExist, arg:
logging.exception(arg)
msg = "pool %s not found" % pool_name
logging.error(msg)
return JsonResponse({"msg": msg}, status=403)
except Exception, arg:
logging.exception(arg)
print "MARK: 4", product, pool1, arg
logging.error(arg)
return JsonResponse({"msg": arg}, status=500)

0 comments on commit 179f107

Please sign in to comment.