CLOUDSTACK-8607 - Changed update script to return exit code based on the result
- Changed location of the update_host_passwd script - Updated the patch files for XenServer - Updated the script path on LibvirtComputing class - Removed the hostIP from the LibvirtUpdateHostPasswordCommandWrapper execute() method Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/efa34361 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/efa34361 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/efa34361 Branch: refs/heads/reporter Commit: efa34361df72e351cdc1f719a5dba705eab771ef Parents: 6c92ccf Author: wilderrodrigues <[email protected]> Authored: Fri Jul 3 14:29:57 2015 +0200 Committer: wilderrodrigues <[email protected]> Committed: Fri Jul 3 14:29:57 2015 +0200 ---------------------------------------------------------------------- .../kvm/resource/LibvirtComputingResource.java | 2 +- ...LibvirtUpdateHostPasswordCommandWrapper.java | 3 +-- .../CitrixUpdateHostPasswordCommandWrapper.java | 1 + scripts/vm/hypervisor/kvm/update_host_passwd.sh | 24 ----------------- scripts/vm/hypervisor/update_host_passwd.sh | 28 ++++++++++++++++++++ .../hypervisor/xenserver/update_host_passwd.sh | 24 ----------------- scripts/vm/hypervisor/xenserver/xcposs/patch | 1 + scripts/vm/hypervisor/xenserver/xcpserver/patch | 2 +- .../vm/hypervisor/xenserver/xenserver56/patch | 2 +- .../hypervisor/xenserver/xenserver56fp1/patch | 2 +- .../vm/hypervisor/xenserver/xenserver60/patch | 2 +- .../vm/hypervisor/xenserver/xenserver62/patch | 2 +- .../vm/hypervisor/xenserver/xenserver65/patch | 2 +- .../com/cloud/resource/ResourceManagerImpl.java | 2 +- 14 files changed, 39 insertions(+), 58 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efa34361/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index 782ea28..5419a60 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@ -523,7 +523,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } protected String getDefaultHypervisorScriptsDir() { - return "scripts/vm/hypervisor/kvm"; + return "scripts/vm/hypervisor"; } protected String getDefaultKvmScriptsDir() { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efa34361/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtUpdateHostPasswordCommandWrapper.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtUpdateHostPasswordCommandWrapper.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtUpdateHostPasswordCommandWrapper.java index 7ed827d..4d7d234 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtUpdateHostPasswordCommandWrapper.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtUpdateHostPasswordCommandWrapper.java @@ -36,12 +36,11 @@ public final class LibvirtUpdateHostPasswordCommandWrapper extends CommandWrappe @Override public Answer execute(final UpdateHostPasswordCommand command, final LibvirtComputingResource libvirtComputingResource) { - final String hostIp = command.getHostIp(); final String username = command.getUsername(); final String newPassword = command.getNewPassword(); final Script script = new Script(libvirtComputingResource.getUpdateHostPasswdPath(), TIMEOUT, s_logger); - script.add(hostIp, username, newPassword); + script.add(username, newPassword); final String result = script.execute(); if (result != null) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efa34361/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixUpdateHostPasswordCommandWrapper.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixUpdateHostPasswordCommandWrapper.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixUpdateHostPasswordCommandWrapper.java index 7d0c99a..d5a530b 100644 --- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixUpdateHostPasswordCommandWrapper.java +++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixUpdateHostPasswordCommandWrapper.java @@ -43,6 +43,7 @@ public final class CitrixUpdateHostPasswordCommandWrapper extends CommandWrapper final String newPassword = command.getNewPassword(); final StringBuffer cmdLine = new StringBuffer(); + cmdLine.append("sh /opt/cloud/bin/"); cmdLine.append(VRScripts.UPDATE_HOST_PASSWD); cmdLine.append(' '); cmdLine.append(username); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efa34361/scripts/vm/hypervisor/kvm/update_host_passwd.sh ---------------------------------------------------------------------- diff --git a/scripts/vm/hypervisor/kvm/update_host_passwd.sh b/scripts/vm/hypervisor/kvm/update_host_passwd.sh deleted file mode 100755 index 39e4a3b..0000000 --- a/scripts/vm/hypervisor/kvm/update_host_passwd.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -username=$1 -new_passwd=$2 - -echo -e "$new_passwd\n$new_passwd" | passwd --stdin $username - -return $?; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efa34361/scripts/vm/hypervisor/update_host_passwd.sh ---------------------------------------------------------------------- diff --git a/scripts/vm/hypervisor/update_host_passwd.sh b/scripts/vm/hypervisor/update_host_passwd.sh new file mode 100755 index 0000000..9dfc5a9 --- /dev/null +++ b/scripts/vm/hypervisor/update_host_passwd.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +username=$1 +new_passwd=$2 +expected="successfully." +result=`echo -e "$new_passwd\n$new_passwd" | passwd --stdin $username | grep successfully | awk '{ print $6 }'` + +if [ $result = $expected ]; then + exit 0 +else + exit 1 +fi \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efa34361/scripts/vm/hypervisor/xenserver/update_host_passwd.sh ---------------------------------------------------------------------- diff --git a/scripts/vm/hypervisor/xenserver/update_host_passwd.sh b/scripts/vm/hypervisor/xenserver/update_host_passwd.sh deleted file mode 100755 index 39e4a3b..0000000 --- a/scripts/vm/hypervisor/xenserver/update_host_passwd.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -username=$1 -new_passwd=$2 - -echo -e "$new_passwd\n$new_passwd" | passwd --stdin $username - -return $?; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efa34361/scripts/vm/hypervisor/xenserver/xcposs/patch ---------------------------------------------------------------------- diff --git a/scripts/vm/hypervisor/xenserver/xcposs/patch b/scripts/vm/hypervisor/xenserver/xcposs/patch index 561d7b6..d3c5db0 100644 --- a/scripts/vm/hypervisor/xenserver/xcposs/patch +++ b/scripts/vm/hypervisor/xenserver/xcposs/patch @@ -58,3 +58,4 @@ router_proxy.sh=../../../../network/domr/,0755,/opt/cloud/bin cloudstack_plugins.conf=..,0644,/etc/xensource cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins cloudlog=..,0644,/etc/logrotate.d +update_host_passwd.sh=../..,0755,/opt/cloud/bin \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efa34361/scripts/vm/hypervisor/xenserver/xcpserver/patch ---------------------------------------------------------------------- diff --git a/scripts/vm/hypervisor/xenserver/xcpserver/patch b/scripts/vm/hypervisor/xenserver/xcpserver/patch index 62e15e3..862aa2e 100644 --- a/scripts/vm/hypervisor/xenserver/xcpserver/patch +++ b/scripts/vm/hypervisor/xenserver/xcpserver/patch @@ -59,4 +59,4 @@ add_to_vcpus_params_live.sh=..,0755,/opt/cloud/bin cloudstack_plugins.conf=..,0644,/etc/xensource cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins cloudlog=..,0644,/etc/logrotate.d -update_host_passwd.sh=..,0755,/opt/cloud/bin \ No newline at end of file +update_host_passwd.sh=../..,0755,/opt/cloud/bin \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efa34361/scripts/vm/hypervisor/xenserver/xenserver56/patch ---------------------------------------------------------------------- diff --git a/scripts/vm/hypervisor/xenserver/xenserver56/patch b/scripts/vm/hypervisor/xenserver/xenserver56/patch index 2145b31..23da0f3 100644 --- a/scripts/vm/hypervisor/xenserver/xenserver56/patch +++ b/scripts/vm/hypervisor/xenserver/xenserver56/patch @@ -63,4 +63,4 @@ add_to_vcpus_params_live.sh=..,0755,/opt/cloud/bin cloudstack_plugins.conf=..,0644,/etc/xensource cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins cloudlog=..,0644,/etc/logrotate.d -update_host_passwd.sh=..,0755,/opt/cloud/bin \ No newline at end of file +update_host_passwd.sh=../..,0755,/opt/cloud/bin \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efa34361/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch ---------------------------------------------------------------------- diff --git a/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch b/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch index 60404dc..a67224f 100644 --- a/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch +++ b/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch @@ -62,4 +62,4 @@ add_to_vcpus_params_live.sh=..,0755,/opt/cloud/bin cloudstack_plugins.conf=..,0644,/etc/xensource cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins cloudlog=..,0644,/etc/logrotate.d -update_host_passwd.sh=..,0755,/opt/cloud/bin \ No newline at end of file +update_host_passwd.sh=../..,0755,/opt/cloud/bin \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efa34361/scripts/vm/hypervisor/xenserver/xenserver60/patch ---------------------------------------------------------------------- diff --git a/scripts/vm/hypervisor/xenserver/xenserver60/patch b/scripts/vm/hypervisor/xenserver/xenserver60/patch index c22d469..cf2f03e 100644 --- a/scripts/vm/hypervisor/xenserver/xenserver60/patch +++ b/scripts/vm/hypervisor/xenserver/xenserver60/patch @@ -68,4 +68,4 @@ ovs-pvlan-cleanup.sh=../../../network,0755,/opt/cloud/bin ovs-get-dhcp-iface.sh=..,0755,/opt/cloud/bin ovs-get-bridge.sh=..,0755,/opt/cloud/bin cloudlog=..,0644,/etc/logrotate.d -update_host_passwd.sh=..,0755,/opt/cloud/bin \ No newline at end of file +update_host_passwd.sh=../..,0755,/opt/cloud/bin \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efa34361/scripts/vm/hypervisor/xenserver/xenserver62/patch ---------------------------------------------------------------------- diff --git a/scripts/vm/hypervisor/xenserver/xenserver62/patch b/scripts/vm/hypervisor/xenserver/xenserver62/patch index 0901924..11d979d 100644 --- a/scripts/vm/hypervisor/xenserver/xenserver62/patch +++ b/scripts/vm/hypervisor/xenserver/xenserver62/patch @@ -64,4 +64,4 @@ ovs-pvlan-cleanup.sh=../../../network,0755,/opt/cloud/bin ovs-get-dhcp-iface.sh=..,0755,/opt/cloud/bin ovs-get-bridge.sh=..,0755,/opt/cloud/bin cloudlog=..,0644,/etc/logrotate.d -update_host_passwd.sh=..,0755,/opt/cloud/bin \ No newline at end of file +update_host_passwd.sh=../..,0755,/opt/cloud/bin \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efa34361/scripts/vm/hypervisor/xenserver/xenserver65/patch ---------------------------------------------------------------------- diff --git a/scripts/vm/hypervisor/xenserver/xenserver65/patch b/scripts/vm/hypervisor/xenserver/xenserver65/patch index 0901924..11d979d 100644 --- a/scripts/vm/hypervisor/xenserver/xenserver65/patch +++ b/scripts/vm/hypervisor/xenserver/xenserver65/patch @@ -64,4 +64,4 @@ ovs-pvlan-cleanup.sh=../../../network,0755,/opt/cloud/bin ovs-get-dhcp-iface.sh=..,0755,/opt/cloud/bin ovs-get-bridge.sh=..,0755,/opt/cloud/bin cloudlog=..,0644,/etc/logrotate.d -update_host_passwd.sh=..,0755,/opt/cloud/bin \ No newline at end of file +update_host_passwd.sh=../..,0755,/opt/cloud/bin \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efa34361/server/src/com/cloud/resource/ResourceManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java index e9825ff..b777de9 100644 --- a/server/src/com/cloud/resource/ResourceManagerImpl.java +++ b/server/src/com/cloud/resource/ResourceManagerImpl.java @@ -2265,7 +2265,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager, if (shouldUpdateHostPasswd) { final boolean isUpdated = doUpdateHostPassword(host.getId()); if (!isUpdated) { - throw new CloudRuntimeException("CloudStack failed to update the password of the Host with UUID/ID ==> " + host.getUuid() + "/" + host.getId() + ". Please make sure you are still able to connect to your hosts."); + throw new CloudRuntimeException("CloudStack failed to update the password of the Host with UUID / ID ==> " + host.getUuid() + " / " + host.getId() + ". Please make sure you are still able to connect to your hosts."); } } }
