You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ra...@apache.org on 2017/02/23 00:11:01 UTC

[1/5] git commit: updated refs/heads/master to 87f1104

Repository: cloudstack
Updated Branches:
  refs/heads/master 50147a420 -> 87f11044c


 CLOUDSTACK-9724: Fixed missing additional public ip on tier network with cleanup


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ee726af5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ee726af5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ee726af5

Branch: refs/heads/master
Commit: ee726af53bb33c5205d481abc3ab78bd2653f1b6
Parents: e02003d
Author: Jayapal <ja...@accelerite.com>
Authored: Tue Feb 14 14:26:40 2017 +0530
Committer: Jayapal <ja...@accelerite.com>
Committed: Tue Feb 14 14:26:40 2017 +0530

----------------------------------------------------------------------
 server/src/com/cloud/network/IpAddressManagerImpl.java | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee726af5/server/src/com/cloud/network/IpAddressManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/IpAddressManagerImpl.java b/server/src/com/cloud/network/IpAddressManagerImpl.java
index 8a2c3fd..2af596a 100644
--- a/server/src/com/cloud/network/IpAddressManagerImpl.java
+++ b/server/src/com/cloud/network/IpAddressManagerImpl.java
@@ -460,6 +460,13 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
                     }
                 } else {
                     if (activeCount != null && activeCount > 0) {
+                        if (network.getVpcId() != null) {
+                            // If there are more than one ip in the vpc tier network and services configured on it.
+                            // restart network with cleanup case, on network reprogramming this needs to be return true
+                            // because on the VR ips has removed. In VPC case restart tier network with cleanup will not
+                            // reboot the VR. So ipassoc is needed.
+                            return true;
+                        }
                         continue;
                     } else if (addCount != null && addCount.longValue() == totalCount.longValue()) {
                         s_logger.trace("All rules are in Add state, have to assiciate IP with the backend");


[4/5] git commit: updated refs/heads/master to 87f1104

Posted by ra...@apache.org.
Merge pull request #1885 from Accelerite/vpctier

CLOUDSTACK-9724: Fixed missing additional public ip on tier network wIn VPC tier network acquire an ip and configure the PF service on it. VR now will have the two ip addresses on the interface.
Now restart the VPC tier network with cleanup option. After router comes up the public interface has only one ip (source nat ip)
Fixed the above issue.

* pr/1885:
  CLOUDSTACK-9724: Fixed missing additional public ip on tier network with cleanup

Signed-off-by: Rajani Karuturi <ra...@accelerite.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9efd9059
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9efd9059
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9efd9059

Branch: refs/heads/master
Commit: 9efd9059efc1e8d3555fec738668e835a6fc575d
Parents: 50147a4 ee726af
Author: Rajani Karuturi <ra...@accelerite.com>
Authored: Thu Feb 23 05:38:51 2017 +0530
Committer: Rajani Karuturi <ra...@accelerite.com>
Committed: Thu Feb 23 05:38:51 2017 +0530

----------------------------------------------------------------------
 server/src/com/cloud/network/IpAddressManagerImpl.java | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------



[2/5] git commit: updated refs/heads/master to 87f1104

Posted by ra...@apache.org.
CLOUDSTACK-8324: config drive data set/get scripts for the guest vm


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ea09e6c1
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ea09e6c1
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ea09e6c1

Branch: refs/heads/master
Commit: ea09e6c1966f072e227d3f7447644ba5599f73ab
Parents: e02003d
Author: Jayapal <ja...@apache.org>
Authored: Thu Jan 28 16:51:13 2016 +0530
Committer: Jayapal <ja...@accelerite.com>
Committed: Wed Feb 15 12:02:58 2017 +0530

----------------------------------------------------------------------
 setup/bindir/cloud-get-vm-data-configdrive.in   | 132 +++++++++++++++++
 .../cloud-set-guest-password-configdrive.in     | 130 +++++++++++++++++
 .../cloud-set-guest-sshkey-configdrive.in       | 107 ++++++++++++++
 ...et-windows-guest-password-configdrive.bat.in | 140 +++++++++++++++++++
 4 files changed, 509 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ea09e6c1/setup/bindir/cloud-get-vm-data-configdrive.in
----------------------------------------------------------------------
diff --git a/setup/bindir/cloud-get-vm-data-configdrive.in b/setup/bindir/cloud-get-vm-data-configdrive.in
new file mode 100644
index 0000000..40fbc78
--- /dev/null
+++ b/setup/bindir/cloud-get-vm-data-configdrive.in
@@ -0,0 +1,132 @@
+#!/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.
+
+
+mountdir=/mnt/configdrive
+filepath=$mountdir/cloudstack
+
+user_data=$filepath/userdata/user_data.txt
+availability_zone=$filepath/metadata/availability_zone.txt
+cloud_identifier=$filepath/metadata/cloud_identifier.txt
+instance_id=$filepath/metadata/instance_id.txt
+local_hostname=$filepath/metadata/local_hostname.txt
+service_offering=$filepath/metadata/service_offering.txt
+vm_id=$filepath/metadata/vm_id.txt
+public_key=$filepath/metadata/public_keys.txt
+vm_password=$filepath/password/vm_password.txt
+
+# If lable name is other than config, please change the below line as required
+DefaultDisk=/dev/disk/by-label/config
+
+function usage
+{
+    echo -e "USAGE: cloud-get-vm-data -options"
+    echo -e "  where options include:"
+    echo -e "\\t-m | --metadata [availability-zone | cloud-identifier | instance-id | local-hostname | service-offering | vm-id | public-key] \\n\\t\\tprint vm metadata"
+    echo -e "\\t-p | --password \\n\\t\\tprint vm password"
+    echo -e "\\t-u | --userdata \\n\\t\\tprint vm userdata"
+}
+
+function prepare_mount
+{
+    if [ ! -e $mountdir ]; then
+        mkdir $mountdir
+        chmod 700 $mountdir
+    fi
+
+    if [ -e $DefaultDisk ]; then
+        Disk=$DefaultDisk
+    else
+        BLOCK_DEVICE=$(blkid -t LABEL='config' /dev/hd? /dev/sd? /dev/xvd? -o device)
+        if [ -n $BLOCK_DEVICE ]; then
+            Disk=$BLOCK_DEVICE
+        else
+            logger -t "cloud" "Unable to get the VM data: Config drive device not found"
+            exit 1
+        fi
+    fi
+
+    mount -r $Disk $mountdir
+    if [ $? -ne 0 ]; then
+        echo "Failed mounting $Disk to /mnt/configdrive"
+        exit 1
+    fi
+}
+
+function remove_mount
+{
+  umount $mountdir
+}
+
+prepare_mount
+
+case $1 in
+    -u | --userdata )   echo -n "USERDATA: "
+                        filename=$user_data
+                        ;;
+    -m | --metadata )   shift
+                        if [ "$1" != "" ]; then
+                            case $1 in
+                                availability-zone ) echo -n "availability zone: ";  filename=$availability_zone
+                                                    ;;
+                                cloud-identifier )  echo -n "cloud identifier: ";   filename=$cloud_identifier
+                                                    ;;
+                                instance-id )       echo -n "instance-id: ";        filename=$instance_id
+                                                    ;;
+                                local-hostname )    echo -n "local-hostname: ";     filename=$local_hostname
+                                                    ;;
+                                service-offering )  echo -n "service-offering: ";   filename=$service_offering
+                                                    ;;
+                                vm-id )             echo -n  "vm-id: ";             filename=$vm_id
+                                                    ;;
+                                public-key )       echo -n  "public-key: ";         filename=$public_key
+                                                    ;;
+                                * )                 usage
+                                                    remove_mount
+                                                    exit 1
+                            esac
+                        else
+                            echo -e "METADATA\\n"
+                            [ -f $availability_zone ] && echo -e "availability zone:\t" "$(cat $availability_zone)"
+                            [ -f $cloud_identifier ]  && echo -e "cloud identifier:\t"  "$(cat $cloud_identifier)"
+                            [ -f $instance_id ]       && echo -e "instance-id:\t\t"     "$(cat $instance_id)"
+                            [ -f $local_hostname ]    && echo -e "local-hostname:\t\t"  "$(cat $local_hostname)"
+                            [ -f $service_offering ]  && echo -e "service-offering:\t"  "$(cat $service_offering)"
+                            [ -f $vm_id ]             && echo -e "vm-id:\t\t\t"         "$(cat $vm_id)"
+                            [ -f $public_key ]        && echo -e "public-key:\t\t"      "$(cat $public_key)"
+                        fi
+                        ;;
+    -p | --password )   echo -n "PASSWORD: "
+                        filename=$vm_password
+                        ;;
+    -h | --help )       usage
+                        remove_mount
+                        exit 0
+                        ;;
+    * )                 usage
+                        remove_mount
+                        exit 1
+esac
+
+if [ "$filename" != "" ] && [ -e $filename ]
+then
+    cat $filename
+fi
+
+remove_mount
+exit 0

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ea09e6c1/setup/bindir/cloud-set-guest-password-configdrive.in
----------------------------------------------------------------------
diff --git a/setup/bindir/cloud-set-guest-password-configdrive.in b/setup/bindir/cloud-set-guest-password-configdrive.in
new file mode 100644
index 0000000..0fe1dec
--- /dev/null
+++ b/setup/bindir/cloud-set-guest-password-configdrive.in
@@ -0,0 +1,130 @@
+                                  #!/bin/bash
+#
+# Init file for Password Download Client
+#
+# chkconfig: 345 98 02
+# description: Password Download Client
+
+# 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.
+
+
+# Modify this line to specify the user (default is root)
+user=root
+
+mountdir=/mnt/configdrive
+
+# If lable name is other than config, please change the below line as required
+DefaultDisk=/dev/disk/by-label/config
+
+
+Password_File=$mountdir/cloudstack/password/vm_password.txt
+password_received=0
+
+function prepare_mount
+{
+    if [ ! -e $mountdir ]; then
+        mkdir $mountdir
+        chmod 700 $mountdir
+    fi
+
+    if [ -e $DefaultDisk ]; then
+        Disk=$DefaultDisk
+    else
+        BLOCK_DEVICE=$(blkid -t LABEL='config' /dev/hd? /dev/sd? /dev/xvd? -o device)
+        if [ -n $BLOCK_DEVICE ]; then
+            Disk=$BLOCK_DEVICE
+        else
+            logger -t "cloud" "Unable to set password to VM: Config drive not found"
+            exit 1
+        fi
+    fi
+
+    mount -r $Disk $mountdir
+    if [ $? -ne 0 ]; then
+        echo "Failed mounting $Disk to /mnt/configdrive"
+        exit 1
+    fi
+}
+
+function remove_mount
+{
+  umount $mountdir
+}
+
+prepare_mount
+
+
+if [ -f $Password_File ]
+then
+    password=$(cat $Password_File)
+    password=$(echo $password | tr -d '\r')
+    remove_mount
+
+    case $password in
+
+        "")                 logger -t "cloud" "Config drive did not have any password for the VM"
+                            exit 0
+                            ;;
+
+        "saved_password")   logger -t "cloud" "VM has already saved a password"
+                            exit 0
+                            ;;
+
+        *)                  logger -t "cloud" "VM got a valid password"
+                            password_received=1
+                            ;;
+        esac
+else
+    remove_mount
+    logger -t "cloud" "Password set failed on VM: password file not found in config drive"
+    exit 0
+fi
+
+if [ "$password_received" = "1" ]; then
+
+   newmd5sum=$(echo $password | md5sum | awk '{print $1}')
+   if [ -f /var/vmpasswordmd5sum ]
+   then
+       oldsum=$(cat /var/vmpasswordmd5sum)
+
+       if [ "$newmd5sum" ==  "$oldsum" ]
+       then
+           logger -t "cloud"  "There is no update of VM password from cloudstack, returning true"
+           exit 0
+       fi
+   fi
+
+    logger -t "cloud" "Changing password ..."
+    echo $user:$password | chpasswd
+
+    if [ $? -gt 0 ]
+    then
+        usermod -p `mkpasswd -m SHA-512 $password` $user
+
+        if [ $? -gt 0 ]
+        then
+            logger -t "cloud" "Failed to change password for user $user"
+            exit 1
+        else
+            logger -t "cloud" "Successfully changed password for user $user"
+        fi
+    fi
+fi
+
+ echo $newmd5sum > /var/vmpasswordmd5sum
+exit 0

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ea09e6c1/setup/bindir/cloud-set-guest-sshkey-configdrive.in
----------------------------------------------------------------------
diff --git a/setup/bindir/cloud-set-guest-sshkey-configdrive.in b/setup/bindir/cloud-set-guest-sshkey-configdrive.in
new file mode 100644
index 0000000..773f92e
--- /dev/null
+++ b/setup/bindir/cloud-set-guest-sshkey-configdrive.in
@@ -0,0 +1,107 @@
+#!/bin/bash
+#
+# Init file for SSH Public Keys Download Client
+#
+# chkconfig: 345 98 02
+# description: SSH Public Keys Download Client
+
+# 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.
+
+
+# Modify this line to specify the user (default is root)
+user=root
+
+mountdir=/mnt/configdrive
+
+# If lable name is other than config, please change the below line as required
+DefaultDisk=/dev/disk/by-label/config
+
+SSHKey_File=$mountdir/cloudstack/metadata/public_keys.txt
+keys_received=0
+
+function prepare_mount
+{
+    if [ ! -e $mountdir ]; then
+        mkdir $mountdir
+        chmod 700 $mountdir
+    fi
+
+    if [ -e $DefaultDisk ]; then
+        Disk=$DefaultDisk
+    else
+        BLOCK_DEVICE=$(blkid -t LABEL='config' /dev/hd? /dev/sd? /dev/xvd? -o device)
+        if [ -n $BLOCK_DEVICE ]; then
+            Disk=$BLOCK_DEVICE
+        else
+            logger -t "cloud" "Unable to get SSH public key: Config drive not found"
+            exit 1
+        fi
+    fi
+
+    mount -r $Disk $mountdir
+    if [ $? -ne 0 ]; then
+        echo "Failed mounting $Disk to /mnt/configdrive"
+        exit 1
+    fi
+}
+
+function remove_mount
+{
+  umount $mountdir
+}
+
+prepare_mount
+
+
+if [ -f $SSHKey_File ]
+then
+    publickey=$(cat $SSHKey_File)
+    publickey=$(echo $publickey | tr -d '\r')
+    remove_mount
+
+    if [ -z "$publickey" ]; then
+        logger -t "cloud" "Did not receive any keys"
+        exit 1
+    fi
+else
+    remove_mount
+    logger -t "cloud" "Did not receive any keys"
+    exit 1
+fi
+
+homedir=$(grep ^$user /etc/passwd|awk -F ":" '{print $6}')
+sshdir=$homedir/.ssh
+authorized=$sshdir/authorized_keys
+
+if [ ! -e $sshdir ]; then
+    mkdir $sshdir
+    chmod 700 $sshdir
+fi
+
+if [ ! -e $authorized ]; then
+    touch $authorized
+    chmod 600 $authorized
+fi
+
+
+cat $authorized|grep -v "$publickey"|tee $authorized > /dev/null
+echo "$publickey" >> $authorized
+
+which restorecon && restorecon -R -v $sshdir
+
+exit 0

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ea09e6c1/setup/bindir/cloud-set-windows-guest-password-configdrive.bat.in
----------------------------------------------------------------------
diff --git a/setup/bindir/cloud-set-windows-guest-password-configdrive.bat.in b/setup/bindir/cloud-set-windows-guest-password-configdrive.bat.in
new file mode 100644
index 0000000..805150a
--- /dev/null
+++ b/setup/bindir/cloud-set-windows-guest-password-configdrive.bat.in
@@ -0,0 +1,140 @@
+@echo off
+
+REM Licensed to the Apache Software Foundation (ASF) under one
+REM or more contributor license agreements.  See the NOTICE file
+REM distributed with this work for additional information
+REM regarding copyright ownership.  The ASF licenses this file
+REM to you under the Apache License, Version 2.0 (the
+REM "License"); you may not use this file except in compliance
+REM with the License.  You may obtain a copy of the License at
+REM
+REM   http://www.apache.org/licenses/LICENSE-2.0
+REM
+REM Unless required by applicable law or agreed to in writing,
+REM software distributed under the License is distributed on an
+REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+REM KIND, either express or implied.  See the License for the
+REM specific language governing permissions and limitations
+REM under the License.
+
+rem ----------------------------------------------------------------------------------------------------------------
+set PasswordReset_Script=cloud-set-guest-password-configdrive.vbs
+echo Set owshNet = CreateObject^("WScript.Network"^)                                                                                                 > %PasswordReset_Script%
+echo strComputer = owshNet.ComputerName                                                                                                             >> %PasswordReset_Script%
+echo Const HKEY_CURRENT_USER = ^&H80000001                                                                                                          >> %PasswordReset_Script%
+echo registryKeyPath = "SOFTWARE\CLOUDSTACKmd5Checksum\"                                                                                            >> %PasswordReset_Script%
+echo registryKeyName = "PasswordMd5Checksum"                                                                                                        >> %PasswordReset_Script%
+echo CDPath = ""                                                                                                                                    >> %PasswordReset_Script%
+echo configLabelName = "config"                                                                                                                     >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo Set fso = CreateObject ^("Scripting.FileSystemobject"^)                                                                                        >> %PasswordReset_Script%
+echo For Each drive In fso.Drives                                                                                                                   >> %PasswordReset_Script%
+echo    If drive.DriveType = 4 And drive.IsReady Then                                                                                               >> %PasswordReset_Script%
+echo       If drive.VolumeName = configLabelName Then                                                                                               >> %PasswordReset_Script%
+echo            CDPath = drive.Path                                                                                                                 >> %PasswordReset_Script%
+echo       End If                                                                                                                                   >> %PasswordReset_Script%
+echo       Exit For                                                                                                                                 >> %PasswordReset_Script%
+echo    End If                                                                                                                                      >> %PasswordReset_Script%
+echo Next                                                                                                                                           >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo IF CDPath = "" Then                                                                                                                            >> %PasswordReset_Script%
+echo    WScript.Echo "Config Drive not found to set the password to VM"                                                                             >> %PasswordReset_Script%
+echo    WScript.Quit                                                                                                                                >> %PasswordReset_Script%
+echo End If                                                                                                                                         >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo PasswordFileName = "\VM_PASSWORD.txt"                                                                                                          >> %PasswordReset_Script%
+echo PasswordFilePath = CDPath ^& "\CLOUDSTACK\PASSWORD" ^& PasswordFileName                                                                        >> %PasswordReset_Script%
+echo Set ObjFile = fso.OpenTextFile^(PasswordFilePath^)                                                                                             >> %PasswordReset_Script%
+echo If Err.Number ^<^> 0 Then                                                                                                                      >> %PasswordReset_Script%
+echo    WScript.Echo "Error: " ^& PasswordFilePath ^& " --- " ^& Err.Description                                                                    >> %PasswordReset_Script%
+echo    WScript.Quit                                                                                                                                >> %PasswordReset_Script%
+echo End If                                                                                                                                         >> %PasswordReset_Script%
+echo Password = ObjFile.ReadLine                                                                                                                    >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo PasswordMd5checsumFileName = "\VM_PASSWORD_MD5CHECKSUM.txt"                                                                                    >> %PasswordReset_Script%
+echo PasswordMd5checsumFilePath = CDPath ^& "\CLOUDSTACK\PASSWORD" ^& PasswordMd5checsumFileName                                                    >> %PasswordReset_Script%
+echo Set ObjFile2 = fso.OpenTextFile^(PasswordMd5checsumFilePath^)                                                                                  >> %PasswordReset_Script%
+echo If Err.Number ^<^> 0 Then                                                                                                                      >> %PasswordReset_Script%
+echo    WScript.Echo "Error: " ^& PasswordMd5checsumFilePath ^& " --- " ^& Err.Description                                                          >> %PasswordReset_Script%
+echo    WScript.Quit                                                                                                                                >> %PasswordReset_Script%
+echo End If                                                                                                                                         >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo registryKeyValue = ObjFile2.ReadLine                                                                                                           >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo ' The below logic is to make sure script sets the password to VM only when new password appears in config drive                                >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo Set registryObject=GetObject^("winmgmts:{impersonationLevel=impersonate}!\\" ^& strComputer ^& "\root\default:StdRegProv"^)                    >> %PasswordReset_Script%
+echo If registryObject.EnumKey^(HKEY_CURRENT_USER, registryKeyPath, "", ""^) = 0 Then                                                               >> %PasswordReset_Script%
+echo    registryObject.GetStringValue HKEY_CURRENT_USER, registryKeyPath, registryKeyName, previousRegistryKeyValue                                 >> %PasswordReset_Script%
+echo    If ^(previousRegistryKeyValue ^<^> registryKeyValue^) Then                                                                                  >> %PasswordReset_Script%
+echo        SavePasswordChecksum^(^)                                                                                                                >> %PasswordReset_Script%
+echo        SetPasswordToVM^(^)                                                                                                                     >> %PasswordReset_Script%
+echo    End If                                                                                                                                      >> %PasswordReset_Script%
+echo Else                                                                                                                                           >> %PasswordReset_Script%
+echo    Return = registryObject.CreateKey^(HKEY_CURRENT_USER, registryKeyPath^)                                                                     >> %PasswordReset_Script%
+echo    If ^(Return = 0^) And ^(Err.Number = 0^) Then                                                                                               >> %PasswordReset_Script%
+echo        SavePasswordChecksum^(^)                                                                                                                >> %PasswordReset_Script%
+echo        SetPasswordToVM^(^)                                                                                                                     >> %PasswordReset_Script%
+echo    Else                                                                                                                                        >> %PasswordReset_Script%
+echo        Wscript.Echo Now ^& vbTab ^& "Create Registry Key failed while setting the password to VM. Error = " ^& Err.Number                      >> %PasswordReset_Script%
+echo    End If                                                                                                                                      >> %PasswordReset_Script%
+echo End If                                                                                                                                         >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo '                                                                                                                                              >> %PasswordReset_Script%
+echo ' Procedure to set the password to the VM                                                                                                      >> %PasswordReset_Script%
+echo '                                                                                                                                              >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo Sub SetPasswordToVM^(^)                                                                                                                        >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo    Set objUser = GetObject^("WinNT://" ^& strComputer ^& "/administrator"^)                                                                    >> %PasswordReset_Script%
+echo    If Err.Number ^<^> 0 Then                                                                                                                   >> %PasswordReset_Script%
+echo        WScript.Echo Now ^& vbTab ^& "Error connecting to " ^& strComputer ^& " --- " ^& Err.Description                                        >> %PasswordReset_Script%
+echo        Err.Clear                                                                                                                               >> %PasswordReset_Script%
+echo        WScript.Quit                                                                                                                            >> %PasswordReset_Script%
+echo    Else                                                                                                                                        >> %PasswordReset_Script%
+echo        Select Case Password                                                                                                                    >> %PasswordReset_Script%
+echo            Case ""                                                                                                                             >> %PasswordReset_Script%
+echo                WScript.Echo Now ^& vbTab ^& "Config drive did not have any password for the VM"                                                >> %PasswordReset_Script%
+echo                WScript.Quit                                                                                                                    >> %PasswordReset_Script%
+echo            Case "saved_password"                                                                                                               >> %PasswordReset_Script%
+echo                WScript.Echo Now ^& vbTab ^& "VM has already saved the password"                                                                >> %PasswordReset_Script%
+echo                WScript.Quit                                                                                                                    >> %PasswordReset_Script%
+echo            Case else                                                                                                                           >> %PasswordReset_Script%
+echo                objUser.Setpassword Password                                                                                                    >> %PasswordReset_Script%
+echo                objUser.Setinfo                                                                                                                 >> %PasswordReset_Script%
+echo                If Err.Number ^<^> 0 Then                                                                                                       >> %PasswordReset_Script%
+echo                    wscript.Echo Now ^& vbTab ^& "Error setting password for " ^& strComputer ^& "\Administrator" ^& " --- " ^& Err.Description >> %PasswordReset_Script%
+echo                    Err.Clear                                                                                                                   >> %PasswordReset_Script%
+echo                    WScript.Quit                                                                                                                >> %PasswordReset_Script%
+echo                Else                                                                                                                            >> %PasswordReset_Script%
+echo                    WScript.Echo Now ^& vbTab ^& "Password set for " ^& strComputer ^& "\Administrator"                                         >> %PasswordReset_Script%
+echo                End If                                                                                                                          >> %PasswordReset_Script%
+echo        End Select                                                                                                                              >> %PasswordReset_Script%
+echo    End If                                                                                                                                      >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo End Sub                                                                                                                                        >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo Sub SavePasswordChecksum^(^)                                                                                                                   >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo    Return = registryObject.SetStringValue^(HKEY_CURRENT_USER, registryKeyPath, registryKeyName, registryKeyValue^)                             >> %PasswordReset_Script%
+echo    If ^(Return ^<^> 0^) Or ^(Err.Number ^<^> 0^) Then                                                                                          >> %PasswordReset_Script%
+echo        Wscript.Echo Now ^& vbTab ^& "SetStringValue to Registry Key failed while setting the password to VM. Error = " ^& Err.Number           >> %PasswordReset_Script%
+echo    End If                                                                                                                                      >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+echo End Sub                                                                                                                                        >> %PasswordReset_Script%
+echo.                                                                                                                                               >> %PasswordReset_Script%
+rem -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+cscript //Nologo %PasswordReset_Script%


