Skip to content

Commit efa3436

Browse files
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
1 parent 6c92ccf commit efa3436

13 files changed

Lines changed: 18 additions & 37 deletions

File tree

plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ protected String getDefaultStorageScriptsDir() {
523523
}
524524

525525
protected String getDefaultHypervisorScriptsDir() {
526-
return "scripts/vm/hypervisor/kvm";
526+
return "scripts/vm/hypervisor";
527527
}
528528

529529
protected String getDefaultKvmScriptsDir() {

plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtUpdateHostPasswordCommandWrapper.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,11 @@ public final class LibvirtUpdateHostPasswordCommandWrapper extends CommandWrappe
3636

3737
@Override
3838
public Answer execute(final UpdateHostPasswordCommand command, final LibvirtComputingResource libvirtComputingResource) {
39-
final String hostIp = command.getHostIp();
4039
final String username = command.getUsername();
4140
final String newPassword = command.getNewPassword();
4241

4342
final Script script = new Script(libvirtComputingResource.getUpdateHostPasswdPath(), TIMEOUT, s_logger);
44-
script.add(hostIp, username, newPassword);
43+
script.add(username, newPassword);
4544
final String result = script.execute();
4645

4746
if (result != null) {

plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixUpdateHostPasswordCommandWrapper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public Answer execute(final UpdateHostPasswordCommand command, final CitrixResou
4343
final String newPassword = command.getNewPassword();
4444

4545
final StringBuffer cmdLine = new StringBuffer();
46+
cmdLine.append("sh /opt/cloud/bin/");
4647
cmdLine.append(VRScripts.UPDATE_HOST_PASSWD);
4748
cmdLine.append(' ');
4849
cmdLine.append(username);

scripts/vm/hypervisor/kvm/update_host_passwd.sh renamed to scripts/vm/hypervisor/update_host_passwd.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818

1919
username=$1
2020
new_passwd=$2
21+
expected="successfully."
22+
result=`echo -e "$new_passwd\n$new_passwd" | passwd --stdin $username | grep successfully | awk '{ print $6 }'`
2123

22-
echo -e "$new_passwd\n$new_passwd" | passwd --stdin $username
23-
24-
return $?;
24+
if [ $result = $expected ]; then
25+
exit 0
26+
else
27+
exit 1
28+
fi

scripts/vm/hypervisor/xenserver/update_host_passwd.sh

Lines changed: 0 additions & 24 deletions
This file was deleted.

scripts/vm/hypervisor/xenserver/xcposs/patch

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,4 @@ router_proxy.sh=../../../../network/domr/,0755,/opt/cloud/bin
5858
cloudstack_plugins.conf=..,0644,/etc/xensource
5959
cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins
6060
cloudlog=..,0644,/etc/logrotate.d
61+
update_host_passwd.sh=../..,0755,/opt/cloud/bin

scripts/vm/hypervisor/xenserver/xcpserver/patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ add_to_vcpus_params_live.sh=..,0755,/opt/cloud/bin
5959
cloudstack_plugins.conf=..,0644,/etc/xensource
6060
cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins
6161
cloudlog=..,0644,/etc/logrotate.d
62-
update_host_passwd.sh=..,0755,/opt/cloud/bin
62+
update_host_passwd.sh=../..,0755,/opt/cloud/bin

scripts/vm/hypervisor/xenserver/xenserver56/patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ add_to_vcpus_params_live.sh=..,0755,/opt/cloud/bin
6363
cloudstack_plugins.conf=..,0644,/etc/xensource
6464
cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins
6565
cloudlog=..,0644,/etc/logrotate.d
66-
update_host_passwd.sh=..,0755,/opt/cloud/bin
66+
update_host_passwd.sh=../..,0755,/opt/cloud/bin

scripts/vm/hypervisor/xenserver/xenserver56fp1/patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@ add_to_vcpus_params_live.sh=..,0755,/opt/cloud/bin
6262
cloudstack_plugins.conf=..,0644,/etc/xensource
6363
cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins
6464
cloudlog=..,0644,/etc/logrotate.d
65-
update_host_passwd.sh=..,0755,/opt/cloud/bin
65+
update_host_passwd.sh=../..,0755,/opt/cloud/bin

scripts/vm/hypervisor/xenserver/xenserver60/patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ ovs-pvlan-cleanup.sh=../../../network,0755,/opt/cloud/bin
6868
ovs-get-dhcp-iface.sh=..,0755,/opt/cloud/bin
6969
ovs-get-bridge.sh=..,0755,/opt/cloud/bin
7070
cloudlog=..,0644,/etc/logrotate.d
71-
update_host_passwd.sh=..,0755,/opt/cloud/bin
71+
update_host_passwd.sh=../..,0755,/opt/cloud/bin

0 commit comments

Comments
 (0)