Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nirina Malard
slapos
Commits
957b5c69
Commit
957b5c69
authored
Oct 02, 2013
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused files
parent
3f3a78a1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
108 deletions
+0
-108
software/openstack/templates/kvm-controller-run.in
software/openstack/templates/kvm-controller-run.in
+0
-32
software/openstack/templates/kvm-run.in
software/openstack/templates/kvm-run.in
+0
-76
No files found.
software/openstack/templates/kvm-controller-run.in
deleted
100644 → 0
View file @
3f3a78a1
#!${:python_path}
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
# Echo client program
import socket
import time
# Connect to KVM qmp socket
so = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
connected = False
while not connected:
try:
so.connect('${:socket_path}')
except socket.error:
time.sleep(1)
else:
connected = True
data = so.recv(1024)
# Enable qmp
so.send('{ "execute": "qmp_capabilities" }')
data = so.recv(1024)
# Set VNC password
so.send('{ "execute": "change", ' \
'"arguments": { "device": "vnc", "target": "password", ' \
' "arg": "${:vnc_passwd}" } }')
data = so.recv(1024)
# Finish
so.close()
\ No newline at end of file
software/openstack/templates/kvm-run.in
deleted
100644 → 0
View file @
3f3a78a1
#!${:python_path}
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
# Echo client program
import hashlib
import os
import socket
import subprocess
import urllib
def getSocketStatus(host, port):
s = None
for res in socket.getaddrinfo(host, port,
socket.AF_UNSPEC, socket.SOCK_STREAM):
af, socktype, proto, canonname, sa = res
try:
s = socket.socket(af, socktype, proto)
except socket.error, msg:
s = None
continue
try:
s.connect(sa)
except socket.error, msg:
s.close()
s = None
continue
break
return s
disk_path = '${:disk_path}'
virtual_hard_drive_url = '${:virtual-hard-drive-url}'.strip()
virtual_hard_drive_md5_url = '${:virtual-hard-drive-md5-url}'.strip()
# Download existing hard drive if needed at first boot
if not os.path.exists(disk_path) and virtual_hard_drive_url != '':
urllib.urlretrieve(virtual_hard_drive_url, disk_path)
local_md5sum = md5Checksum(disk_path)
md5sum = urllib.urlopen(virtual_hard_drive_md5_url).read().strip()
if local_md5sum != md5sum:
os.remove(disk_path)
raise Exception('MD5 mismatch.')
# create disk if doesn't exist
if not os.path.exists(disk_path):
subprocess.Popen(['${:qemu_img_path}', 'create' ,'-f', 'qcow2',
disk_path, '${:disk_size}G'])
# Generate NAT rules for ssh connexion
if "${:software_type}".strip() == "compute":
nat_rules = ",".join("hostfwd=tcp:${:vnc_ip}:%s-:%s" % (port, port) for port in [80, 443])
else:
nat_rules = ",".join("hostfwd=tcp:${:vnc_ip}:%s-:%s" % (port, port) for port in [80, 443, 5000, 6080, 6082, 3333, 9292, 3306, 35357])
kvm_argument_list = ['${:qemu_path}',
'-enable-kvm', '-net', 'nic,macaddr=${:mac_address}',
'-net', 'user,hostfwd=tcp:${:vnc_ip}:22222-:22,%s' % nat_rules,
'-smp', '${:smp_count}',
'-m', '${:ram_size}',
'-drive', 'file=${:disk_path},if=${:disk_type}',
'-vnc', '${:vnc_ip}:1,ipv4,password',
'-boot', 'menu=on',
'-qmp', 'unix:${:socket_path},server',
'-pidfile', '${:pid_file_path}',
]
s = getSocketStatus('${:nbd_ip}', ${:nbd_port})
if s is None:
# NBD is not available : launch kvm without it
print 'Warning : Nbd is not available.'
else:
# NBD is available
kvm_argument_list.extend([
'-drive',
'file=nbd:[%s]:%s,media=cdrom' % ('${:nbd_ip}', ${:nbd_port})])
os.execv('${:qemu_path}', kvm_argument_list)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment