F #4669: QoL scheduling for LXD apps (#4670)

This commit is contained in:
Daniel Clavijo Coca authored and GitHub committed 2020-05-18 03:01:50 +02:00
1 parent acf6454c6e
commit ec252e2aaf
4 files changed
+63 -39

No files matched your search

+4
View File
@@ -421,6 +421,7 @@ VAR_DIRS="$VAR_LOCATION/remotes \
$VAR_LOCATION/remotes/market/http \
$VAR_LOCATION/remotes/market/one \
$VAR_LOCATION/remotes/market/s3 \
$VAR_LOCATION/remotes/market/common \
$VAR_LOCATION/remotes/market/linuxcontainers \
$VAR_LOCATION/remotes/market/turnkeylinux \
$VAR_LOCATION/remotes/market/dockerhub \
@@ -626,6 +627,7 @@ INSTALL_FILES=(
MARKETPLACE_DRIVER_ETC_HTTP_SCRIPTS:$VAR_LOCATION/remotes/etc/market/http
MARKETPLACE_DRIVER_ONE_SCRIPTS:$VAR_LOCATION/remotes/market/one
MARKETPLACE_DRIVER_S3_SCRIPTS:$VAR_LOCATION/remotes/market/s3
MARKETPLACE_DRIVER_COMMON_SCRIPTS:$VAR_LOCATION/remotes/market/common
MARKETPLACE_DRIVER_LXC_SCRIPTS:$VAR_LOCATION/remotes/market/linuxcontainers
MARKETPLACE_DRIVER_TK_SCRIPTS:$VAR_LOCATION/remotes/market/turnkeylinux
MARKETPLACE_DRIVER_DH_SCRIPTS:$VAR_LOCATION/remotes/market/dockerhub
@@ -1891,6 +1893,8 @@ MARKETPLACE_DRIVER_S3_SCRIPTS="src/market_mad/remotes/s3/import \
src/market_mad/remotes/s3/monitor \
src/market_mad/remotes/s3/S3.rb"
MARKETPLACE_DRIVER_COMMON_SCRIPTS="src/market_mad/remotes/common/lxd.rb"
MARKETPLACE_DRIVER_LXC_SCRIPTS="src/market_mad/remotes/linuxcontainers/import \
src/market_mad/remotes/linuxcontainers/delete \
src/market_mad/remotes/linuxcontainers/monitor"
+52
View File
@@ -0,0 +1,52 @@
#!/usr/bin/ruby
# -------------------------------------------------------------------------- #
# Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# -------------------------------------------------------------------------- #
# Utilities for LXD based marketplaces
module LXDMarket
class << self
# TODO: Make configurable
def template
unindent(<<-EOS)
HYPERVISOR = \"lxd\"
SCHED_REQUIREMENTS = \"HYPERVISOR=\\\"lxd\\\"\"
CPU = \"1\"
MEMORY = \"768\"
LXD_SECURITY_PRIVILEGED = \"true\"
GRAPHICS = [
LISTEN =\"0.0.0.0\",
TYPE =\"vnc\"
]
CONTEXT = [
NETWORK =\"YES\",
SSH_PUBLIC_KEY =\"$USER[SSH_PUBLIC_KEY]\",
SET_HOSTNAME =\"$NAME\"
]"
EOS
end
def unindent(str)
m = str.match(/^(\s*)/)
spaces = m[1].size
str.gsub!(/^ {#{spaces}}/, '')
end
end
end
+4 -17
View File
@@ -24,6 +24,8 @@ require 'rexml/document'
require 'time'
require 'digest/md5'
require_relative '../common/lxd'
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
@@ -42,22 +44,6 @@ class LinuxContainersMarket
:skip_untested => 'yes'
}
# TODO: Make configurable
TEMPLATE = "
HYPERVISOR = \"lxd\"
CPU = \"1\"
MEMORY = \"768\"
LXD_SECURITY_PRIVILEGED = \"yes\"
GRAPHICS = [
LISTEN =\"0.0.0.0\",
TYPE =\"vnc\"
]
CONTEXT = [
NETWORK =\"YES\",
SSH_PUBLIC_KEY =\"$USER[SSH_PUBLIC_KEY]\",
SET_HOSTNAME =\"$NAME\"
]"
#---------------------------------------------------------------------------
# Configuration varibales
# :url of linuxcontainers market place
@@ -172,7 +158,8 @@ CONTEXT = [
tmpl64 = ''
print_var(tmpl64, 'DRIVER', 'raw')
data = { 'APPTEMPLATE64' => tmpl64, 'VMTEMPLATE64' => TEMPLATE }
data = { 'APPTEMPLATE64' => tmpl64,
'VMTEMPLATE64' => LXDMarket.template }
data.each do |key, val|
print_var(tmpl, key, Base64.strict_encode64(val))
end
+3 -22
View File
@@ -41,11 +41,7 @@ require 'rexml/document'
require 'nokogiri'
require 'digest/md5'
def unindent(str)
m = str.match(/^(\s*)/)
spaces = m[1].size
str.gsub!(/^ {#{spaces}}/, '')
end
require_relative '../common/lxd'
#-------------------------------------------------------------------------------
# This class is used to query the TurnkeyLinux repository
@@ -64,22 +60,6 @@ class TurnkeyLinux
:agent => 'OpenNebula'
}
TEMPLATE = unindent(<<-EOS)
HYPERVISOR = \"lxd\"
CPU = \"1\"
MEMORY = \"768\"
LXD_SECURITY_PRIVILEGED = \"true\"
GRAPHICS = [
LISTEN =\"0.0.0.0\",
TYPE =\"vnc\"
]
CONTEXT = [
NETWORK =\"YES\",
SSH_PUBLIC_KEY =\"$USER[SSH_PUBLIC_KEY]\",
SET_HOSTNAME =\"$NAME\"
]"
EOS
#---------------------------------------------------------------------------
# Configuration varibales
# :url of linuxcontainers market place
@@ -186,7 +166,8 @@ class TurnkeyLinux
tmpl64 = ''
print_var(tmpl64, 'DRIVER', 'raw')
data = { 'APPTEMPLATE64' => tmpl64, 'VMTEMPLATE64' => TEMPLATE }
data = { 'APPTEMPLATE64' => tmpl64,
'VMTEMPLATE64' => LXDMarket.template }
data.each do |key, val|
print_var(tmpl, key, Base64.strict_encode64(val))
end