mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge remote-tracking branch 'origin/4.18'
This commit is contained in:
commit
232c86a715
@ -18,6 +18,8 @@ package com.cloud.storage.secondary;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
|
||||
import com.cloud.agent.api.Command;
|
||||
import com.cloud.agent.api.StartupCommand;
|
||||
import com.cloud.host.HostVO;
|
||||
@ -28,6 +30,12 @@ import com.cloud.vm.SecondaryStorageVmVO;
|
||||
|
||||
public interface SecondaryStorageVmManager extends Manager {
|
||||
|
||||
static final ConfigKey<Long> SecondaryStorageCapacityScanInterval = new ConfigKey<>("Advanced", Long.class,
|
||||
"secstorage.capacityscan.interval",
|
||||
"30000",
|
||||
"The time interval(in millisecond) to scan whether or not system needs more SSVM to ensure minimal standby capacity",
|
||||
false);
|
||||
|
||||
public static final int DEFAULT_SS_VM_RAMSIZE = 512; // 512M
|
||||
public static final int DEFAULT_SS_VM_CPUMHZ = 500; // 500 MHz
|
||||
public static final int DEFAULT_SS_VM_MTUSIZE = 1500;
|
||||
|
||||
@ -174,8 +174,6 @@ import com.cloud.vm.dao.VMInstanceDao;
|
||||
public class SecondaryStorageManagerImpl extends ManagerBase implements SecondaryStorageVmManager, VirtualMachineGuru, SystemVmLoadScanHandler<Long>,
|
||||
ResourceStateAdapter, Configurable {
|
||||
private static final Logger s_logger = Logger.getLogger(SecondaryStorageManagerImpl.class);
|
||||
|
||||
private static final int DEFAULT_CAPACITY_SCAN_INTERVAL_IN_MILLISECONDS = 30000;
|
||||
private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_SYNC_IN_SECONDS = 180;
|
||||
private static final int STARTUP_DELAY_IN_MILLISECONDS = 60000;
|
||||
|
||||
@ -252,8 +250,6 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
||||
private IndirectAgentLB indirectAgentLB;
|
||||
@Inject
|
||||
private CAManager caManager;
|
||||
|
||||
private long _capacityScanInterval = DEFAULT_CAPACITY_SCAN_INTERVAL_IN_MILLISECONDS;
|
||||
private int _secStorageVmMtuSize;
|
||||
|
||||
private String _instance;
|
||||
@ -299,6 +295,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
||||
public boolean generateSetupCommand(Long ssHostId) {
|
||||
HostVO cssHost = _hostDao.findById(ssHostId);
|
||||
Long zoneId = cssHost.getDataCenterId();
|
||||
boolean result = true;
|
||||
if (cssHost.getType() == Host.Type.SecondaryStorageVM) {
|
||||
String hostName = cssHost.getName();
|
||||
|
||||
@ -340,12 +337,12 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
||||
s_logger.debug(String.format("Successfully programmed secondary storage [%s] in secondary storage VM [%s].", ssStore.getName(), secStorageVm.getInstanceName()));
|
||||
} else {
|
||||
s_logger.debug(String.format("Unable to program secondary storage [%s] in secondary storage VM [%s] due to [%s].", ssStore.getName(), secStorageVm.getInstanceName(), answer == null ? "null answer" : answer.getDetails()));
|
||||
return false;
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -872,10 +869,6 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
||||
}
|
||||
|
||||
_allowedInternalSites = _configDao.getValue("secstorage.allowed.internal.sites");
|
||||
|
||||
String value = configs.get("secstorage.capacityscan.interval");
|
||||
_capacityScanInterval = NumbersUtil.parseLong(value, DEFAULT_CAPACITY_SCAN_INTERVAL_IN_MILLISECONDS);
|
||||
|
||||
_instance = configs.get("instance.name");
|
||||
if (_instance == null) {
|
||||
_instance = "DEFAULT";
|
||||
@ -883,7 +876,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
||||
|
||||
Map<String, String> agentMgrConfigs = _configDao.getConfiguration("AgentManager", params);
|
||||
|
||||
value = agentMgrConfigs.get("port");
|
||||
String value = agentMgrConfigs.get("port");
|
||||
_mgmtPort = NumbersUtil.parseInt(value, 8250);
|
||||
|
||||
_listener = new SecondaryStorageListener(this);
|
||||
@ -925,7 +918,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
||||
|
||||
if (_useServiceVM) {
|
||||
_loadScanner = new SystemVmLoadScanner<>(this);
|
||||
_loadScanner.initScan(STARTUP_DELAY_IN_MILLISECONDS, _capacityScanInterval);
|
||||
_loadScanner.initScan(STARTUP_DELAY_IN_MILLISECONDS, SecondaryStorageCapacityScanInterval.value());
|
||||
}
|
||||
|
||||
_httpProxy = configs.get(Config.SecStorageProxy.key());
|
||||
@ -1458,7 +1451,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
||||
|
||||
@Override
|
||||
public ConfigKey<?>[] getConfigKeys() {
|
||||
return new ConfigKey<?>[] {NTPServerConfig, MaxNumberOfSsvmsForMigration};
|
||||
return new ConfigKey<?>[] {NTPServerConfig, MaxNumberOfSsvmsForMigration, SecondaryStorageCapacityScanInterval};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ def mkdir(name, mode, fatal):
|
||||
os.makedirs(name, mode)
|
||||
except OSError as e:
|
||||
if e.errno != 17:
|
||||
print "failed to make directories " + name + " due to :" + e.strerror
|
||||
print("failed to make directories " + name + " due to :" + e.strerror)
|
||||
if(fatal):
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ class CsRedundant(object):
|
||||
|
||||
# No redundancy if there is no guest network
|
||||
if guest is None:
|
||||
self.set_backup()
|
||||
self.set_backup(restart_conntrackd=False)
|
||||
self._redundant_off()
|
||||
return
|
||||
|
||||
@ -111,9 +111,9 @@ class CsRedundant(object):
|
||||
CsHelper.service("keepalived", "stop")
|
||||
return
|
||||
|
||||
CsHelper.mkdir(self.CS_RAMDISK_DIR, 0755, False)
|
||||
CsHelper.mkdir(self.CS_RAMDISK_DIR, 0o755, False)
|
||||
CsHelper.mount_tmpfs(self.CS_RAMDISK_DIR)
|
||||
CsHelper.mkdir(self.CS_ROUTER_DIR, 0755, False)
|
||||
CsHelper.mkdir(self.CS_ROUTER_DIR, 0o755, False)
|
||||
for s in self.CS_TEMPLATES:
|
||||
d = s
|
||||
if s.endswith(".templ"):
|
||||
@ -222,10 +222,9 @@ class CsRedundant(object):
|
||||
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
s.bind('/tmp/primary_lock')
|
||||
return s
|
||||
except socket.error, e:
|
||||
except socket.error as e:
|
||||
error_code = e.args[0]
|
||||
error_string = e.args[1]
|
||||
print "Process already running (%d:%s). Exiting" % (error_code, error_string)
|
||||
logging.info("Primary is already running, waiting")
|
||||
sleep(time_between)
|
||||
|
||||
@ -261,7 +260,7 @@ class CsRedundant(object):
|
||||
interfaces = [interface for interface in self.address.get_interfaces() if interface.is_public()]
|
||||
CsHelper.reconfigure_interfaces(self.cl, interfaces)
|
||||
|
||||
def set_backup(self):
|
||||
def set_backup(self, restart_conntrackd=True):
|
||||
""" Set the current router to backup """
|
||||
if not self.cl.is_redundant():
|
||||
logging.error("Set backup called on non-redundant router")
|
||||
@ -282,7 +281,10 @@ class CsRedundant(object):
|
||||
|
||||
self._remove_ipv6_guest_gateway()
|
||||
|
||||
if restart_conntrackd:
|
||||
CsHelper.service("conntrackd", "restart")
|
||||
else:
|
||||
CsHelper.service("conntrackd", "stop")
|
||||
CsHelper.service("ipsec", "stop")
|
||||
CsHelper.service("xl2tpd", "stop")
|
||||
|
||||
|
||||
@ -702,8 +702,8 @@ routing_svcs() {
|
||||
echo "cloud nfs-common portmap" > /var/cache/cloud/disabled_svcs
|
||||
if [ "$RROUTER" -eq "1" ]
|
||||
then
|
||||
echo "keepalived conntrackd" >> /var/cache/cloud/enabled_svcs
|
||||
echo "dnsmasq" >> /var/cache/cloud/disabled_svcs
|
||||
echo "keepalived" >> /var/cache/cloud/enabled_svcs
|
||||
echo "dnsmasq conntrackd" >> /var/cache/cloud/disabled_svcs
|
||||
else
|
||||
echo "dnsmasq" >> /var/cache/cloud/enabled_svcs
|
||||
echo "keepalived conntrackd" >> /var/cache/cloud/disabled_svcs
|
||||
|
||||
@ -141,7 +141,10 @@ export default {
|
||||
methods: {
|
||||
initForm () {
|
||||
this.formRef = ref()
|
||||
this.form = reactive({})
|
||||
this.form = reactive({
|
||||
mincpunumber: 2,
|
||||
minmemory: 2048
|
||||
})
|
||||
this.rules = reactive({
|
||||
semanticversion: [{ required: true, message: this.$t('message.error.kuberversion') }],
|
||||
zoneid: [{
|
||||
|
||||
@ -692,6 +692,7 @@ export default {
|
||||
|
||||
api('createLoadBalancer', {
|
||||
name: values.name,
|
||||
sourceipaddress: values.sourceIP,
|
||||
sourceport: values.sourcePort,
|
||||
instanceport: values.instancePort,
|
||||
algorithm: values.algorithm,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user