diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a7b564b0f373..ec6b37506862 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,26 +26,26 @@ repos: - id: identity - id: check-hooks-apply - repo: https://github.com/thlorenz/doctoc.git - rev: v2.3.0 + rev: facaad890e72966c88a6a5592f5b6a01c422deb2 # frozen: v2.5.0 hooks: - id: doctoc name: Add TOC for Markdown files files: ^CONTRIBUTING\.md$|^INSTALL\.md$|^README\.md$ - repo: https://github.com/oxipng/oxipng - rev: v10.1.0 + rev: 340cd9878d8d8289f09fa101b48a8f5f0b7783f4 # frozen: v10.2.0 hooks: - id: oxipng name: run oxipng description: optimize PNG images with lossless compression args: ['-o', '4', '--strip', 'safe', '--alpha'] - repo: https://github.com/gitleaks/gitleaks - rev: v8.30.0 + rev: 2ca41cc1372d1e939a6a879f18cdc19fc1cac1ce # frozen: v8.30.0 hooks: - id: gitleaks name: run gitleaks description: detect hardcoded secrets - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.5.6 + rev: ad1b27d73581aa16cca06fc4a0761fc563ffe8e8 # frozen: v1.5.6 hooks: - id: chmod name: set file permissions @@ -122,7 +122,7 @@ repos: - --fuzzy-match-generates-todo exclude: ^\.github/workflows/.*\.lock\.yml$ - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v6.0.0 + rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0 hooks: #- id: check-added-large-files - id: check-case-conflict @@ -166,18 +166,18 @@ repos: args: [--markdown-linebreak-ext=md] exclude: ^services/console-proxy/rdpconsole/src/test/doc/freerdp-debug-log\.txt$ - repo: https://github.com/codespell-project/codespell - rev: v2.4.2 + rev: 57b21406f092110c18776e39b0bda50d37c945c8 # frozen: v2.4.3 hooks: - id: codespell name: run codespell description: Check spelling with codespell - repo: https://github.com/pycqa/flake8 - rev: 7.3.0 + rev: d93590f5be797aabb60e3b09f2f52dddb02f349f # frozen: 7.3.0 hooks: - - id: flake8 - args: [--config, .github/linters/.flake8] + - id: flake8 + args: [--config, .github/linters/.flake8] - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.48.0 + rev: 5b5dddc4fb0f83c3ea1fc5616fa63e115dce83e0 # frozen: v0.49.1 hooks: - id: markdownlint name: run markdownlint @@ -186,7 +186,7 @@ repos: types: [markdown] files: \.md$ - repo: https://github.com/adrienverge/yamllint - rev: v1.38.0 + rev: cba56bcde1fdd01c1deb3f945e69764c291a6530 # frozen: v1.38.0 hooks: - id: yamllint name: run yamllint diff --git a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmOCFS2Module.py b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmOCFS2Module.py index 06e1e28f28e8..7ff5435a3c29 100755 --- a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmOCFS2Module.py +++ b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmOCFS2Module.py @@ -54,8 +54,8 @@ def _isClusterOnline(self, cluster): cmds = ['service o2cb status', cluster] res = doCmd(cmds) for line in res.split('\n'): - if not 'Checking O2CB cluster' in line: continue - return not 'Offline' in line + if 'Checking O2CB cluster' not in line: continue + return 'Offline' not in line def _load(self): cmd = ['service o2cb load'] diff --git a/scripts/vm/hypervisor/xenserver/cloudstack_pluginlib.py b/scripts/vm/hypervisor/xenserver/cloudstack_pluginlib.py index 84f90d454e3c..3a1b202d4405 100644 --- a/scripts/vm/hypervisor/xenserver/cloudstack_pluginlib.py +++ b/scripts/vm/hypervisor/xenserver/cloudstack_pluginlib.py @@ -409,7 +409,7 @@ def create_tunnel(bridge, remote_ip, gre_key, src_host, dst_host, network_uuid): key_validation = do_cmd(verify_interface_key) ip_validation = do_cmd(verify_interface_ip) - if not gre_key in key_validation or not remote_ip in ip_validation: + if gre_key not in key_validation or remote_ip not in ip_validation: logging.debug("WARNING: Unexpected output while verifying " + "interface %s on bridge %s" % (name, bridge)) return "FAILURE:VERIFY_INTERFACE_FAILED" diff --git a/scripts/vm/hypervisor/xenserver/vmops b/scripts/vm/hypervisor/xenserver/vmops index 4f78a3c90f8b..5a1fa8ce368b 100755 --- a/scripts/vm/hypervisor/xenserver/vmops +++ b/scripts/vm/hypervisor/xenserver/vmops @@ -1180,7 +1180,7 @@ def cleanup_rules(session, args): chainscmd = "iptables-save | grep '^:' | awk '{print $1}' | cut -d':' -f2 | sed 's/-def//'| sed 's/-eg//' | sort|uniq" chains = util.pread2(['/bin/bash', '-c', chainscmd]).split('\n') - vmchains = [ch for ch in chains if 1 in [ ch.startswith(c) for c in ['r-', 'i-', 's-', 'v-', 'l-']]] + vmchains = [ch for ch in chains if 1 in [ ch.startswith(c) for c in ['r-', 'i-', 's-', 'v-', 'l-']]] util.SMlog('cleanup_rules: vmchains= %s' %vmchains) util.SMlog('cleanup_rules: found %s iptables chains for vms on this host %s' % (len(vmchains), hostname[0])) cleaned = 0 @@ -1192,14 +1192,14 @@ def cleanup_rules(session, args): #after trimming the vm names which more than 29 chars, resident vm name and iptables chain name is substring of #of resident vm. for rvm in resident_vms: - if vmname in rvm: + if vmname in rvm: vmpresent = True break if vmpresent is False: vmname = chain + "-untagged" for rvm in resident_vms: - if vmname in rvm: + if vmname in rvm: vmpresent = True break #vm chain is present but vm is not running on the host. So remove the rules @@ -1491,11 +1491,11 @@ def network_rules(session, args): egressrules = 0 for line in lines: logging.debug("Processing rule [%s]." % line) - + #Example of rule: [I:tcp;12;34;1.2.3.4/24,NEXT] -> tokens: ['I:tcp', '12', '34', '1.2.3.4/24,NEXT']. tokens = line.split(';') logging.debug("Tokens %s." % tokens) - + tokens_size = len(tokens) expected_tokens_size = 4 @@ -1530,7 +1530,7 @@ def network_rules(session, args): i = cidrs.index('0.0.0.0/0') del cidrs[i] allow_any = True - + port_range = start + ":" + end logging.debug("port range [%s]" % port_range) diff --git a/scripts/vm/hypervisor/xenserver/vmopsSnapshot b/scripts/vm/hypervisor/xenserver/vmopsSnapshot index 0d5fcc184c54..8dcf2b888328 100755 --- a/scripts/vm/hypervisor/xenserver/vmopsSnapshot +++ b/scripts/vm/hypervisor/xenserver/vmopsSnapshot @@ -6,9 +6,9 @@ # 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 @@ -18,7 +18,7 @@ # Version @VERSION@ # -# A plugin for executing script needed by vmops cloud +# A plugin for executing script needed by vmops cloud import os, sys, time import XenAPIPlugin @@ -91,7 +91,7 @@ def create_secondary_storage_folder(session, args): umount(local_mount_path) # Remove the local folder os.system("rmdir " + local_mount_path) - + return "1" @echo @@ -127,15 +127,15 @@ def delete_secondary_storage_folder(session, args): umount(local_mount_path) # Remove the local folder os.system("rmdir " + local_mount_path) - + return "1" - + @echo def post_create_private_template(session, args): local_mount_path = None try: try: - # get local template folder + # get local template folder templatePath = args["templatePath"] local_mount_path = os.path.join(CLOUD_DIR, util.gen_uuid()) nfsVersion = args["nfsVersion"] @@ -148,7 +148,7 @@ def post_create_private_template(session, args): file_size = args["size"] virtual_size = args["virtualSize"] template_id = args["templateId"] - + # Create the template.properties file template_properties_install_path = local_mount_path + "/template.properties" f = open(template_properties_install_path, "w") @@ -167,7 +167,7 @@ def post_create_private_template(session, args): f.write("size=" + str(file_size) + "\n") f.close() logging.debug("Created template.properties file") - + # Set permissions permissions = stat.S_IREAD | stat.S_IWRITE | stat.S_IRGRP | stat.S_IWGRP | stat.S_IROTH | stat.S_IWOTH os.chmod(template_properties_install_path, permissions) @@ -184,8 +184,8 @@ def post_create_private_template(session, args): umount(local_mount_path) # Remove the local folder os.system("rmdir " + local_mount_path) - return "1" - + return "1" + def isfile(path, isISCSI): errMsg = '' exists = True @@ -193,7 +193,7 @@ def isfile(path, isISCSI): exists = checkVolumeAvailability(path) else: exists = os.path.isfile(path) - + if not exists: errMsg = "File " + path + " does not exist." logging.debug(errMsg) @@ -241,7 +241,7 @@ def scanParent(path): try: lvName = os.path.basename(path) dirname = os.path.dirname(path) - vgName = os.path.basename(dirname) + vgName = os.path.basename(dirname) vhdInfo = vhdutil.getVHDInfoLVM(lvName, lvhdutil.extractUuid, vgName) parentUUID = vhdInfo.parentUuid except: @@ -273,7 +273,7 @@ def getParentOfSnapshot(snapshotUuid, primarySRPath, isISCSI): baseCopyUuid = scanParent(snapshotPath) else: baseCopyUuid = getParent(snapshotPath, isISCSI) - + logging.debug("Base copy of snapshotUuid: " + snapshotUuid + " is " + baseCopyUuid) return baseCopyUuid @@ -282,7 +282,7 @@ def setParent(parent, child): cmd = [VHDUTIL, "modify", "-p", parent, "-n", child] txt = util.pread2(cmd) except: - errMsg = "Unexpected error while trying to set parent of " + child + " to " + parent + errMsg = "Unexpected error while trying to set parent of " + child + " to " + parent logging.debug(errMsg) raise xs_errors.XenError(errMsg) logging.debug("Successfully set parent of " + child + " to " + parent) @@ -315,12 +315,12 @@ def mount(remoteDir, localDir, nfsVersion=None): options = "soft,tcp,timeo=133,retrans=1" if nfsVersion: options += ",vers=" + nfsVersion - try: + try: cmd = ['mount', '-o', options, remoteDir, localDir] txt = util.pread2(cmd) except: txt = '' - errMsg = "Unexpected error while trying to mount " + remoteDir + " to " + localDir + errMsg = "Unexpected error while trying to mount " + remoteDir + " to " + localDir logging.debug(errMsg) raise xs_errors.XenError(errMsg) logging.debug("Successfully mounted " + remoteDir + " to " + localDir) @@ -328,11 +328,11 @@ def mount(remoteDir, localDir, nfsVersion=None): return def umount(localDir): - try: + try: cmd = ['umount', localDir] util.pread2(cmd) except CommandException: - errMsg = "CommandException raised while trying to umount " + localDir + errMsg = "CommandException raised while trying to umount " + localDir logging.debug(errMsg) raise xs_errors.XenError(errMsg) @@ -340,7 +340,7 @@ def umount(localDir): return def mountSnapshotsDir(secondaryStorageMountPath, localMountPointPath, path): - # The aim is to mount secondaryStorageMountPath on + # The aim is to mount secondaryStorageMountPath on # And create / dir on it, if it doesn't exist already. # Assuming that secondaryStorageMountPath exists remotely @@ -410,7 +410,7 @@ def getIsTrueString(stringValue): booleanValue = False if (stringValue and stringValue == 'true'): booleanValue = True - return booleanValue + return booleanValue def makeUnavailable(uuid, primarySRPath, isISCSI): if not isISCSI: @@ -433,7 +433,7 @@ def manageAvailability(path, value): logging.debug(errMsg) if value == "-ay": # Raise an error only if we are trying to make it available. - # Just warn if we are trying to make it unavailable after the + # Just warn if we are trying to make it unavailable after the # snapshot operation is done. raise xs_errors.XenError(errMsg) return @@ -450,7 +450,7 @@ def checkVolumeAvailability(path): errMsg = "Could not determine status of ISCSI path: " + path logging.debug(errMsg) raise xs_errors.XenError(errMsg) - + success = False i = 0 while i < 6: @@ -482,20 +482,20 @@ def isVolumeAvailable(path): logging.debug(errMsg) raise xs_errors.XenError(errMsg) - return (status == "1") + return (status == "1") def getVhdParent(session, args): logging.debug("getParent with " + str(args)) primaryStorageSRUuid = args['primaryStorageSRUuid'] snapshotUuid = args['snapshotUuid'] - isISCSI = getIsTrueString(args['isISCSI']) + isISCSI = getIsTrueString(args['isISCSI']) primarySRPath = getPrimarySRPath(primaryStorageSRUuid, isISCSI) logging.debug("primarySRPath: " + primarySRPath) baseCopyUuid = getParentOfSnapshot(snapshotUuid, primarySRPath, isISCSI) - return baseCopyUuid + return baseCopyUuid def getSnapshotSize(session, args): primaryStorageSRUuid = args['primaryStorageSRUuid'] @@ -545,7 +545,7 @@ def backupSnapshot(session, args): isfile(prevBackupFile, False) # copy baseCopyPath to backupsDir with new uuid - backupVHD = getBackupVHD(backupUuid) + backupVHD = getBackupVHD(backupUuid) backupFile = os.path.join(backupsDir, backupVHD) logging.debug("Back up " + baseCopyUuid + " to Secondary Storage as " + backupUuid) copyfile(baseCopyPath, backupFile, isISCSI) @@ -553,7 +553,7 @@ def backupSnapshot(session, args): # Because the primary storage is always scanned, the parent of this base copy is always the first base copy. # We don't want that, we want a chain of VHDs each of which is a delta from the previous. - # So set the parent of the current baseCopyVHD to prevBackupVHD + # So set the parent of the current baseCopyVHD to prevBackupVHD if prevBackupUuid: # If there was a previous snapshot setParent(prevBackupFile, backupFile) @@ -581,7 +581,7 @@ def deleteSnapshotBackup(session, args): logging.debug("backupVHD " + backupVHD + "does not exist. Not trying to delete it") return "1" logging.debug("backupVHD " + backupVHD + " exists.") - + # Just delete the backupVHD try: os.remove(backupVHD) @@ -591,7 +591,7 @@ def deleteSnapshotBackup(session, args): raise xs_errors.XenError(errMsg) return "1" - + @echo def revert_memory_snapshot(session, args): logging.debug("Calling revert_memory_snapshot with " + str(args)) @@ -620,4 +620,3 @@ def revert_memory_snapshot(session, args): if __name__ == "__main__": XenAPIPlugin.dispatch({"getVhdParent":getVhdParent, "create_secondary_storage_folder":create_secondary_storage_folder, "delete_secondary_storage_folder":delete_secondary_storage_folder, "post_create_private_template":post_create_private_template, "backupSnapshot": backupSnapshot, "deleteSnapshotBackup": deleteSnapshotBackup, "unmountSnapshotsDir": unmountSnapshotsDir, "revert_memory_snapshot":revert_memory_snapshot, "getSnapshotSize":getSnapshotSize}) - diff --git a/systemvm/agent/images/left.png b/systemvm/agent/images/left.png index 01b05a3ddbfc..170ac6b15b8b 100644 Binary files a/systemvm/agent/images/left.png and b/systemvm/agent/images/left.png differ diff --git a/systemvm/agent/images/right.png b/systemvm/agent/images/right.png index d1514e2dc18b..8375d2a10f51 100644 Binary files a/systemvm/agent/images/right.png and b/systemvm/agent/images/right.png differ diff --git a/systemvm/agent/images/right2.png b/systemvm/agent/images/right2.png index 4a3f4752ed1d..28769c5bed77 100644 Binary files a/systemvm/agent/images/right2.png and b/systemvm/agent/images/right2.png differ diff --git a/systemvm/agent/images/winlog.png b/systemvm/agent/images/winlog.png index 59c4e11e229a..94b4ae7f4c2c 100644 Binary files a/systemvm/agent/images/winlog.png and b/systemvm/agent/images/winlog.png differ