Skip to content

Commit 199efd7

Browse files
Simple fixes and code formatting
1 parent de8d94f commit 199efd7

File tree

10 files changed

+22
-8
lines changed

10 files changed

+22
-8
lines changed

engine/components-api/src/main/java/com/cloud/ha/HighAvailabilityManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
import java.util.List;
2020

21+
import org.apache.cloudstack.framework.config.ConfigKey;
22+
2123
import com.cloud.deploy.DeploymentPlanner;
2224
import com.cloud.host.HostVO;
2325
import com.cloud.host.Status;
@@ -28,6 +30,9 @@
2830
* HighAvailabilityManager checks to make sure the VMs are running fine.
2931
*/
3032
public interface HighAvailabilityManager extends Manager {
33+
34+
ConfigKey<Long> TimeToSleep = new ConfigKey<>("Advanced", Long.class, "time.to.sleep", "60", "Time in seconds to sleep if no work items are found.", false, null);
35+
3136
public enum WorkType {
3237
Migration, // Migrating VMs off of a host.
3338
Stop, // Stops a VM for storage pool migration purposes. This should be obsolete now.

systemvm/debian/opt/cloud/bin/configure.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@
2121
import os
2222
import re
2323
import sys
24-
import urllib.request, urllib.parse, urllib.error
2524
import time
2625

26+
# import urllib.request
27+
# import urllib.parse
28+
# import urllib.error
29+
from urllib.parse import urlparse
30+
from urlib import request
31+
2732
from collections import OrderedDict
2833
from fcntl import flock, LOCK_EX, LOCK_UN
2934

@@ -68,7 +73,7 @@ def __update(self, vm_ip, password):
6873
data = urllib.parse.urlencode(payload)
6974
request = urllib.request.Request(url, data=data, headers={"DomU_Request": "save_password"})
7075
try:
71-
resp = urllib.request.urlopen(request, data)
76+
resp = urllib.urlopen(request, data)
7277
logging.debug("Update password server result: http:%s, content:%s" % (resp.code, resp.read()))
7378
except Exception as e:
7479
logging.error("Failed to update password server due to: %s" % e)

systemvm/debian/opt/cloud/bin/cs/CsDhcp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def add(self, entry):
180180
self.dhcp_opts.add("%s,%s" % (tag, 6))
181181
self.dhcp_opts.add("%s,%s" % (tag, 15))
182182

183-
i = IPAddress(entry['ipv4_address'])
183+
i = ip_address(entry['ipv4_address'])
184184
# Calculate the device
185185
for v in self.devinfo:
186186
if i > v['network'].network and i < v['network'].broadcast:

systemvm/debian/opt/cloud/bin/cs/CsHelper.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@
1717
# under the License.
1818
""" General helper functions
1919
for use in the configuration process
20-
2120
"""
2221
import subprocess
2322
import logging
2423
import sys
2524
import os.path
2625
import re
2726
import shutil
28-
from ipaddress import *
27+
from netaddr import *
2928

3029
PUBLIC_INTERFACES = {"router": "eth2", "vpcrouter": "eth1"}
3130

systemvm/debian/opt/cloud/bin/cs/CsNetfilter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from .CsDatabag import CsCmdLine
2020
import logging
2121

22+
2223
class CsChain(object):
2324

2425
def __init__(self):

systemvm/debian/opt/cloud/bin/cs_dhcp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import logging
1919
from ipaddress import *
2020

21+
2122
def merge(dbag, data):
2223
# A duplicate ip address wil clobber the old value
2324
# This seems desirable ....

systemvm/debian/opt/cloud/bin/cs_ip.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ def merge(dbag, ip):
5151
if mac_address in device_map:
5252
nic_dev_id = device_map[mac_address]
5353
ip['device'] = 'eth' + str(nic_dev_id)
54-
ip['broadcast'] = str(ipo.broadcast)
55-
ip['cidr'] = str(ipo.ip) + '/' + str(ipo.prefixlen)
54+
ip['broadcast'] = str(ipo.broadcast_address)
55+
ip['cidr'] = str(ipo.network_address) + '/' + str(ipo.prefixlen)
5656
ip['size'] = str(ipo.prefixlen)
57-
ip['network'] = str(ipo.network) + '/' + str(ipo.prefixlen)
57+
ip['network'] = str(ipo.network_address) + '/' + str(ipo.prefixlen)
5858
if 'nw_type' not in list(ip.keys()):
5959
ip['nw_type'] = 'public'
6060
else:

systemvm/debian/opt/cloud/bin/cs_monitorservice.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from ipaddress import *
1919

20+
2021
def merge(dbag, data):
2122

2223
if "config" in data:

systemvm/debian/opt/cloud/bin/cs_network_acl.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from ipaddress import *
1919

20+
2021
def merge(dbag, data):
2122
dbag[data['device']] = data
2223
return dbag

systemvm/debian/opt/cloud/bin/cs_vmp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from ipaddress import *
1919

20+
2021
def merge(dbag, data):
2122
"""
2223
create a dictionary of values new in data ignoring those in dbag and return it

0 commit comments

Comments
 (0)