You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2022/08/26 11:37:09 UTC

[GitHub] [cloudstack] fermosan commented on a diff in pull request #6550: Emc networker b&r

fermosan commented on code in PR #6550:
URL: https://github.com/apache/cloudstack/pull/6550#discussion_r955953437


##########
scripts/vm/hypervisor/kvm/nsrkvmbackup.sh:
##########
@@ -0,0 +1,270 @@
+#!/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.
+
+
+version=0.9.1
+
+
+OPTIND=1
+
+verb=0
+logDir="/nsr/logs/cloudstack/"
+snapPrefix="CSBKP_$RANDOM_"
+clusterClient=""
+networkerServer=""
+hvVersion=""
+libvVersion=""
+apiVersion=""
+kvmDName=""
+kvmDUuid=""
+logFile=""
+mediaPool=""
+retentionTime=""
+
+
+log () {
+
+    [[ "$verb" -eq 1 ]] && builtin echo "$@"
+    if [[ "$1" == "-ne"  || "$1" == "-e" || "$1" == "-n" ]]; then
+          builtin echo -e "$(date '+%Y-%m-%d %H-%M-%S>')" "${@: 2}" >> "$logFile"
+    else
+          builtin echo "$(date '+%Y-%m-%d %H-%M-%S>')" "$@" >> "$logFile"
+    fi
+
+}
+
+vercomp(){
+   local a b IFS=. -; set -f
+   printf -v a %08d $1; printf -v b %08d $3
+   test $a "$2" $b
+}
+usage() {
+        echo "
+
+Usage:[-v] [-h] [-l log_dir] [-dr] [-s networker_server] [-c networker_cluster_client] [-t target_vm] [-u target_uuid] [-p snapprefix] [-P media_pool ] [-R retention_time ]
+
+Options:
+        -h Help and usage
+        -v Enable verbose mode
+        -l log_dir. Specify log directory. Default is /nsr/logs/cloudstack
+        -s networker_server  Specifiy the EMC Networker server we are going to use
+        -c networker_cluster_client  Specify the EMC Networker client CLUSTER to use
+        -t target_vm KVM domain to backup
+        -u target_uuid KVM domain to backup
+        -p Snapshot Prefix for backups
+        -P mediaPool EMC Networker Media Pool
+        -R retention_time Backup retention time
+
+Supplements Apache Cloudstack B&R Framework  EMC Networker plugin and performs the backup of the Virtual Machines
+"
+
+}
+
+sanity_checks() {
+
+        log "Performing environment sanity checks..."
+        log -ne "\t[1] Checking if Networker is installed\t"
+        if [[ $(systemctl list-unit-files | grep networker) = *networker* ]]; then
+                        log "Success"
+        else
+                        log "Failure"
+                        log -e "\n\tNetworker Service NOT FOUND. Make sure that Networker client is properly installed"
+                        exit 1
+        fi
+
+        log -ne "\t[2] Checking if Networker is running\t"
+        if [[ $(systemctl is-active networker) = *active* ]]; then
+                        log "Success"
+        else
+                        log "Failure"
+                        log -e "\n\tNetworker Service is not running. Investigate Networker logs, startup server and try again"
+                        exit 2
+        fi
+        log -ne "\t[3] Checking Networker DNS Resolution\t"
+        if [[ $(getent hosts "$networkerServer") = *$networkerServer* ]]; then
+                        log "Success"
+        else
+                        log "Failure"
+                        log -e "\n\tNetworker Server cannot be resolved. Backups will most probably fail. Consider adding the ip/hostname to /etc/host or fix DNS resolution"
+                        exit 3
+        fi
+
+        log -ne "\t[4] Checking QEMU / Libvirt Versions \t"
+        hvVersion=$(virsh version | grep hypervisor | awk '{print $(NF)}')

Review Comment:
   It is running on KVM Agents.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org