[5/5] git commit: updated refs/heads/master to 87f1104

Posted by ra...@apache.org.
Merge pull request #1379 from jayapalu/configdriveScripts

CLOUDSTACK-8324: config drive data set/get scripts for the guest vmAdded the guest vm scripts for set/get the vm data, password and ssh keys

* pr/1379:
  CLOUDSTACK-8324: updated the mount directory name and kvm virt device
  CLOUDSTACK-8324: config drive data set/get scripts for the guest vm

Signed-off-by: Rajani Karuturi <ra...@accelerite.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/87f11044
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/87f11044
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/87f11044

Branch: refs/heads/master
Commit: 87f11044c86a67beed681944546fb1a938369176
Parents: 9efd905 6518607
Author: Rajani Karuturi <ra...@accelerite.com>
Authored: Thu Feb 23 05:40:13 2017 +0530
Committer: Rajani Karuturi <ra...@accelerite.com>
Committed: Thu Feb 23 05:40:14 2017 +0530

----------------------------------------------------------------------
 setup/bindir/cloud-get-vm-data-configdrive.in   | 132 +++++++++++++++++
 .../cloud-set-guest-password-configdrive.in     | 130 +++++++++++++++++
 .../cloud-set-guest-sshkey-configdrive.in       | 107 ++++++++++++++
 ...et-windows-guest-password-configdrive.bat.in | 140 +++++++++++++++++++
 4 files changed, 509 insertions(+)
