Skip to content

Commit

Permalink
Automatic merge of 'ocf' (3904717) into 'master'
Browse files Browse the repository at this point in the history
 > Merge 'ofelia.development' into 'ocf' (improved VM contextualisation)
  • Loading branch information
CarolinaFernandez authored and jenkins-felix committed Apr 1, 2016
1 parent d6800f9 commit 1295ed8
Show file tree
Hide file tree
Showing 12 changed files with 970 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,20 @@ def create_flowspace(self, urn, expiration=None, users=list(), geni_best_effort=
urn = self.__generate_sliver_urn_from_slice_urn(urn)
params = self.__urn_to_fs_params(urn)
#res = Reservation.objects.filter(slice_urn=urn)[0]
res = Reservation.objects.filter(**params)[0]
rfs = res.reservationflowspace_set.all()#ReservationFlowSpace.objects.filter(urn=urn)
res = Reservation.objects.filter(**params)
if not res:
raise Exception("Sliver not found or already allocated")
res = res[0]
rfs = res.reservationflowspace_set.all()
slivers = self.__get_create_slice_params(rfs)
self.__sliver_manager.create_of_sliver(urn, res.project_name, res.project_desc, res.slice_name, res.slice_desc, res.controller_url, res.owner_email, res.owner_password, slivers)
ExpiringFlowSpaces(slice_urn=urn, expiration=expiration).save()
expirii = ExpiringFlowSpaces.objects.filter(slice_urn=urn, expiration=expiration)
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
print "Expiration: ", expiration
if expirii:
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
print("ExpiringFlowSpaces: ", ExpiringFlowSpaces.objects.filter(slice_urn=urn, expiration=expiration)[0].__dict__)
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
manifest = self.__convert_to_resource(urn, expiration)
rfs.delete()
res.delete()
Expand All @@ -138,7 +140,6 @@ def reserve_flowspace(self, slice_urn, reservation, expiration=None, users=list(
try:
if not expiration:
expiration = datetime.utcnow() + timedelta(hours=1)

reservation_params = self.__get_experiment_params(reservation, slice_urn)
#reservation_params['slice_urn'] = slice_urn
# Delete first any other reservation by this name
Expand All @@ -165,7 +166,6 @@ def reserve_flowspace(self, slice_urn, reservation, expiration=None, users=list(
for port in dpid.get_ports():
for match in group.get_matches():
req_params = self.__translate_to_flow_space_model(match, dpid, port)
print("----------------------------------------------------", req_params)
for param in req_params:
param = self.__format_params_to_reservation_model(param)
reservation_flowspace = ReservationFlowSpace(**param)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ Defaults env_reset

# User privilege specification
root ALL=(ALL:ALL) ALL
<%newuser1%>

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
<%newuser%>
<%newuser2%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

apt_src_list=/etc/apt/sources.list
etc_hosts=/etc/hosts
sudoers_file=/etc/sudoers


# Skip if a) sudo package is installed or b) image is not Debian 6
([[ ! -z $(dpkg | grep sudo) ]] || [[ -z $(uname -a | grep "2.6.32-5-xen") ]] ) && return 0

if [ ! -f $apt_src_list.bak ]; then
sed -i 's/^/#/' $apt_src_list
mv $apt_src_list $apt_src_list.bak
echo """
#
# Updated sources
#
deb http://httpredir.debian.org/debian/ wheezy main contrib non-free
deb-src http://httpredir.debian.org/debian/ wheezy main contrib non-free
deb http://security.debian.org/ wheezy/updates main contrib non-free
deb-src http://security.debian.org/ wheezy/updates main contrib non-free
deb http://httpredir.debian.org/debian wheezy-updates main contrib non-free
deb-src http://httpredir.debian.org/debian wheezy-updates main contrib non-free
""" > $apt_src_list
fi

apt-key update

# Non-supported keys
declare -a err_keys=("8B48AD6246925553" "9D6D8F6BC857C906" "7638D0442B90D010" "6FB2A1C265FFB764")
for i in "${err_keys[@]}"
do
gpg --keyserver pgpkeys.mit.edu --recv-key "$i"
gpg -a --export "$i" | apt-key add -
done

# Lack of sudo
apt-get update -y

mv $sudoers_file $sudoers_file.bak
apt-get install sudo -y
mv $sudoers_file $sudoers_file.orig
mv $sudoers_file.bak $sudoers_file

# Warning on sudo
hostname=$(hostname)
[[ -z $(grep "127.0.0.1 $hostname" $etc_hosts) ]] && echo "127.0.0.1 $hostname" >> $etc_hosts

# SSH connection
ifconfig eth0 mtu 1496
ifconfig eth1 mtu 1496
ifconfig eth2 mtu 1496
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Changelog

## 0.9.0 (2015-02-04)

- Add changelog
- Finish up py3k and unicode support
- Unicode should work on OSX, Windows and Linux
- Some tests have been added

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include LICENSE.txt
include README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
Pure python scp module
======================

The scp.py module uses a paramiko transport to send and recieve files via the
scp1 protocol. This is the protocol as referenced from the openssh scp program,
and has only been tested with this implementation.


Example
-------

.. code-block:: python
from paramiko import SSHClient
from scp import SCPClient
ssh = SSHClient()
ssh.load_system_host_keys()
ssh.connect('example.com')
# SCPCLient takes a paramiko transport as its only argument
scp = SCPClient(ssh.get_transport())
scp.put('test.txt', 'test2.txt')
scp.get('test2.txt')
scp.close()
.. code-block::
$ md5sum test.txt test2.txt
fc264c65fb17b7db5237cf7ce1780769 test.txt
fc264c65fb17b7db5237cf7ce1780769 test2.txt
Using 'with' keyword
------------------

.. code-block:: python
from paramiko import SSHClient
from scp import SCPClient
ssh = SSHClient()
ssh.load_system_host_keys()
ssh.connect('example.com')
with SCPClient(ssh.get_transport()) as scp:
scp.put('test.txt', 'test2.txt')
scp.get('test2.txt')
.. code-block::
$ md5sum test.txt test2.txt
fc264c65fb17b7db5237cf7ce1780769 test.txt
fc264c65fb17b7db5237cf7ce1780769 test2.txt
Empty file.
Loading

0 comments on commit 1295ed8

Please sign in to comment.