Skip to content

Commit d949302

Browse files
davidjumaniustcweizhoushwstpprrohityadavcloud
authored
packaging: Adding Centos8, Ubuntu 20.04, XCPNG8.1 Support (#4068)
* DB : Add support for MySQL 8 - Splits commands to create user and grant access on database, the old statement is no longer supported by MySQL 8.x - `NO_AUTO_CREATE_USER` is no longer supported by MySQL 8.x so remove that from db.properties conn parameters For mysql-server 8.x setup the following changes were added/tested to make it work with CloudStack in /etc/mysql/mysql.conf.d/mysqld.cnf and then restart the mysql-server process: server_id = 1 sql-mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,ERROR_FOR_DIVISION_BY_ZERO,NO_ZERO_DATE,NO_ZERO_IN_DATE,NO_ENGINE_SUBSTITUTION" innodb_rollback_on_timeout=1 innodb_lock_wait_timeout=600 max_connections=1000 log-bin=mysql-bin binlog-format = 'ROW' default-authentication-plugin=mysql_native_password Notice the last line above, this is to reset the old password based authentication used by MySQL 5.x. Developers can set empty password as follows: > sudo mysql -u root ALTER USER 'root'@'localhost' IDENTIFIED BY ''; In libvirt repository, there are two related commits 2019-08-23 13:13 Daniel P. Berrangé ● rpm: don't enable socket activation in upgrade if --listen present 2019-08-22 14:52 Daniel P. Berrangé ● remote: forbid the --listen arg when systemd socket activation In libvirt.spec.in /bin/systemctl mask libvirtd.socket >/dev/null 2>&1 || : /bin/systemctl mask libvirtd-ro.socket >/dev/null 2>&1 || : /bin/systemctl mask libvirtd-admin.socket >/dev/null 2>&1 || : /bin/systemctl mask libvirtd-tls.socket >/dev/null 2>&1 || : /bin/systemctl mask libvirtd-tcp.socket >/dev/null 2>&1 || : Co-authored-by: Wei Zhou <[email protected]> Co-authored-by: Abhishek Kumar <[email protected]> Co-authored-by: Rohit Yadav <[email protected]>
1 parent 3fe724b commit d949302

File tree

65 files changed

+1627
-535
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1627
-535
lines changed

agent/bindir/cloud-guest-tool.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# Licensed to the Apache Software Foundation (ASF) under one
33
# or more contributor license agreements. See the NOTICE file
44
# distributed with this work for additional information
@@ -78,7 +78,7 @@ class GuestCommand:
7878
info['network'] = 'guest-network-get-interfaces'
7979

8080
result = dict()
81-
for key, cmd in info.items():
81+
for key, cmd in list(info.items()):
8282
result[key] = self.virt.agent_command(self.dom, cmd)
8383

8484
return result, 0

agent/bindir/cloud-setup-agent.in

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22
# Licensed to the Apache Software Foundation (ASF) under one
33
# or more contributor license agreements. See the NOTICE file
44
# distributed with this work for additional information
@@ -31,56 +31,56 @@ from cloudutils.serviceConfig import configureLibvirtConfig
3131
from optparse import OptionParser
3232

3333
def getUserInputs():
34-
print "Welcome to the CloudStack Agent Setup:"
34+
print("Welcome to the CloudStack Agent Setup:")
3535

3636
cfo = configFileOps("@AGENTSYSCONFDIR@/agent.properties")
3737
oldMgt = cfo.getEntry("host")
3838

39-
mgtSvr = raw_input("Please input the Management Server Hostname/IP-Address:[%s]"%oldMgt)
39+
mgtSvr = input("Please input the Management Server Hostname/IP-Address:[%s]"%oldMgt)
4040
if mgtSvr == "":
4141
mgtSvr = oldMgt
4242
try:
4343
socket.getaddrinfo(mgtSvr, 443)
4444
except:
45-
print "Failed to resolve %s. Please input a valid hostname or IP-Address."%mgtSvr
45+
print("Failed to resolve %s. Please input a valid hostname or IP-Address."%mgtSvr)
4646
exit(1)
4747

4848
oldToken = cfo.getEntry("zone")
49-
zoneToken = raw_input("Please input the Zone Id:[%s]"%oldToken)
49+
zoneToken = input("Please input the Zone Id:[%s]"%oldToken)
5050

5151
if zoneToken == "":
5252
zoneToken = oldToken
5353

5454
oldPod = cfo.getEntry("pod")
55-
podId = raw_input("Please input the Pod Id:[%s]"%oldPod)
55+
podId = input("Please input the Pod Id:[%s]"%oldPod)
5656

5757
if podId == "":
5858
podId = oldToken
5959

6060
oldCluster = cfo.getEntry("cluster")
61-
clusterId = raw_input("Please input the Cluster Id:[%s]"%oldCluster)
61+
clusterId = input("Please input the Cluster Id:[%s]"%oldCluster)
6262
if clusterId == "":
6363
clusterId = oldCluster
6464

6565
oldHypervisor = cfo.getEntry("hypervisor")
6666
if oldHypervisor == "":
6767
oldHypervisor = "kvm"
6868

69-
hypervisor = raw_input("Please input the Hypervisor type kvm/lxc:[%s]"%oldHypervisor)
69+
hypervisor = input("Please input the Hypervisor type kvm/lxc:[%s]"%oldHypervisor)
7070
if hypervisor == "":
7171
hypervisor = oldHypervisor
7272

7373
try:
7474
defaultNic = networkConfig.getDefaultNetwork()
7575
except:
76-
print "Failed to get default route. Please configure your network to have a default route"
76+
print("Failed to get default route. Please configure your network to have a default route")
7777
exit(1)
7878

7979
defNic = defaultNic.name
80-
network = raw_input("Please choose which network used to create VM:[%s]"%defNic)
80+
network = input("Please choose which network used to create VM:[%s]"%defNic)
8181
if network == "":
8282
if defNic == "":
83-
print "You need to specifiy one of Nic or bridge on your system"
83+
print("You need to specifiy one of Nic or bridge on your system")
8484
exit(1)
8585
elif network == "":
8686
network = defNic
@@ -115,7 +115,7 @@ if __name__ == '__main__':
115115

116116
if not options.auto and options.secure:
117117
configureLibvirtConfig(True)
118-
print "Libvirtd with TLS configured"
118+
print("Libvirtd with TLS configured")
119119
sys.exit(0)
120120

121121
if options.auto is None:
@@ -131,10 +131,10 @@ if __name__ == '__main__':
131131
if glbEnv.uuid == "":
132132
glbEnv.uuid = bash("uuidgen").getStdout()
133133
else:
134-
for para, value in options.__dict__.items():
134+
for para, value in list(options.__dict__.items()):
135135
if value is None:
136-
print "Missing operand:%s"%para
137-
print "Try %s --help for more information"%sys.argv[0]
136+
print("Missing operand:%s"%para)
137+
print("Try %s --help for more information"%sys.argv[0])
138138
sys.exit(1)
139139

140140
glbEnv.uuid = options.guid
@@ -149,14 +149,14 @@ if __name__ == '__main__':
149149

150150
glbEnv.secure = options.secure
151151

152-
print "Starting to configure your system:"
152+
print("Starting to configure your system:")
153153
syscfg = sysConfigFactory.getSysConfigFactory(glbEnv)
154154
try:
155155
syscfg.config()
156-
print "CloudStack Agent setup is done!"
157-
except (CloudRuntimeException,CloudInternalException), e:
158-
print e
159-
print "Try to restore your system:"
156+
print("CloudStack Agent setup is done!")
157+
except (CloudRuntimeException,CloudInternalException) as e:
158+
print(e)
159+
print("Try to restore your system:")
160160
try:
161161
syscfg.restore()
162162
except:

agent/bindir/cloudstack-agent-upgrade.in

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22
# Licensed to the Apache Software Foundation (ASF) under one
33
# or more contributor license agreements. See the NOTICE file
44
# distributed with this work for additional information
55
# regarding copyright ownership. The ASF licenses this file
66
# to you under the Apache License, Version 2.0 (the
77
# "License"); you may not use this file except in compliance
88
# with the License. You may obtain a copy of the License at
9-
#
9+
#
1010
# http://www.apache.org/licenses/LICENSE-2.0
11-
#
11+
#
1212
# Unless required by applicable law or agreed to in writing,
1313
# software distributed under the License is distributed on an
1414
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -32,7 +32,7 @@ def upgradeBridgeName(brName, enslavedDev):
3232
print("find physical device %s"%phyDev)
3333
newBrName = "br" + phyDev + "-" + vlanId
3434
print("new bridge name %s"%newBrName)
35-
bash("ip link set %s down"%brName)
35+
bash("ip link set %s down"%brName)
3636
bash("ip link set %s name %s"%(brName, newBrName))
3737
bash("ip link set %s up" %newBrName)
3838
cmd = "iptables-save | grep FORWARD | grep -w " + brName
@@ -47,16 +47,16 @@ def upgradeBridgeName(brName, enslavedDev):
4747
except:
4848
logging.exception("Ignoring failure to update rules for rule " + rule + " on bridge " + brName)
4949
if __name__ == '__main__':
50-
netlib = networkConfig()
50+
netlib = networkConfig()
5151
bridges = netlib.listNetworks()
52-
bridges = filter(isOldStyleBridge, bridges)
52+
bridges = list(filter(isOldStyleBridge, bridges))
5353
for br in bridges:
5454
enslavedDev = netlib.getEnslavedDev(br, 1)
5555
if enslavedDev is not None:
5656
upgradeBridgeName(br, enslavedDev)
57-
57+
5858
bridges = netlib.listNetworks()
59-
bridges = filter(isOldStyleBridge, bridges)
59+
bridges = list(filter(isOldStyleBridge, bridges))
6060
if len(bridges) > 0:
6161
print("Warning: upgrade is not finished, still some bridges have the old style name:" + str(bridges))
6262
else:

agent/bindir/libvirtqemuhook.in

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22
# Licensed to the Apache Software Foundation (ASF) under one
33
# or more contributor license agreements. See the NOTICE file
44
# distributed with this work for additional information
@@ -32,7 +32,7 @@ logging.basicConfig(filename='/var/log/libvirt/qemu-hook.log',
3232
logger = logging.getLogger('qemu-hook')
3333

3434
customDir = "/etc/libvirt/hooks/custom"
35-
customDirPermissions = 0744
35+
customDirPermissions = 0o744
3636
timeoutSeconds = 10 * 60
3737
validQemuActions = ['prepare', 'start', 'started', 'stopped', 'release', 'migrate', 'restore', 'reconnect', 'attach']
3838

@@ -128,9 +128,8 @@ def terminateProcess(process, scriptName):
128128

129129

130130
def getCustomScriptsFromDirectory():
131-
return sorted(filter(lambda fileName: (fileName is not None) & (fileName != "") & ('_' in fileName) &
132-
(fileName.startswith((action + '_')) | fileName.startswith(('all' + '_'))),
133-
os.listdir(customDir)), key=lambda fileName: substringAfter(fileName, '_'))
131+
return sorted([fileName for fileName in os.listdir(customDir) if (fileName is not None) & (fileName != "") & ('_' in fileName) &
132+
(fileName.startswith((action + '_')) | fileName.startswith(('all' + '_')))], key=lambda fileName: substringAfter(fileName, '_'))
134133

135134

136135
def substringAfter(s, delimiter):

agent/bindir/rolling-maintenance.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22
# Licensed to the Apache Software Foundation (ASF) under one
33
# or more contributor license agreements. See the NOTICE file
44
# distributed with this work for additional information
@@ -43,7 +43,7 @@ def execute_script(stage, script, payload, timeout):
4343

4444
success = True if exitStatus == 0 or exitStatus == AVOID_MAINTENANCE_EXIT_STATUS else False
4545
avoid_maintenance = True if exitStatus == AVOID_MAINTENANCE_EXIT_STATUS else False
46-
return {"success": success, "message": stdout.strip(), "avoidmaintenance": avoid_maintenance}
46+
return {"success": success, "message": stdout.decode('utf-8').strip(), "avoidmaintenance": avoid_maintenance}
4747
except Exception as e:
4848
logger.error("Error in stage %s: %s" % (script, e))
4949
sys.exit(1)

client/bindir/cloud-setup-management.in

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22
# Licensed to the Apache Software Foundation (ASF) under one
33
# or more contributor license agreements. See the NOTICE file
44
# distributed with this work for additional information
@@ -35,26 +35,26 @@ if __name__ == '__main__':
3535
if options.https:
3636
glbEnv.svrMode = "HttpsServer"
3737
if options.tomcat7:
38-
print "The --tomcat7 option is deprecated, CloudStack now uses embedded Jetty server."
38+
print("The --tomcat7 option is deprecated, CloudStack now uses embedded Jetty server.")
3939
if options.nostart:
4040
glbEnv.noStart = True
4141

4242
glbEnv.mode = "Server"
4343

44-
print "Starting to configure CloudStack Management Server:"
44+
print("Starting to configure CloudStack Management Server:")
4545
try:
4646
syscfg = sysConfigFactory.getSysConfigFactory(glbEnv)
4747
except UnknownSystemException:
48-
print >>sys.stderr, ("Error: CloudStack failed to detect your "
49-
"operating system. Exiting.")
48+
print(("Error: CloudStack failed to detect your "
49+
"operating system. Exiting."), file=sys.stderr)
5050
sys.exit(1)
5151
try:
52-
syscfg.registerService(cloudManagementConfig)
52+
syscfg.registerService(cloudManagementConfig)
5353
syscfg.config()
54-
print "CloudStack Management Server setup is Done!"
55-
except (CloudRuntimeException, CloudInternalException), e:
56-
print e
57-
print "Try to restore your system:"
54+
print("CloudStack Management Server setup is Done!")
55+
except (CloudRuntimeException, CloudInternalException) as e:
56+
print(e)
57+
print("Try to restore your system:")
5858
try:
5959
syscfg.restore()
6060
except:

client/bindir/cloud-update-xenserver-licenses.in

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python -W ignore::DeprecationWarning
1+
#!/usr/bin/python3 -W ignore::DeprecationWarning
22
# -*- coding: utf-8 -*-
33
# Licensed to the Apache Software Foundation (ASF) under one
44
# or more contributor license agreements. See the NOTICE file
@@ -65,7 +65,7 @@ def getknownhosts(host,username,password):
6565
usernames = dict(cur.fetchall())
6666
cur.execute("SELECT h.private_ip_address,d.value FROM cloud.host h inner join cloud.host_details d on (h.id = d.host_id) where d.name = 'password' and setup = 1")
6767
passwords = dict(cur.fetchall())
68-
creds = dict( [ [x,(usernames[x],passwords[x])] for x in usernames.keys() ] )
68+
creds = dict( [ [x,(usernames[x],passwords[x])] for x in list(usernames.keys()) ] )
6969
cur.close()
7070
conn.close()
7171
return creds
@@ -121,7 +121,7 @@ class XenServerConfigurator(Thread):
121121
if self.retval != 0: self.state = 'failed'
122122
else: self.state = 'finished'
123123

124-
except Exception,e:
124+
except Exception as e:
125125
self.state = 'failed'
126126
self.retval = e
127127
#raise
@@ -144,39 +144,39 @@ if options.all:
144144
if len(args) != 0: e("IP addresses cannot be specified if -a is specified")
145145
config = read_properties(cfg)
146146
creds = getknownhosts(config["db.cloud.host"],config["db.cloud.username"],config["db.cloud.password"])
147-
hosts = creds.keys()
147+
hosts = list(creds.keys())
148148
else:
149149
if not args: e("You must specify at least one IP address, or -a")
150150
hosts = args
151151
creds = parseuserpwfromhosts(hosts)
152152

153153
try:
154154
keyfiledata = file(licensefile).read(-1)
155-
except OSError,e:
155+
except OSError as e:
156156
sys.stderr.write("The file %s cannot be opened"%licensefile)
157157
sys.exit(1)
158158

159159
configurators = []
160-
for host,(user,password) in creds.items():
160+
for host,(user,password) in list(creds.items()):
161161
configurators.append ( XenServerConfigurator(host,user,password,keyfiledata ) )
162162

163163

164164
for c in configurators: c.start()
165165

166166
for c in configurators:
167-
print c.host + "...",
167+
print(c.host + "...", end=' ')
168168
c.join()
169169
if c.state == 'failed':
170170
if c.retval:
171171
msg = "failed with return code %s: %s%s"%(c.retval,c.stdout,c.stderr)
172172
msg = msg.strip()
173-
print msg
174-
else: print "failed: %s"%c.retval
173+
print(msg)
174+
else: print("failed: %s"%c.retval)
175175
else:
176-
print "done"
176+
print("done")
177177

178178
successes = len( [ a for a in configurators if not a.state == 'failed' ] )
179179
failures = len( [ a for a in configurators if a.state == 'failed' ] )
180180

181-
print "%3s successes"%successes
182-
print "%3s failures"%failures
181+
print("%3s successes"%successes)
182+
print("%3s failures"%failures)

client/conf/db.properties.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ db.cloud.testWhileIdle=true
3939
db.cloud.timeBetweenEvictionRunsMillis=40000
4040
db.cloud.minEvictableIdleTimeMillis=240000
4141
db.cloud.poolPreparedStatements=false
42-
db.cloud.url.params=prepStmtCacheSize=517&cachePrepStmts=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&serverTimezone=UTC
42+
db.cloud.url.params=prepStmtCacheSize=517&cachePrepStmts=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'&serverTimezone=UTC
4343

4444
# CloudStack database SSL settings
4545
db.cloud.useSSL=false

cloud-cli/bindir/cloud-tool

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# Licensed to the Apache Software Foundation (ASF) under one
44
# or more contributor license agreements. See the NOTICE file

0 commit comments

Comments
 (0)