----------------------------------------------------------------------



[3/5] git commit: updated refs/heads/master to 87f1104

Posted by ra...@apache.org.
CLOUDSTACK-8324: updated the mount directory name and kvm virt device


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/65186078
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/65186078
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/65186078

Branch: refs/heads/master
Commit: 6518607885faf6867c34c90fe76dc78dadcbbe97
Parents: ea09e6c
Author: Jayapal <ja...@accelerite.com>
Authored: Wed Feb 15 13:58:54 2017 +0530
Committer: Jayapal <ja...@accelerite.com>
Committed: Wed Feb 15 13:58:54 2017 +0530

----------------------------------------------------------------------
 setup/bindir/cloud-get-vm-data-configdrive.in        | 2 +-
 setup/bindir/cloud-set-guest-password-configdrive.in | 4 ++--
 setup/bindir/cloud-set-guest-sshkey-configdrive.in   | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/65186078/setup/bindir/cloud-get-vm-data-configdrive.in
----------------------------------------------------------------------
diff --git a/setup/bindir/cloud-get-vm-data-configdrive.in b/setup/bindir/cloud-get-vm-data-configdrive.in
index 40fbc78..a862fe0 100644
--- a/setup/bindir/cloud-get-vm-data-configdrive.in
+++ b/setup/bindir/cloud-get-vm-data-configdrive.in
@@ -17,7 +17,7 @@
 # under the License.
 
 
