protected int setConsoleProxyOverridenIp(String newIp) { if (CoreGlobalProperty.UNIT_TEST_ON) { return 0; } ShellResult rst = ShellUtils.runAndReturn( "/usr/bin/zstack-ctl configure consoleProxyOverriddenIp=" + newIp ); return rst.getRetCode(); }
@Override public String toString() { return ln(template).formatByMap(tokens); } }
void afterDelete(final PrimaryStorageInventory inv) { CollectionUtils.safeForEach(delExts, new ForEachFunction<PrimaryStorageDeleteExtensionPoint>() { @Override public void run(PrimaryStorageDeleteExtensionPoint arg) { arg.afterDeletePrimaryStorage(inv); } }); }
public static <T> T stringToValue(String str, Class<T> clazz, T defaultValue) { try { return stringToValue(str, clazz); } catch (Exception e) { return defaultValue; } }
private static ShellResult doRunAndReturn(String cmdstr, String baseDir, boolean withSudo) { ShellRunner runner = new ShellRunner(); runner.command = cmdstr; runner.baseDir = baseDir; runner.withSudo = withSudo; return runner.run(); } }
public void afterStartNewCreatedVm(final VmInstanceInventory inv) { CollectionUtils.forEach(startNewCreatedVmExtensions, new ForEachFunction<VmInstanceStartNewCreatedVmExtensionPoint>() { @Override public void run(VmInstanceStartNewCreatedVmExtensionPoint arg) { arg.afterStartNewCreatedVm(inv); } }); }
public void afterAddVmNicToSecurityGroup(final SecurityGroupInventory sg, final VmInstanceInventory vm, final List<VmNicInventory> nics) { CollectionUtils.safeForEach(addNicExts, new ForEachFunction<AddVmNicToSecurityGroupExtensionPoint>() { @Override public void run(AddVmNicToSecurityGroupExtensionPoint arg) { arg.afterAddVmNic(sg, vm, nics); } }); } }
public void beforeStopVm(final VmInstanceInventory inv) { CollectionUtils.forEach(stopVmExtensions, new ForEachFunction<VmInstanceStopExtensionPoint>() { @Override public void run(VmInstanceStopExtensionPoint arg) { arg.beforeStopVm(inv); } }); }
public void startVmOnKvmFailed(final KVMHostInventory host, final VmInstanceSpec spec, final ErrorCode err) { CollectionUtils.safeForEach(startVmExts, new ForEachFunction<KVMStartVmExtensionPoint>() { @Override public void run(KVMStartVmExtensionPoint arg) { arg.startVmOnKvmFailed(host, spec, err); } }); }
public void rebootVmOnKvmSuccess(final KVMHostInventory host, final VmInstanceInventory vm) { CollectionUtils.safeForEach(rebootVmExts, new ForEachFunction<KVMRebootVmExtensionPoint>() { @Override public void run(KVMRebootVmExtensionPoint arg) { arg.rebootVmOnKvmSuccess(host, vm); } }); }
public void rebootVmOnKvmFailed(final KVMHostInventory host, final VmInstanceInventory vm, final ErrorCode err) { CollectionUtils.safeForEach(rebootVmExts, new ForEachFunction<KVMRebootVmExtensionPoint>() { @Override public void run(KVMRebootVmExtensionPoint arg) { arg.rebootVmOnKvmFailed(host, vm, err); } }); }
void afterDelete(final BackupStorageInventory inv) { CollectionUtils.safeForEach(delExts, new ForEachFunction<BackupStorageDeleteExtensionPoint>() { @Override public void run(BackupStorageDeleteExtensionPoint arg) { arg.afterDeleteSecondaryStorage(inv); } }); }
public void afterDelete(final HostInventory hinv) { CollectionUtils.safeForEach(deleteHostExts, new ForEachFunction<HostDeleteExtensionPoint>() { @Override public void run(HostDeleteExtensionPoint extp) { extp.afterDeleteHost(hinv); } }); }
void afterUpdateOS(final ClusterVO cls) { CollectionUtils.safeForEach(updateOSExts, new ForEachFunction<ClusterUpdateOSExtensionPoint>() { @Override public void run(ClusterUpdateOSExtensionPoint arg) { arg.afterUpdateClusterOS(cls); } }); }
public void beforeStartVm(final VmInstanceInventory inv) { CollectionUtils.safeForEach(startVmExtensions, new ForEachFunction<VmInstanceStartExtensionPoint>() { @Override public void run(VmInstanceStartExtensionPoint arg) { arg.beforeStartVm(inv); } }); }
public void failedToDetachVolume(final VmInstanceInventory vm, final VolumeInventory volume, final ErrorCode errorCode) { CollectionUtils.safeForEach(detachVolumeExtensions, new ForEachFunction<VmDetachVolumeExtensionPoint>() { @Override public void run(VmDetachVolumeExtensionPoint arg) { arg.failedToDetachVolume(vm, volume, errorCode); } }); }
void beforeUpdateOS(final ClusterVO cls) { CollectionUtils.safeForEach(updateOSExts, new ForEachFunction<ClusterUpdateOSExtensionPoint>() { @Override public void run(ClusterUpdateOSExtensionPoint arg) { arg.beforeUpdateClusterOS(cls); } }); }