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
Dmitry Blinov
slapos
Commits
edcf7bfe
Commit
edcf7bfe
authored
Dec 30, 2019
by
Bryton Lacquement
🚪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kvm: add support for Python 3
parent
5abbb45e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
15 deletions
+18
-15
software/kvm/buildout.hash.cfg
software/kvm/buildout.hash.cfg
+2
-2
software/kvm/template/kvm-controller-run.in
software/kvm/template/kvm-controller-run.in
+1
-1
software/kvm/template/template-kvm-run.in
software/kvm/template/template-kvm-run.in
+11
-8
software/kvm/test/test.py
software/kvm/test/test.py
+4
-4
No files found.
software/kvm/buildout.hash.cfg
View file @
edcf7bfe
...
@@ -55,11 +55,11 @@ md5sum = 2036bf145f472f62ef8dee5e729328fd
...
@@ -55,11 +55,11 @@ md5sum = 2036bf145f472f62ef8dee5e729328fd
[template-kvm-run]
[template-kvm-run]
filename = template/template-kvm-run.in
filename = template/template-kvm-run.in
md5sum =
08af4ed0e2a53e76c844e3d7325aac09
md5sum =
ccaae3912dc85ecccc4974d875dd70e3
[template-kvm-controller]
[template-kvm-controller]
filename = template/kvm-controller-run.in
filename = template/kvm-controller-run.in
md5sum =
b96cba47c97f277c857176d69e086a12
md5sum =
3827b4f7624de190cf5f5d37e3b72e86
[template-apache-conf]
[template-apache-conf]
filename = template/apache.conf.in
filename = template/apache.conf.in
...
...
software/kvm/template/kvm-controller-run.in
View file @
edcf7bfe
...
@@ -57,7 +57,7 @@ def update():
...
@@ -57,7 +57,7 @@ def update():
'nslot': 128,
'nslot': 128,
'canreboot': 1
'canreboot': 1
})
})
except Exception
,
e:
except Exception
as
e:
write(str(e))
write(str(e))
raise
raise
...
...
software/kvm/template/template-kvm-run.in
View file @
edcf7bfe
...
@@ -6,7 +6,10 @@ import hashlib
...
@@ -6,7 +6,10 @@ import hashlib
import os
import os
import socket
import socket
import subprocess
import subprocess
import urllib
try:
from urllib.request import FancyURLopener
except ImportError:
from urllib import FancyURLopener
import gzip
import gzip
import shutil
import shutil
from random import shuffle
from random import shuffle
...
@@ -96,9 +99,9 @@ enable_device_hotplug = '{{ parameter_dict.get("enable-device-hotplug") }}'.lowe
...
@@ -96,9 +99,9 @@ enable_device_hotplug = '{{ parameter_dict.get("enable-device-hotplug") }}'.lowe
logfile = '{{ parameter_dict.get("log-file") }}'
logfile = '{{ parameter_dict.get("log-file") }}'
if hasattr(ssl, '_create_unverified_context') and url_check_certificate == 'false':
if hasattr(ssl, '_create_unverified_context') and url_check_certificate == 'false':
opener =
urllib.
FancyURLopener(context=ssl._create_unverified_context())
opener = FancyURLopener(context=ssl._create_unverified_context())
else:
else:
opener =
urllib.
FancyURLopener({})
opener = FancyURLopener({})
def md5Checksum(file_path):
def md5Checksum(file_path):
with open(file_path, 'rb') as fh:
with open(file_path, 'rb') as fh:
...
@@ -117,12 +120,12 @@ def getSocketStatus(host, port):
...
@@ -117,12 +120,12 @@ def getSocketStatus(host, port):
af, socktype, proto, canonname, sa = res
af, socktype, proto, canonname, sa = res
try:
try:
s = socket.socket(af, socktype, proto)
s = socket.socket(af, socktype, proto)
except socket.error
,
msg:
except socket.error
as
msg:
s = None
s = None
continue
continue
try:
try:
s.connect(sa)
s.connect(sa)
except socket.error
,
msg:
except socket.error
as
msg:
s.close()
s.close()
s = None
s = None
continue
continue
...
@@ -319,7 +322,7 @@ for numa in numa_list:
...
@@ -319,7 +322,7 @@ for numa in numa_list:
kvm_argument_list += numa_parameter
kvm_argument_list += numa_parameter
if tap_network_parameter == [] and nat_network_parameter == []:
if tap_network_parameter == [] and nat_network_parameter == []:
print
'Warning : No network interface defined.'
print
('Warning : No network interface defined.')
else:
else:
kvm_argument_list += nat_network_parameter + tap_network_parameter
kvm_argument_list += nat_network_parameter + tap_network_parameter
if language in language_list:
if language in language_list:
...
@@ -361,7 +364,7 @@ for nbd_ip, nbd_port in nbd_list:
...
@@ -361,7 +364,7 @@ for nbd_ip, nbd_port in nbd_list:
s = getSocketStatus(nbd_ip, nbd_port)
s = getSocketStatus(nbd_ip, nbd_port)
if s is None:
if s is None:
# NBD is not available : launch kvm without it
# NBD is not available : launch kvm without it
print
'Warning : Nbd is not available.'
print
('Warning : Nbd is not available.')
else:
else:
# NBD is available
# NBD is available
# We close the NBD socket else qemu won't be able to use it apparently
# We close the NBD socket else qemu won't be able to use it apparently
...
@@ -375,5 +378,5 @@ else:
...
@@ -375,5 +378,5 @@ else:
'-drive', 'file=%s,media=cdrom' % default_cdrom_iso
'-drive', 'file=%s,media=cdrom' % default_cdrom_iso
])
])
print
'Starting KVM: \n %s' % ' '.join(kvm_argument_list
)
print
('Starting KVM: \n %s' % ' '.join(kvm_argument_list)
)
os.execv(qemu_path, kvm_argument_list)
os.execv(qemu_path, kvm_argument_list)
software/kvm/test/test.py
View file @
edcf7bfe
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
#
#
##############################################################################
##############################################################################
import
httplib
import
six.moves.http_client
as
httplib
import
json
import
json
import
os
import
os
import
re
import
re
...
@@ -34,7 +34,7 @@ import six
...
@@ -34,7 +34,7 @@ import six
import
slapos.util
import
slapos.util
import
subprocess
import
subprocess
import
sqlite3
import
sqlite3
import
urlparse
from
six.moves.urllib.parse
import
parse_qs
,
urlparse
import
unittest
import
unittest
from
slapos.recipe.librecipe
import
generateHashFromFiles
from
slapos.recipe.librecipe
import
generateHashFromFiles
...
@@ -49,7 +49,7 @@ def sanityCheck():
...
@@ -49,7 +49,7 @@ def sanityCheck():
output
=
e
.
output
output
=
e
.
output
else
:
else
:
state
=
True
state
=
True
if
state
is
True
and
re
.
search
(
r'kvm.*kvm_intel'
,
output
):
if
state
is
True
and
re
.
search
(
b
r'kvm.*kvm_intel'
,
output
):
return
True
return
True
...
@@ -133,7 +133,7 @@ class MonitorAccessMixin(object):
...
@@ -133,7 +133,7 @@ class MonitorAccessMixin(object):
monitor_setup_url
=
connection_parameter_dict
[
'monitor-setup-url'
]
monitor_setup_url
=
connection_parameter_dict
[
'monitor-setup-url'
]
monitor_url_with_auth
=
'https'
+
monitor_setup_url
.
split
(
'https'
)[
2
]
monitor_url_with_auth
=
'https'
+
monitor_setup_url
.
split
(
'https'
)[
2
]
auth
=
urlparse
.
parse_qs
(
urlparse
.
urlparse
(
monitor_url_with_auth
).
path
)
auth
=
parse_qs
(
urlparse
(
monitor_url_with_auth
).
path
)
# check that monitor-base-url for all partitions in the tree are accessible
# check that monitor-base-url for all partitions in the tree are accessible
# with published username and password
# with published username and password
...
...
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