-mountdir=/mnt/configdrive
+mountdir=$(mktemp -d)
 filepath=$mountdir/cloudstack
 
 user_data=$filepath/userdata/user_data.txt

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/65186078/setup/bindir/cloud-set-guest-password-configdrive.in
----------------------------------------------------------------------
diff --git a/setup/bindir/cloud-set-guest-password-configdrive.in b/setup/bindir/cloud-set-guest-password-configdrive.in
index 0fe1dec..1aef8bc 100644
--- a/setup/bindir/cloud-set-guest-password-configdrive.in
+++ b/setup/bindir/cloud-set-guest-password-configdrive.in
@@ -26,7 +26,7 @@
 # Modify this line to specify the user (default is root)
 user=root
 
-mountdir=/mnt/configdrive
+mountdir=$(mktemp -d)
 
 # If lable name is other than config, please change the below line as required
 DefaultDisk=/dev/disk/by-label/config
@@ -45,7 +45,7 @@ function prepare_mount
     if [ -e $DefaultDisk ]; then
         Disk=$DefaultDisk
     else
-        BLOCK_DEVICE=$(blkid -t LABEL='config' /dev/hd? /dev/sd? /dev/xvd? -o device)
+        BLOCK_DEVICE=$(blkid -t LABEL='config' /dev/hd? /dev/sd? /dev/xvd? /dev/vd? -o device)
         if [ -n $BLOCK_DEVICE ]; then
             Disk=$BLOCK_DEVICE
         else

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/65186078/setup/bindir/cloud-set-guest-sshkey-configdrive.in
----------------------------------------------------------------------
diff --git a/setup/bindir/cloud-set-guest-sshkey-configdrive.in b/setup/bindir/cloud-set-guest-sshkey-configdrive.in
index 773f92e..df10b43 100644
--- a/setup/bindir/cloud-set-guest-sshkey-configdrive.in
+++ b/setup/bindir/cloud-set-guest-sshkey-configdrive.in
@@ -26,7 +26,7 @@
 # Modify this line to specify the user (default is root)
 user=root
 
-mountdir=/mnt/configdrive
+mountdir=$(mktemp -d)
 
 # If lable name is other than config, please change the below line as required
 DefaultDisk=/dev/disk/by-label/config
@@ -44,7 +44,7 @@ function prepare_mount
     if [ -e $DefaultDisk ]; then
         Disk=$DefaultDisk
     else
-        BLOCK_DEVICE=$(blkid -t LABEL='config' /dev/hd? /dev/sd? /dev/xvd? -o device)
+        BLOCK_DEVICE=$(blkid -t LABEL='config' /dev/hd? /dev/sd? /dev/xvd? /dev/vd? -o device)
         if [ -n $BLOCK_DEVICE ]; then
             Disk=$BLOCK_DEVICE
         else