Debianize the packaging

This commit is contained in:
Joshua Boniface 2018-06-17 14:55:13 -04:00
parent db75ff35d8
commit 6ade378cc9
21 changed files with 211 additions and 22 deletions

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
pvc (0.1-1) unstable; urgency=medium
* Initial packaging release
-- Joshua Boniface <joshua@boniface.me> Sun, 17 Jun 2018 02:40:39 -0400

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
9

28
debian/control vendored Normal file
View File

@ -0,0 +1,28 @@
Source: pvc
Section: main
Priority: optional
Maintainer: Joshua Boniface <joshua@boniface.me>
Standards-Version: 3.9.8
Homepage: https://www.boniface.me
X-Python3-Version: >= 3.2
Package: pvc-daemon
Architecture: all
Depends: python3-kazoo, python3-libvirt, python3-psutil, python3-apscheduler
Suggests: pvc-client
Description: Parallel Virtual Cluster daemon (Python 3)
The Parallel Virtual Cluster provides a management solution for QEMU/KVM virtual clusters,
including full control of running VMs, definitions, and hypervisors (including fencing via
IPMI). This package provides the daemon component for a hypervisor node.
.
This package installs the PVC daemon utility
Package: pvc-client
Architecture: all
Depends: python3-kazoo, python3-libvirt, python3-psutil, python3-click, python3-lxml
Description: Parallel Virtual Cluster client (Python 3)
The Parallel Virtual Cluster provides a management solution for QEMU/KVM virtual clusters,
including full control of running VMs, definitions, and hypervisors (including fencing via
IPMI). This package provides the client command-line interface.
.
This package installs the PVC command-line client

38
debian/copyright vendored Normal file
View File

@ -0,0 +1,38 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: pvc
Source: <url://example.com>
Files: *
Copyright: <years> <put author's name and email here>
<years> <likewise for another author>
License: <special license>
<Put the license of the package here indented by 1 space>
<This follows the format of Description: lines in control file>
.
<Including paragraphs>
# If you want to use GPL v2 or later for the /debian/* files use
# the following clauses, or change it to suit. Delete these two lines
Files: debian/*
Copyright: 2018 unknown <joshua@stretch-build.i.bonilan.net>
License: GPL-2+
This package 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 2 of the License, or
(at your option) any later version.
.
This package 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 this program. If not, see <https://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
# Please avoid picking licenses with terms that are more restrictive than the
# packaged work, as it may make Debian's contributions unacceptable upstream.

2
debian/pvc-client.install vendored Normal file
View File

@ -0,0 +1,2 @@
pvc.py usr/share/pvc
pvc usr/share/pvc

4
debian/pvc-client.postinst vendored Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
# Install client binary to /usr/bin via symlink
ln -s /usr/share/pvc/pvc.py /usr/bin/pvc

4
debian/pvc-client.prerm vendored Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
# Remove client binary symlink
rm -f /usr/bin/pvc

4
debian/pvc-daemon.install vendored Normal file
View File

@ -0,0 +1,4 @@
pvcd.py usr/share/pvc
pvcd.service lib/systemd/system
pvcd.conf.sample etc/pvc
pvcd usr/share/pvc

6
debian/pvc-daemon.postinst vendored Normal file
View File

@ -0,0 +1,6 @@
#!/bin/sh
# Enable the servive
systemctl enable /lib/systemd/system/pvcd.service
echo "The PVC daemon has not been started. Create a config file at /etc/pvc/pvcd.conf then start it."

5
debian/pvc-daemon.prerm vendored Normal file
View File

@ -0,0 +1,5 @@
#!/bin/sh
# Disable the servive
systemctl disable pvcd.service

16
debian/rules vendored Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1
%:
dh $@
# If you need to rebuild the Sphinx documentation
# Add spinxdoc to the dh --with line
#override_dh_auto_build:
# dh_auto_build
# PYTHONPATH=. http_proxy='127.0.0.1:9' sphinx-build -N -bhtml docs/ build/html # HTML generator
# PYTHONPATH=. http_proxy='127.0.0.1:9' sphinx-build -N -bman docs/ build/man # Manpage generator

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)

1
debian/source/options vendored Normal file
View File

@ -0,0 +1 @@
extend-diff-ignore = "^[^/]*[.]egg-info/"

View File

@ -1,6 +0,0 @@
#!/usr/bin/env bash
DEPS=( python3-kazoo python3-libvirt python3-psutil python3-apscheduler )
# Install required packages
sudo apt install ${DEPS[@]}

View File

@ -1,4 +1,4 @@
# pvcd cluster configuration file # pvcd cluster configuration file example
# #
# This configuration file lists all nodes that should be running in the cluster and provides # This configuration file lists all nodes that should be running in the cluster and provides
# basic configuration information for them. # basic configuration information for them.
@ -17,15 +17,16 @@
# ipmi_hostname: the IPMI hostname for fencing (defaults to <shortname>-lom.<domain>) # ipmi_hostname: the IPMI hostname for fencing (defaults to <shortname>-lom.<domain>)
# ipmi_username: username to connect to IPMI # ipmi_username: username to connect to IPMI
# ipmi_password: password to connect to IPMI # ipmi_password: password to connect to IPMI
#
# Copy this example to /etc/pvc/pvcd.conf and edit to your needs
[default] [default]
zookeeper = 127.0.0.1:2181 zookeeper = 127.0.0.1:2181
keepalive_interval = 5 keepalive_interval = 5
#ipmi_username = admin
#ipmi_password = admin
[myhost]
ipmi_username = admin ipmi_username = admin
ipmi_password = admin ipmi_password = admin
ipmi_hostname = myhost-lom
[test1.i.bonilan.net]
ipmi_hostname = test1-lom.m.bonilan.net
[test2.i.bonilan.net]
ipmi_hostname = test2-lom.m.bonilan.net

View File

@ -33,9 +33,9 @@ import time
import configparser import configparser
import apscheduler.schedulers.background import apscheduler.schedulers.background
import pvc.ansiiprint as ansiiprint import pvcd.ansiiprint as ansiiprint
import pvc.VMInstance as VMInstance import pvcd.VMInstance as VMInstance
import pvc.NodeInstance as NodeInstance import pvcd.NodeInstance as NodeInstance
print(ansiiprint.bold() + "pvcd - Parallel Virtual Cluster management daemon" + ansiiprint.end()) print(ansiiprint.bold() + "pvcd - Parallel Virtual Cluster management daemon" + ansiiprint.end())

View File

@ -5,11 +5,10 @@ After = network-online.target libvirtd.service zookeeper.service
[Service] [Service]
Type = simple Type = simple
WorkingDirectory = /var/home/joshua/pvc WorkingDirectory = /usr/share/pvc
Environment = PYTHONUNBUFFERED=true Environment = PYTHONUNBUFFERED=true
Environment = PVCD_CONFIG_FILE=/etc/pvcd.conf Environment = PVCD_CONFIG_FILE=/etc/pvc/pvcd.conf
#ExecStartPre = /bin/bash -c "GIT_SSH_COMMAND='/usr/bin/ssh -i /srv/git-deploy.key' /usr/bin/git pull" ExecStart = /usr/share/pvc/pvcd.py
ExecStart = /var/home/joshua/pvc/pvcd.py
Restart = on-failure Restart = on-failure
[Install] [Install]

View File

@ -21,7 +21,7 @@
############################################################################### ###############################################################################
import os, sys, psutil, socket, time, libvirt, kazoo.client, threading, subprocess import os, sys, psutil, socket, time, libvirt, kazoo.client, threading, subprocess
import pvc.ansiiprint as ansiiprint import pvcd.ansiiprint as ansiiprint
class NodeInstance(): class NodeInstance():
# Initialization function # Initialization function

View File

@ -21,7 +21,7 @@
############################################################################### ###############################################################################
import os, sys, uuid, socket, time, threading, libvirt, kazoo.client import os, sys, uuid, socket, time, threading, libvirt, kazoo.client
import pvc.ansiiprint as ansiiprint import pvcd.ansiiprint as ansiiprint
class VMInstance: class VMInstance:
# Initialization function # Initialization function

0
pvcd/__init__.py Normal file
View File

80
pvcd/ansiiprint.py Normal file
View File

@ -0,0 +1,80 @@
#!/usr/bin/env python3
# ansiprint.py - Printing function for formatted messages
# Part of the Parallel Virtual Cluster (PVC) system
#
# Copyright (C) 2018 Joshua M. Boniface <joshua@boniface.me>
#
# This program 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.
#
# This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
#
###############################################################################
import datetime
# ANSII colours for output
def red():
return '\033[91m'
def blue():
return '\033[94m'
def green():
return '\033[92m'
def yellow():
return '\033[93m'
def purple():
return '\033[95m'
def bold():
return '\033[1m'
def end():
return '\033[0m'
# Print function
def echo(message, prefix, state):
# Get the date
date = '{} - '.format(datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S.%f'))
endc = end()
# Continuation
if state == 'c':
date = ''
colour = ''
prompt = ' '
# OK
elif state == 'o':
colour = green()
prompt = '>>> '
# Error
elif state == 'e':
colour = red()
prompt = '>>> '
# Warning
elif state == 'w':
colour = yellow()
prompt = '>>> '
# Tick
elif state == 't':
colour = purple()
prompt = '>>> '
# Information
elif state == 'i':
colour = blue()
prompt = '>>> '
else:
colour = bold()
prompt = '>>> '
# Append space to prefix
if prefix != '':
prefix = prefix + ' '
print(colour + prompt + endc + date + prefix + message)