You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by nv...@apache.org on 2022/03/28 14:41:12 UTC
[cloudstack] branch main updated: Add Python flake8 linting for W291 trailing whitespace with Super-Linter (#4687)
This is an automated email from the ASF dual-hosted git repository.
nvazquez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/main by this push:
new 182899d Add Python flake8 linting for W291 trailing whitespace with Super-Linter (#4687)
182899d is described below
commit 182899d0b5322c6f1739814e9b553b9e8a3df79e
Author: John Bampton <jb...@users.noreply.github.com>
AuthorDate: Tue Mar 29 00:40:26 2022 +1000
Add Python flake8 linting for W291 trailing whitespace with Super-Linter (#4687)
* refactor: remove trailing whitespace from Python files
* Add the GitHub Super-Linter
Add Python flake8 linting for W291 trailing whitespace
* Add licenses
---
.../sandbox/__init__.py => .github/linters/.flake8 | 7 +-
.../__init__.py => .github/workflows/linter.yml | 17 +-
cloud-cli/cloudapis/__init__.py | 6 +-
cloud-cli/cloudtool/__init__.py | 22 +-
cloud-cli/cloudtool/utils.py | 38 +-
.../security_group_agent/cs_sg_agent.py | 102 +++---
.../security_group_agent/sglib.py | 44 +--
.../security_group_agent/xmlobject.py | 52 +--
.../scripts/vm/hypervisor/ovm/ConfigFileOps.py | 36 +-
.../scripts/vm/hypervisor/ovm/OvmCommonModule.py | 16 +-
.../scripts/vm/hypervisor/ovm/OvmDiskModule.py | 10 +-
.../scripts/vm/hypervisor/ovm/OvmDispatcher.py | 4 +-
.../scripts/vm/hypervisor/ovm/OvmFaultConstants.py | 18 +-
.../vm/hypervisor/ovm/OvmHaHeartBeatModule.py | 24 +-
.../scripts/vm/hypervisor/ovm/OvmHostModule.py | 54 +--
.../scripts/vm/hypervisor/ovm/OvmLoggerModule.py | 12 +-
.../scripts/vm/hypervisor/ovm/OvmNetworkModule.py | 100 +++---
.../scripts/vm/hypervisor/ovm/OvmOCFS2Module.py | 22 +-
.../scripts/vm/hypervisor/ovm/OvmObjectModule.py | 4 +-
.../vm/hypervisor/ovm/OvmSecurityGroupModule.py | 134 +++----
.../vm/hypervisor/ovm/OvmStoragePoolModule.py | 105 +++---
.../main/scripts/vm/hypervisor/ovm/OvmVifModule.py | 10 +-
.../main/scripts/vm/hypervisor/ovm/OvmVmModule.py | 108 +++---
.../scripts/vm/hypervisor/ovm/OvmVolumeModule.py | 29 +-
.../stratosphere-ssp/sspmock/sspmock.py | 4 +-
python/bindir/cloud-external-ipallocator.py | 30 +-
python/incubation/cloud-web-ipallocator.py | 30 +-
python/lib/cloudutils/__init__.py | 4 +-
python/lib/cloudutils/cloudException.py | 6 +-
python/lib/cloudutils/configFileOps.py | 34 +-
python/lib/cloudutils/networkConfig.py | 26 +-
scripts/network/exdhcp/dhcpd_edithosts.py | 8 +-
scripts/network/ping/baremetal_user_data.py | 30 +-
scripts/network/ping/prepare_kickstart_bootfile.py | 8 +-
.../ping/prepare_kickstart_kernel_initrd.py | 12 +-
scripts/network/ping/prepare_tftp_bootfile.py | 8 +-
scripts/util/ipmi.py | 16 +-
scripts/util/macgen.py | 6 +-
scripts/vm/hypervisor/vmware/discover_networks.py | 8 +-
.../hypervisor/xenserver/cloudstack_pluginlib.py | 4 +-
scripts/vm/hypervisor/xenserver/mockxcpplugin.py | 4 +-
scripts/vm/hypervisor/xenserver/ovs-vif-flows.py | 6 +-
scripts/vm/hypervisor/xenserver/perfmon.py | 6 +-
scripts/vm/hypervisor/xenserver/xcposs/NFSSR.py | 16 +-
scripts/vm/hypervisor/xenserver/xcpserver/NFSSR.py | 16 +-
.../xenserver/xenserver56/InterfaceReconfigure.py | 28 +-
.../vm/hypervisor/xenserver/xenserver56/NFSSR.py | 16 +-
.../hypervisor/xenserver/xenserver56fp1/NFSSR.py | 16 +-
.../vm/hypervisor/xenserver/xenserver60/NFSSR.py | 16 +-
scripts/vm/network/vnet/cloudstack_pluginlib.py | 4 +-
scripts/vm/network/vnet/ovstunnel.py | 4 +-
test/integration/__init__.py | 4 +-
.../broken/maint/test_escalation_templates.py | 8 +-
.../broken/maint/test_vpc_host_maintenance.py | 38 +-
test/integration/broken/misc/test_vm_sync.py | 2 +-
test/integration/broken/test_vpn_service.py | 2 +-
test/integration/component/__init__.py | 4 +-
.../maint/test_egress_rules_host_maintenance.py | 4 +-
.../maint/test_ip_resource_count_for_vpc.py | 2 +-
.../component/maint/testpath_vMotion_vmware.py | 10 +-
.../component/test_acl_isolatednetwork.py | 8 +-
.../component/test_acl_isolatednetwork_delete.py | 92 ++---
.../integration/component/test_acl_listsnapshot.py | 10 +-
test/integration/component/test_acl_listvm.py | 6 +-
test/integration/component/test_acl_listvolume.py | 10 +-
.../component/test_acl_sharednetwork.py | 146 ++++----
...est_acl_sharednetwork_deployVM-impersonation.py | 18 +-
test/integration/component/test_affinity_groups.py | 2 +-
.../component/test_affinity_groups_projects.py | 72 ++--
.../component/test_allocation_states.py | 4 +-
test/integration/component/test_asa1000v_fw.py | 4 +-
test/integration/component/test_assign_vm.py | 2 +-
test/integration/component/test_baremetal.py | 12 +-
test/integration/component/test_blocker_bugs.py | 8 +-
.../integration/component/test_browse_templates.py | 44 +--
test/integration/component/test_browse_volumes.py | 4 +-
test/integration/component/test_host.py | 24 +-
test/integration/component/test_interop_xd_ccp.py | 18 +-
.../component/test_netscaler_configs.py | 18 +-
.../component/test_netscaler_lb_algo.py | 2 +-
.../component/test_non_contiguous_vlan.py | 2 +-
.../component/test_organization_states.py | 6 +-
test/integration/component/test_project_configs.py | 6 +-
test/integration/component/test_project_limits.py | 4 +-
test/integration/component/test_project_usage.py | 6 +-
.../component/test_redundant_router_services.py | 4 +-
test/integration/component/test_secsr_mount.py | 16 +-
test/integration/component/test_stopped_vm.py | 4 +-
test/integration/component/test_tags.py | 86 ++---
.../component/test_updateResourceCount.py | 18 +-
.../component/test_volume_destroy_recover.py | 8 +-
.../component/test_vpc_network_lbrules.py | 6 +-
.../component/test_vpc_network_staticnatrule.py | 10 +-
.../component/test_vpc_vm_life_cycle.py | 24 +-
test/integration/plugins/datera/TestVolumes.py | 2 +-
test/integration/plugins/test_quota.py | 16 +-
test/integration/smoke/__init__.py | 4 +-
test/integration/smoke/test_affinity_groups.py | 6 +-
.../smoke/test_affinity_groups_projects.py | 4 +-
.../smoke/test_backup_recovery_dummy.py | 6 +-
.../test_create_list_domain_account_project.py | 2 +-
.../smoke/test_deploy_vgpu_enabled_vm.py | 24 +-
.../smoke/test_deploy_vm_with_userdata.py | 2 +-
test/integration/smoke/test_guest_vlan_range.py | 2 +-
test/integration/smoke/test_list_ids_parameter.py | 6 +-
test/integration/smoke/test_loadbalance.py | 2 +-
.../smoke/test_nested_virtualization.py | 6 +-
test/integration/smoke/test_password_server.py | 4 +-
test/integration/smoke/test_public_ip_range.py | 6 +-
test/integration/smoke/test_reset_vm_on_reboot.py | 2 +-
test/integration/smoke/test_resource_detail.py | 18 +-
test/integration/smoke/test_router_dnsservice.py | 2 +-
.../smoke/test_routers_iptables_default_policy.py | 22 +-
test/integration/smoke/test_routers_network_ops.py | 4 +-
test/integration/smoke/test_snapshots.py | 2 +-
test/integration/smoke/test_ssvm.py | 2 +-
test/integration/smoke/test_vpc_redundant.py | 20 +-
test/integration/smoke/test_vpc_router_nics.py | 10 +-
test/integration/testpaths/__init__.py | 4 +-
.../testpaths/testpath_attach_disk_zwps.py | 2 +-
test/integration/testpaths/testpath_netmask.py | 2 +-
test/integration/testpaths/testpath_revert_snap.py | 10 +-
.../testpaths/testpath_volume_recurring_snap.py | 18 +-
.../testpaths/testpath_volume_snapshot.py | 42 +--
test/selenium/common/shared.py | 2 +-
test/selenium/lib/Global_Locators.py | 4 +-
test/selenium/lib/initialize.py | 2 +-
test/selenium/smoke/Login_and_Accounts.py | 134 +++----
test/selenium/smoke/Service_Offering.py | 216 ++++++------
test/selenium/smoke/TemplatesAndISO.py | 108 +++---
test/selenium/smoke/VM_lifeCycle.py | 388 ++++++++++-----------
test/selenium/smoke/main.py | 16 +-
test/systemvm/test_update_config.py | 42 +--
tools/bugs-wiki/search-bugs.py | 4 +-
tools/bugs-wiki/search-wiki.py | 4 +-
tools/devcloud-kvm/devcloud-kvm.py | 14 +-
tools/marvin/marvin/deployDataCenter.py | 2 +-
tools/marvin/marvin/lib/__init__.py | 4 +-
tools/marvin/marvin/lib/ncc.py | 2 +-
tools/marvin/marvin/lib/utils.py | 12 +-
tools/marvin/marvin/lib/vcenter.py | 2 +-
tools/marvin/marvin/misc/build/advanced_env.py | 12 +-
tools/marvin/marvin/misc/build/bashUtils.py | 26 +-
tools/marvin/marvin/misc/build/buildGenerator.py | 28 +-
tools/marvin/marvin/misc/build/configure.py | 22 +-
tools/marvin/marvin/misc/build/restartMgmt.py | 2 +-
tools/marvin/marvin/misc/build/testSetupSuccess.py | 8 +-
tools/marvin/marvin/misc/build/xunitmp/setup.py | 2 +-
.../marvin/misc/build/xunitmp/xunitmultiprocess.py | 4 +-
tools/marvin/marvin/sandbox/__init__.py | 4 +-
tools/marvin/marvin/sandbox/advanced/__init__.py | 4 +-
.../marvin/marvin/sandbox/advanced/advanced_env.py | 14 +-
tools/marvin/marvin/sandbox/advancedsg/__init__.py | 4 +-
.../marvin/sandbox/advancedsg/advancedsg_env.py | 12 +-
tools/marvin/marvin/sandbox/basic/__init__.py | 4 +-
tools/marvin/marvin/sandbox/basic/basic_env.py | 14 +-
tools/marvin/marvin/sandbox/demo/__init__.py | 4 +-
tools/marvin/marvin/sandbox/demo/live/__init__.py | 4 +-
.../marvin/sandbox/demo/live/testSshDeployVM.py | 14 +-
.../marvin/sandbox/demo/simulator/__init__.py | 4 +-
.../sandbox/demo/simulator/simulator_setup.py | 14 +-
.../sandbox/demo/simulator/testcase/__init__.py | 4 +-
.../demo/simulator/testcase/libs/__init__.py | 4 +-
.../sandbox/demo/simulator/testcase/libs/base.py | 136 ++++----
.../sandbox/demo/simulator/testcase/libs/common.py | 38 +-
.../sandbox/demo/simulator/testcase/libs/utils.py | 8 +-
.../demo/simulator/testcase/test_vm_life_cycle.py | 82 ++---
tools/marvin/marvin/sandbox/testSetupSuccess.py | 12 +-
168 files changed, 1911 insertions(+), 1899 deletions(-)
diff --git a/tools/marvin/marvin/sandbox/__init__.py b/.github/linters/.flake8
similarity index 96%
copy from tools/marvin/marvin/sandbox/__init__.py
copy to .github/linters/.flake8
index 57823fc..c931492 100644
--- a/tools/marvin/marvin/sandbox/__init__.py
+++ b/.github/linters/.flake8
@@ -5,9 +5,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
@@ -15,4 +15,5 @@
# specific language governing permissions and limitations
# under the License.
-
+[flake8]
+select = W291
diff --git a/tools/marvin/marvin/sandbox/__init__.py b/.github/workflows/linter.yml
similarity index 72%
copy from tools/marvin/marvin/sandbox/__init__.py
copy to .github/workflows/linter.yml
index 57823fc..c38890d 100644
--- a/tools/marvin/marvin/sandbox/__init__.py
+++ b/.github/workflows/linter.yml
@@ -5,9 +5,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
@@ -15,4 +15,17 @@
# specific language governing permissions and limitations
# under the License.
+name: Lint Code Base
+on: [pull_request]
+
+jobs:
+ build:
+ name: GitHub Super Linter
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: github/super-linter@v4
+ env:
+ VALIDATE_PYTHON_FLAKE8: true
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/cloud-cli/cloudapis/__init__.py b/cloud-cli/cloudapis/__init__.py
index f23b2ce..00dcc6b 100644
--- a/cloud-cli/cloudapis/__init__.py
+++ b/cloud-cli/cloudapis/__init__.py
@@ -5,9 +5,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
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-
+
'''
Created on Aug 2, 2010
diff --git a/cloud-cli/cloudtool/__init__.py b/cloud-cli/cloudtool/__init__.py
index dd7c46c..c5785dc 100644
--- a/cloud-cli/cloudtool/__init__.py
+++ b/cloud-cli/cloudtool/__init__.py
@@ -5,9 +5,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
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-
+
'''
Created on Aug 2, 2010
@@ -26,16 +26,16 @@ import sys
import cloudapis as apis
import cloudtool.utils as utils
-
+
def main(argv=None):
-
+
#import ipdb; ipdb.set_trace()
if argv == None:
argv = sys.argv
prelim_args = [ x for x in argv[0:] if not x.startswith('-') ]
parser = utils.get_parser()
-
+
api = __import__("cloudapis")
apis = getattr(api, "implementor")
if len(prelim_args) == 1:
@@ -44,20 +44,20 @@ def main(argv=None):
command = utils.lookup_command_in_api(apis,prelim_args[1])
if not command: parser.error("command %r not supported by the %s API"%(prelim_args[1],prelim_args[0]))
-
- argv = argv[1:]
+
+ argv = argv[1:]
if len(argv) == 1:
argv.append("--help")
parser = utils.get_parser(apis.__init__,command)
opts,args,api_optionsdict,cmd_optionsdict = parser.parse_args(argv)
-
-
+
+
try:
api = apis(**api_optionsdict)
except utils.OptParseError as e:
parser.error(str(e))
-
+
command = utils.lookup_command_in_api(api,args[0])
# we now discard the first two arguments as those necessarily are the api and command names
diff --git a/cloud-cli/cloudtool/utils.py b/cloud-cli/cloudtool/utils.py
index 1f3d329..0fc21e1 100644
--- a/cloud-cli/cloudtool/utils.py
+++ b/cloud-cli/cloudtool/utils.py
@@ -5,9 +5,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
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-
+
'''
Created on Aug 2, 2010
@@ -48,28 +48,28 @@ class MyOptionParser(OptionParser):
error("%s: %s\n" % (self.get_prog_name(),msg))
self.print_usage(sys.stderr)
self.exit(os.EX_USAGE)
-
+
def parse_args(self,*args,**kwargs):
options,arguments = OptionParser.parse_args(self,*args,**kwargs)
-
+
def prune_options(options,alist):
"""Given 'options' -- a list of arguments to OptionParser.add_option,
and a set of optparse Values, return a dictionary of only those values
that apply exclusively to 'options'"""
return dict( [ (k,getattr(options,k)) for k in dir(options) if k in alist ] )
-
+
api_options = prune_options(options,self.api_dests)
cmd_options = prune_options(options,self.cmd_dests)
-
+
return options,arguments,api_options,cmd_options
def get_parser(api_callable=None,cmd_callable=None): # this should probably be the __init__ method of myoptionparser
-
+
def getdefaulttag(default):
if default is not None: return " [Default: %default]"
return ''
-
+
def get_arguments_and_options(callable):
"""Infers and returns arguments and options based on a callable's signature.
Cooperates with decorator @describe"""
@@ -96,18 +96,18 @@ def get_parser(api_callable=None,cmd_callable=None): # this should probably be t
return arguments,options
basic_usage = "usage: %prog [options...] "
-
+
api_name = "<api>"
cmd_name = "<command>"
description = "%prog is a command-line tool to access several cloud APIs."
arguments = ''
argexp = ""
-
+
if api_callable:
api_name = api_callable.__module__.split(".")[-1].replace("_","-")
api_arguments,api_options = get_arguments_and_options(api_callable)
assert len(api_arguments) is 0 # no mandatory arguments for class initializers
-
+
if cmd_callable:
cmd_name = cmd_callable.__name__.replace("_","-")
cmd_arguments,cmd_options = get_arguments_and_options(cmd_callable)
@@ -115,18 +115,18 @@ def get_parser(api_callable=None,cmd_callable=None): # this should probably be t
arguments = " " + " ".join( [ s[0].upper() for s in cmd_arguments ] )
argexp = "\n\nArguments:\n" + "\n".join ( " %s\n %s"%(s.upper(),u) for s,u in cmd_arguments )
description = cmd_callable.__doc__
-
+
api_command = "%s %s"%(api_name,cmd_name)
if description: description = "\n\n" + description
else: description = ''
-
+
usage = basic_usage + api_command + arguments + description + argexp
parser = MyOptionParser(usage=usage, add_help_option=False)
-
+
parser.add_option('--help', action="help")
-
+
group = parser.add_option_group("General options")
group.add_option('-v', '--verbose', dest="verbose", help="Print extra output")
@@ -136,14 +136,14 @@ def get_parser(api_callable=None,cmd_callable=None): # this should probably be t
for a in api_options:
group.add_option(a[0][0],**a[1])
parser.api_dests.append(a[1]["dest"])
-
+
parser.cmd_dests = []
if cmd_callable and cmd_options:
group = parser.add_option_group("Options for the %s command"%cmd_name)
for a in cmd_options:
group.add_option(a[0][0],**a[1])
parser.cmd_dests.append(a[1]["dest"])
-
+
return parser
def lookup_command_in_api(api,command_name):
@@ -155,7 +155,7 @@ def get_api_list(api):
for cmd_name in dir(api):
cmd = getattr(api,cmd_name)
if callable(cmd) and not cmd_name.startswith("_"):
- apilist.append(cmd_name)
+ apilist.append(cmd_name)
return apilist
def get_command_list(api):
diff --git a/plugins/hypervisors/baremetal/src/main/resources/security_group_agent/security_group_agent/cs_sg_agent.py b/plugins/hypervisors/baremetal/src/main/resources/security_group_agent/security_group_agent/cs_sg_agent.py
index 0c49a3f..6530799 100755
--- a/plugins/hypervisors/baremetal/src/main/resources/security_group_agent/security_group_agent/cs_sg_agent.py
+++ b/plugins/hypervisors/baremetal/src/main/resources/security_group_agent/security_group_agent/cs_sg_agent.py
@@ -1,21 +1,21 @@
-# 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.
-#
-# Automatically generated by addcopyright.py at 01/29/2013
+# 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.
+#
+# Automatically generated by addcopyright.py at 01/29/2013
'''
Created on Jan 2, 2013
@@ -42,14 +42,14 @@ class IPSet(object):
def __init__(self, setname, ips):
self.ips = ips
self.name = setname
-
+
def create(self):
tmpname = str(uuid.uuid4()).replace('-', '')[0:30]
sglib.ShellCmd('ipset -N %s %s' % (tmpname, self.IPSET_TYPE))()
try:
for ip in self.ips:
sglib.ShellCmd('ipset -A %s %s' % (tmpname, ip))()
-
+
try:
sglib.ShellCmd('ipset -N %s %s' % (self.name, self.IPSET_TYPE))()
cherrypy.log('created new ipset: %s' % self.name)
@@ -59,8 +59,8 @@ class IPSet(object):
sglib.ShellCmd('ipset -W %s %s' % (tmpname, self.name))()
sglib.ShellCmd('ipset -F %s' % tmpname)()
sglib.ShellCmd('ipset -X %s' % tmpname)()
-
- @staticmethod
+
+ @staticmethod
def destroy_sets(sets_to_keep):
sets = sglib.ShellCmd('ipset list')()
for s in sets.split('\n'):
@@ -69,17 +69,17 @@ class IPSet(object):
if not set_name in sets_to_keep:
sglib.ShellCmd('ipset destroy %s' % set_name)()
cherrypy.log('destroyed unused ipset: %s' % set_name)
-
+
class SGAgent(object):
def __init__(self):
pass
-
+
def _self_list(self, obj):
if isinstance(obj, types.ListType):
return obj
else:
return [obj]
-
+
def set_rules(self, req):
body = req.body
doc = xmlobject.loads(body)
@@ -89,7 +89,7 @@ class SGAgent(object):
vm_mac = doc.vmMac.text_
sig = doc.signature.text_
seq = doc.sequenceNumber.text_
-
+
def parse_rules(rules, lst):
for i in self._self_list(rules):
r = SGRule()
@@ -100,21 +100,21 @@ class SGAgent(object):
for ip in self._self_list(i.ip):
r.allowed_ips.append(ip.text_)
lst.append(r)
-
+
i_rules = []
if hasattr(doc, 'ingressRules'):
parse_rules(doc.ingressRules, i_rules)
-
+
e_rules = []
if hasattr(doc, 'egressRules'):
parse_rules(doc.egressRules, e_rules)
-
+
def create_chain(name):
try:
sglib.ShellCmd('iptables -F %s' % name)()
except Exception:
sglib.ShellCmd('iptables -N %s' % name)()
-
+
def apply_rules(rules, chainname, direction, action, current_set_names):
create_chain(chainname)
for r in i_rules:
@@ -122,13 +122,13 @@ class SGAgent(object):
if '0.0.0.0/0' in r.allowed_ips:
allow_any = True
r.allowed_ips.remove('0.0.0.0/0')
-
+
if r.allowed_ips:
setname = '_'.join([chainname, r.protocol, r.start_port, r.end_port])
ipset = IPSet(setname, r.allowed_ips)
ipset.create()
current_set_names.append(setname)
-
+
if r.protocol == 'all':
cmd = ['iptables -I', chainname, '-m state --state NEW -m set --set', setname, direction, '-j', action]
sglib.ShellCmd(' '.join(cmd))()
@@ -142,8 +142,8 @@ class SGAgent(object):
port_range = "any"
cmd = ['iptables', '-I', i_chain_name, '-p', 'icmp', '--icmp-type', port_range, '-m set --set', setname, direction, '-j', action]
sglib.ShellCmd(' '.join(cmd))()
-
-
+
+
if allow_any and r.protocol != 'all':
if r.protocol != 'icmp':
port_range = ":".join([r.start_port, r.end_port])
@@ -155,36 +155,36 @@ class SGAgent(object):
port_range = "any"
cmd = ['iptables', '-I', i_chain_name, '-p', 'icmp', '--icmp-type', port_range, '-j', action]
sglib.ShellCmd(' '.join(cmd))()
-
+
current_sets = []
i_chain_name = vm_name + '-in'
apply_rules(i_rules, i_chain_name, 'src', 'ACCEPT', current_sets)
e_chain_name = vm_name + '-eg'
apply_rules(e_rules, e_chain_name, 'dst', 'RETURN', current_sets)
-
+
if e_rules:
sglib.ShellCmd('iptables -A %s -j RETURN' % e_chain_name)
else:
sglib.ShellCmd('iptables -A %s -j DROP' % e_chain_name)
-
+
sglib.ShellCmd('iptables -A %s -j DROP' % i_chain_name)
IPSet.destroy_sets(current_sets)
-
-
+
+
def echo(self, req):
cherrypy.log("echo: I am alive")
-
+
def index(self):
req = sglib.Request.from_cherrypy_request(cherrypy.request)
cmd_name = req.headers['command']
-
+
if not hasattr(self, cmd_name):
- raise ValueError("SecurityGroupAgent doesn't have a method called '%s'" % cmd_name)
+ raise ValueError("SecurityGroupAgent doesn't have a method called '%s'" % cmd_name)
method = getattr(self, cmd_name)
-
+
return method(req)
index.exposed = True
-
+
@staticmethod
def start():
cherrypy.log.access_file = '/var/log/cs-securitygroup.log'
@@ -192,8 +192,8 @@ class SGAgent(object):
cherrypy.server.socket_host = '0.0.0.0'
cherrypy.server.socket_port = 9988
cherrypy.quickstart(SGAgent())
-
- @staticmethod
+
+ @staticmethod
def stop():
cherrypy.engine.exit()
@@ -204,16 +204,16 @@ class SGAgentDaemon(sglib.Daemon):
self.is_stopped = False
self.agent = SGAgent()
sglib.Daemon.register_atexit_hook(self._do_stop)
-
+
def _do_stop(self):
if self.is_stopped:
return
self.is_stopped = True
self.agent.stop()
-
+
def run(self):
self.agent.start()
-
+
def stop(self):
self.agent.stop()
super(SGAgentDaemon, self).stop()
@@ -223,7 +223,7 @@ def main():
if len(sys.argv) != 2 or not sys.argv[1] in ['start', 'stop', 'restart']:
print usage
sys.exit(1)
-
+
cmd = sys.argv[1]
agentdaemon = SGAgentDaemon()
if cmd == 'start':
@@ -232,5 +232,5 @@ def main():
agentdaemon.stop()
else:
agentdaemon.restart()
-
+
sys.exit(0)
diff --git a/plugins/hypervisors/baremetal/src/main/resources/security_group_agent/security_group_agent/sglib.py b/plugins/hypervisors/baremetal/src/main/resources/security_group_agent/security_group_agent/sglib.py
index bc675b5..c1ee889 100755
--- a/plugins/hypervisors/baremetal/src/main/resources/security_group_agent/security_group_agent/sglib.py
+++ b/plugins/hypervisors/baremetal/src/main/resources/security_group_agent/security_group_agent/sglib.py
@@ -18,10 +18,10 @@
#
# Automatically generated by addcopyright.py at 01/29/2013
-import sys, os, time, atexit
-import traceback
+import sys, os, time, atexit
+import traceback
import subprocess
-from signal import SIGTERM
+from signal import SIGTERM
import cherrypy
import copy
@@ -80,28 +80,28 @@ class Daemon(object):
A generic daemon class.
Usage: subclass the Daemon class and override the run() method
- """
- atexit_hooks = []
+ """
+ atexit_hooks = []
def __init__(self, pidfile, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'):
self.stdin = stdin
self.stdout = stdout
self.stderr = stderr
self.pidfile = pidfile
-
- @staticmethod
- def register_atexit_hook(hook):
- Daemon.atexit_hooks.append(hook)
-
+
+ @staticmethod
+ def register_atexit_hook(hook):
+ Daemon.atexit_hooks.append(hook)
+
@staticmethod
- def _atexit():
- for hook in Daemon.atexit_hooks:
- try:
+ def _atexit():
+ for hook in Daemon.atexit_hooks:
+ try:
hook()
- except Exception:
+ except Exception:
content = traceback.format_exc()
- err = 'Exception when calling atexit hook[%s]\n%s' % (hook.__name__, content)
- #logger.error(err)
+ err = 'Exception when calling atexit hook[%s]\n%s' % (hook.__name__, content)
+ #logger.error(err)
def daemonize(self):
"""
@@ -145,7 +145,7 @@ class Daemon(object):
# write pidfile
Daemon.register_atexit_hook(self.delpid)
- atexit.register(Daemon._atexit)
+ atexit.register(Daemon._atexit)
pid = str(os.getpid())
file(self.pidfile,'w').write("%s\n" % pid)
@@ -173,12 +173,12 @@ class Daemon(object):
sys.exit(0)
# Start the daemon
- self.daemonize()
+ self.daemonize()
try:
- self.run()
- except Exception:
- content = traceback.format_exc()
- #logger.error(content)
+ self.run()
+ except Exception:
+ content = traceback.format_exc()
+ #logger.error(content)
sys.exit(1)
def stop(self):
diff --git a/plugins/hypervisors/baremetal/src/main/resources/security_group_agent/security_group_agent/xmlobject.py b/plugins/hypervisors/baremetal/src/main/resources/security_group_agent/security_group_agent/xmlobject.py
index 1753499..d37fd4b 100755
--- a/plugins/hypervisors/baremetal/src/main/resources/security_group_agent/security_group_agent/xmlobject.py
+++ b/plugins/hypervisors/baremetal/src/main/resources/security_group_agent/security_group_agent/xmlobject.py
@@ -1,21 +1,21 @@
-# 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.
-#
-# Automatically generated by addcopyright.py at 01/29/2013
+# 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.
+#
+# Automatically generated by addcopyright.py at 01/29/2013
'''
Created on Dec 25, 2012
@@ -28,23 +28,23 @@ import types
class XmlObject(object):
def __init__(self, tag):
self.__tag_name__ = tag
-
+
def put_attr(self, name, val):
val = val.strip().strip('\t')
setattr(self, name + '_', val)
-
+
def put_text(self, val):
val = val.strip().strip('\n').strip('\t')
if val == "":
setattr(self, 'text_', None)
else:
setattr(self, 'text_', val)
-
+
def put_node(self, name, val):
if not hasattr(self, name):
setattr(self, name, val)
return
-
+
nodes = getattr(self, name)
if not isinstance(nodes, types.ListType):
nodes = []
@@ -55,7 +55,7 @@ class XmlObject(object):
else:
nodes.append(val)
setattr(self, name, nodes)
-
+
def get(self, name, default=None):
if hasattr(self, name):
val = getattr(self, name)
@@ -65,7 +65,7 @@ class XmlObject(object):
return val.text_
else:
return default
-
+
def __getattr__(self, name):
if name.endswith('__'):
n = name[:-1]
@@ -78,7 +78,7 @@ class XmlObject(object):
setattr(e, 'missing_attrib', name)
setattr(e, 'tag_name', self.__tag_name__)
raise e
-
+
def _loads(node):
xo = XmlObject(node.tag)
@@ -90,7 +90,7 @@ def _loads(node):
sub_xo = _loads(n)
xo.put_node(n.tag, sub_xo)
return xo
-
+
def loads(xmlstr):
xmlstr = re.sub(r'xmlns=".*"', '', xmlstr)
root = etree.fromstring(xmlstr)
diff --git a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/ConfigFileOps.py b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/ConfigFileOps.py
index 62d09fc..a574ada 100755
--- a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/ConfigFileOps.py
+++ b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/ConfigFileOps.py
@@ -5,9 +5,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
@@ -24,7 +24,7 @@ class ConfigFileOps:
self.op = op
self.separator = separator
def setState(self, state):
- self.state = state
+ self.state = state
def getState(self):
return self.state
@@ -32,18 +32,18 @@ class ConfigFileOps:
self.fileName = fileName
self.entries = []
self.backups = []
-
+
if cfg is not None:
cfg.cfoHandlers.append(self)
def addEntry(self, name, value, separator="="):
e = self.entry(name, value, "add", separator)
self.entries.append(e)
-
+
def rmEntry(self, name, value, separator="="):
entry = self.entry(name, value, "rm", separator)
self.entries.append(entry)
-
+
def getEntry(self, name, separator="="):
try:
ctx = file(self.fileName).read(-1)
@@ -71,7 +71,7 @@ class ConfigFileOps:
matchString = "^\ *" + entry.name + "\ *=\ *" + entry.value
else:
matchString = "^\ *" + entry.name + "\ *" + entry.value
-
+
match = re.match(matchString, line)
if match is not None:
if entry.op == "add" and entry.separator == "=":
@@ -85,9 +85,9 @@ class ConfigFileOps:
entry.setState("set")
self.backups.append([line, None])
matched = True
- break
-
- if not matched:
+ break
+
+ if not matched:
newLines.append(line)
for entry in self.entries:
@@ -99,7 +99,7 @@ class ConfigFileOps:
entry.setState("set")
fp.close()
-
+
file(self.fileName, "w").writelines(newLines)
def replace_line(self, startswith,stanza,always_add=False):
@@ -123,18 +123,18 @@ class ConfigFileOps:
return self.replace_line(startswith,stanza,always_add=True)
def add_lines(self, lines, addToBackup=True):
- fp = file(self.fileName).read(-1)
+ fp = file(self.fileName).read(-1)
sh = re.escape(lines)
- match = re.search(sh, fp, re.MULTILINE)
+ match = re.search(sh, fp, re.MULTILINE)
if match is not None:
return
-
+
fp += lines
file(self.fileName, "w").write(fp)
self.backups.append([None, lines])
-
+
def replace_lines(self, src, dst, addToBackup=True):
- fp = file(self.fileName).read(-1)
+ fp = file(self.fileName).read(-1)
sh = re.escape(src)
if dst is None:
dst = ""
@@ -165,11 +165,11 @@ class ConfigFileOps:
newlines.append(line)
file(self.fileName, "w").writelines(newlines)
-
+
def backup(self):
for oldLine, newLine in self.backups:
if newLine is None:
self.add_lines(oldLine, False)
else:
self.replace_lines(newLine, oldLine, False)
-
+
diff --git a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmCommonModule.py b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmCommonModule.py
index 332539d..21532d6 100755
--- a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmCommonModule.py
+++ b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmCommonModule.py
@@ -5,9 +5,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
@@ -23,7 +23,7 @@ try:
import json
except ImportError:
import simplejson as json
-
+
from OvmObjectModule import *
import types
import logging
@@ -55,7 +55,7 @@ def setAttrFromDict(obj, name, refDict, convertFunc=None):
def safeSetAttr(obj, name, value):
if not hasattr(obj, name): raise Exception("%s doesn't have attribute %s"%(obj.__class__.__name__, name))
setattr(obj, name, value)
-
+
def toAscii(jstr):
return str(jstr).encode('ascii', 'ignore')
@@ -68,7 +68,7 @@ def toAsciiHook(dct):
k = toAscii(k)
dct[k] = v
return dct
-
+
def asciiLoads(jStr):
jStr = str(jStr).replace("'", '"').replace('False', 'false').replace('True', 'true')
return json.loads(jStr, object_hook=toAsciiHook)
@@ -90,7 +90,7 @@ def jsonSuccessToMap(str):
dct = json.loads(str)
if dct['status'] != 'SUCC': raise Exception(str)
return dct['value']
-
+
def safeDictSet(obj, dct, name):
if not hasattr(obj, name): raise Exception("%s has no attribute %s for encoding"%(obj.__class__.__name__, name))
dct[name] = getattr(obj, name)
@@ -133,7 +133,7 @@ def execute(cmd):
def getDomId(vm_name):
return execute("xm list | grep " + vm_name + " | awk '{print $2}'").strip()
-
+
def raiseExceptionIfFail(res):
if not "success" in res and not "SUCC" in res: raise Exception(res)
@@ -156,4 +156,4 @@ def makeOwnerFileName():
hostIp = successToMap(get_master_ip())['ip']
ownerFileName = OWNER_FILE_PREFIX + hostIp.replace('.', '_')
return ownerFileName
-
+
diff --git a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmDiskModule.py b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmDiskModule.py
index c7bac21..7711dc9 100755
--- a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmDiskModule.py
+++ b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmDiskModule.py
@@ -5,9 +5,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
@@ -36,7 +36,7 @@ class OvmDiskEncoder(json.JSONEncoder):
dct = {}
safeDictSet(obj, dct, 'path')
safeDictSet(obj, dct, 'type')
- return dct
+ return dct
def fromOvmDisk(disk):
return normalizeToGson(json.dumps(disk, cls=OvmDiskEncoder))
@@ -58,8 +58,8 @@ class OvmDisk(OvmObject):
path = ''
type = ''
isIso = False
-
-
+
+
if __name__ == "__main__":
print toOvmDisk('''{"type":"w","path":"/data/data.raw"}''')
print toOvmDisk('''{"path":"/data/data.raw'","type":"w"}''')
\ No newline at end of file
diff --git a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmDispatcher.py b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmDispatcher.py
index 78d1fae..d5c4f98 100755
--- a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmDispatcher.py
+++ b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmDispatcher.py
@@ -5,9 +5,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
diff --git a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmFaultConstants.py b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmFaultConstants.py
index 25b8e5a..9599586 100755
--- a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmFaultConstants.py
+++ b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmFaultConstants.py
@@ -5,9 +5,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
@@ -28,7 +28,7 @@ class NoVmFoundException(Exception):
class ShellExceutedFailedException(Exception):
stderr = ''
errCode = -1000
-
+
def __init__(self, err, code):
Exception.__init__(self, "%s, return code:%s"%(err, code))
self.stderr = err
@@ -40,7 +40,7 @@ errCode = {
"OvmDispatch.InvaildClass":OvmDispatcherStub+2,
"OvmDispatch.InvaildFunction":OvmDispatcherStub+3,
"OvmVm.reboot":OvmDispatcherStub+4,
-
+
"OvmHost.registerAsPrimary":OvmHostErrCodeStub+1,
"OvmHost.registerAsVmServer":OvmHostErrCodeStub+2,
"OvmHost.ping":OvmHostErrCodeStub+3,
@@ -50,7 +50,7 @@ errCode = {
"OvmHost.fence":OvmHostErrCodeStub+7,
"OvmHost.setupHeartBeat":OvmHostErrCodeStub+8,
"OvmHost.pingAnotherHost":OvmHostErrCodeStub+9,
-
+
"OvmVm.create":OvmVmErrCodeStub+1,
"OvmVm.stop":OvmVmErrCodeStub+2,
"OvmVm.getDetails":OvmVmErrCodeStub+3,
@@ -59,7 +59,7 @@ errCode = {
"OvmVm.register":OvmVmErrCodeStub+6,
"OvmVm.getVncPort":OvmVmErrCodeStub+7,
"OvmVm.detachOrAttachIso":OvmVmErrCodeStub+8,
-
+
"OvmStoragePool.create":OvmStoragePoolErrCodeStub+1,
"OvmStoragePool.getDetailsByUuid":OvmStoragePoolErrCodeStub+2,
"OvmStoragePool.downloadTemplate":OvmStoragePoolErrCodeStub+3,
@@ -68,7 +68,7 @@ errCode = {
"OvmStoragePool._umount":OvmStoragePoolErrCodeStub+6,
"OvmStoragePool.copyVolume":OvmStoragePoolErrCodeStub+7,
"OvmStoragePool.delete":OvmStoragePoolErrCodeStub+8,
-
+
"OvmNetwork.createBridge":OvmNetworkErrCodeStub+1,
"OvmNetwork.deleteBridge":OvmNetworkErrCodeStub+2,
"OvmNetwork.createVlan":OvmNetworkErrCodeStub+3,
@@ -77,11 +77,11 @@ errCode = {
"OvmNetwork.getBridgeByIp":OvmNetworkErrCodeStub+6,
"OvmNetwork.createVlanBridge":OvmNetworkErrCodeStub+7,
"OvmNetwork.deleteVlanBridge":OvmNetworkErrCodeStub+8,
-
+
"OvmVolume.createDataDisk":OvmVolumeErrCodeStub+1,
"OvmVolume.createFromTemplate":OvmVolumeErrCodeStub+2,
"OvmVolume.destroy":OvmVolumeErrCodeStub+3,
-
+
"OvmOCFS2._addNode":OvmOCFS2ErrCodeStub+1,
}
diff --git a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmHaHeartBeatModule.py b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmHaHeartBeatModule.py
index 299b0c9..ec57f0c 100755
--- a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmHaHeartBeatModule.py
+++ b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmHaHeartBeatModule.py
@@ -5,9 +5,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
@@ -34,7 +34,7 @@ class OvmHaHeartBeat(object):
def __init__(self, mountPoint, ip):
self.mountPoint = mountPoint
self.ip = ip
-
+
def mark(self, file):
timestamp = HEARTBEAT_TIMESTAMP_FORMAT % time.time()
try:
@@ -44,7 +44,7 @@ class OvmHaHeartBeat(object):
except Exception, e:
errmsg = fmt_err_msg(e)
logger.error(OvmHaHeartBeat.mark, errmsg)
-
+
def run(self):
'''
Constructor
@@ -56,11 +56,11 @@ class OvmHaHeartBeat(object):
while True:
self.mark(hearBeatFile)
time.sleep(120)
-
+
@staticmethod
def start(poolPath, ip):
pidFile = join(PID_DIR, "heartbeat.pid")
-
+
def isLive():
if exists(pidFile):
f = open(pidFile)
@@ -69,7 +69,7 @@ class OvmHaHeartBeat(object):
if isdir("/proc/%s" % pid):
return long(pid)
return None
-
+
def stopOldHeartBeat(pid):
os.kill(pid, signal.SIGTERM)
time.sleep(5)
@@ -81,10 +81,10 @@ class OvmHaHeartBeat(object):
pid = isLive()
if pid != None:
raise Exception("Cannot stop old heartbeat process %s, setup heart beat failed"%pid)
-
+
def heartBeat(hb):
hb.run()
-
+
def setupHeartBeat():
hb = OvmHaHeartBeat(poolPath, ip)
p = Process(target=heartBeat, args=(hb,))
@@ -96,10 +96,10 @@ class OvmHaHeartBeat(object):
pidFd.write(str(pid))
pidFd.close()
logger.info(OvmHaHeartBeat.start, "Set up heart beat successfully, pid is %s" % pid)
-
+
pid = isLive()
if pid != None:
stopOldHeartBeat(pid)
-
+
setupHeartBeat()
-
+
diff --git a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmHostModule.py b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmHostModule.py
index de50e8b..90deb09 100755
--- a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmHostModule.py
+++ b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmHostModule.py
@@ -5,9 +5,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
@@ -44,11 +44,11 @@ class OvmHostEncoder(json.JSONEncoder):
safeDictSet(obj, dct, 'dom0KernelVersion')
safeDictSet(obj, dct, 'hypervisorVersion')
return dct
-
+
def fromOvmHost(host):
return normalizeToGson(json.dumps(host, cls=OvmHostEncoder))
-
+
class OvmHost(OvmObject):
masterIp = ''
cpuNum = 0
@@ -64,7 +64,7 @@ class OvmHost(OvmObject):
def _getVmPathFromPrimaryStorage(self, vmName):
'''
we don't have a database to store vm states, so there is no way to retrieve information of a vm
- when it was already stopped. The trick is to try to find the vm path in primary storage then we
+ when it was already stopped. The trick is to try to find the vm path in primary storage then we
can read information from its configure file.
'''
mps = OvmStoragePool()._getAllMountPoints()
@@ -76,18 +76,18 @@ class OvmHost(OvmObject):
logger.error(self._getVmPathFromPrimaryStorage, "Cannot find link for %s in any primary storage, the vm was really gone!"%vmName)
raise Exception("Cannot find link for %s in any primary storage, the vm was really gone!"%vmName)
return vmPath
-
+
def _vmNameToPath(self, vmName):
# the xen_get_vm_path always sucks!!!
#return successToMap((vmName))['path']
return self._getVmPathFromPrimaryStorage(vmName)
-
+
def _getAllDomains(self):
stdout = timeout_command(["xm", "list"])
l = [ line.split()[:2] for line in stdout.splitlines() ]
l = [ (name, id) for (name, id) in l if name not in ("Name", "Domain-0") ]
return l
-
+
def _getDomainIdByName(self, vmName):
l = self._getAllDomains()
for name, id in l:
@@ -108,7 +108,7 @@ class OvmHost(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmHost.registerAsPrimary, errmsg)
raise XmlRpcFault(toErrCode(OvmHost, OvmHost.registerAsPrimary), errmsg)
-
+
@staticmethod
def registerAsVmServer(hostname, username="oracle", password="password", port=8899, isSsl=False):
try:
@@ -121,7 +121,7 @@ class OvmHost(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmHost.registerAsVmServer, errmsg)
raise XmlRpcFault(toErrCode(OvmHost, OvmHost.registerAsVmServer), errmsg)
-
+
@staticmethod
def ping(hostname):
try:
@@ -133,7 +133,7 @@ class OvmHost(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmHost.ping, errmsg)
raise XmlRpcFault(toErrCode(OvmHost, OvmHost.ping, errmsg))
-
+
@staticmethod
def getDetails():
try:
@@ -166,7 +166,7 @@ class OvmHost(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmHost.getDetails, errmsg)
raise XmlRpcFault(toErrCode(OvmHost, OvmHost.getDetails), errmsg)
-
+
@staticmethod
def getPerformanceStats(bridgeName):
try:
@@ -188,20 +188,20 @@ class OvmHost(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmHost.getPerformanceStats, errmsg)
raise XmlRpcFault(toErrCode(OvmHost, OvmHost.getPerformanceStats), errmsg)
-
+
@staticmethod
def getAllVms():
def scanStoppedVmOnPrimaryStorage(vms):
def isMyVmDirLink(path):
return (islink(path) and exists(join(path, 'vm.cfg')) and ('-' in basename(path)) and (exists(join(path, makeOwnerFileName()))))
-
+
mps = OvmStoragePool()._getAllMountPoints()
for mountPoint in mps:
runningPool = join(mountPoint, 'running_pool')
if not exists(runningPool):
logger.debug(OvmHost.getAllVms, "Primary storage %s not existing, skip it. this should be first getAllVms() called from Ovm resource configure"%runningPool)
continue
-
+
for dir in os.listdir(runningPool):
vmDir = join(runningPool, dir)
if not isMyVmDirLink(vmDir):
@@ -210,11 +210,11 @@ class OvmHost(OvmObject):
if vms.has_key(dir):
logger.debug(OvmHost.getAllVms, "%s is already in running list, skip it"%dir)
continue
-
+
logger.debug(OvmHost.getAllVms, "Found a stopped vm %s on primary storage %s, report it to management server" % (dir, mountPoint))
vms[dir] = "DOWN"
-
-
+
+
try:
l = OvmHost()._getAllDomains()
dct = {}
@@ -227,7 +227,7 @@ class OvmHost(OvmObject):
except Exception, e:
logger.debug(OvmHost.getAllVms, "Cannot find link for %s on primary storage, treat it as Error"%name)
dct[name] = 'ERROR'
-
+
scanStoppedVmOnPrimaryStorage(dct)
rs = toGson(dct)
logger.info(OvmHost.getAllVms, rs)
@@ -236,13 +236,13 @@ class OvmHost(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmHost.getAllVms, errmsg)
raise XmlRpcFault(toErrCode(OvmHost, OvmHost.getAllVms), errmsg)
-
+
@staticmethod
def fence(ip):
# try 3 times to avoid race condition that read when heartbeat file is being written
def getTimeStamp(hbFile):
for i in range(1, 3):
- f = open(hbFile, 'r')
+ f = open(hbFile, 'r')
str = f.readline()
items = re.findall(HEARTBEAT_TIMESTAMP_PATTERN, str)
if len(items) == 0:
@@ -253,7 +253,7 @@ class OvmHost(OvmObject):
f.close()
timestamp = items[0]
return timestamp.lstrip('<timestamp>').rstrip('</timestamp>')
-
+
# totally check in 6 mins, the update frequency is 2 mins
def check(hbFile):
for i in range(1, 6):
@@ -263,7 +263,7 @@ class OvmHost(OvmObject):
if ts != nts: return True
else: logger.debug(OvmHost.fence, '%s is not updated, old value=%s, will retry %s times'%(hbFile, ts, 6-i))
return False
-
+
try:
mountpoints = OvmStoragePool()._getAllMountPoints()
hbFile = None
@@ -272,7 +272,7 @@ class OvmHost(OvmObject):
if exists(p):
hbFile = p
break
-
+
if not hbFile: raise Exception('Can not find heartbeat file for %s in pools %s'%(ip, mountpoints))
rs = toGson({"isLive":check(hbFile)})
logger.debug(OvmHost.fence, rs)
@@ -281,7 +281,7 @@ class OvmHost(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmHost.fence, errmsg)
raise XmlRpcFault(toErrCode(OvmHost, OvmHost.fence), errmsg)
-
+
@staticmethod
def setupHeartBeat(poolUuid, ip):
try:
@@ -292,7 +292,7 @@ class OvmHost(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmHost.setupHeartBeat, errmsg)
raise XmlRpcFault(toErrCode(OvmHost, OvmHost.setupHeartBeat), errmsg)
-
+
@staticmethod
def pingAnotherHost(ip):
try:
@@ -302,6 +302,6 @@ class OvmHost(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmHost.pingAnotherHost, errmsg)
raise XmlRpcFault(toErrCode(OvmHost, OvmHost.pingAnotherHost), errmsg)
-
+
if __name__ == "__main__":
print OvmHost.getAllVms()
\ No newline at end of file
diff --git a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmLoggerModule.py b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmLoggerModule.py
index 5d9e526..a59ad5d 100755
--- a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmLoggerModule.py
+++ b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmLoggerModule.py
@@ -5,9 +5,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
@@ -32,22 +32,22 @@ class OvmLogger(object):
'''
self.className = className
self.logger = logging.getLogger(className)
-
+
def info(self, func, msg=None):
assert callable(func), "%s is not a function"%func
fmt = "[%s.%s]: "%(self.className, func.__name__)
self.logger.info("%s%s"%(fmt,msg))
-
+
def debug(self, func, msg=None):
assert callable(func), "%s is not a function"%func
fmt = "[%s.%s]: "%(self.className, func.__name__)
self.logger.debug("%s%s"%(fmt,msg))
-
+
def error(self, func, msg=None):
assert callable(func), "%s is not a function"%func
fmt = "[%s.%s]: "%(self.className, func.__name__)
self.logger.error("%s%s"%(fmt,msg))
-
+
def warning(self, func, msg=None):
assert callable(func), "%s is not a function"%func
fmt = "[%s.%s]: "%(self.className, func.__name__)
diff --git a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmNetworkModule.py b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmNetworkModule.py
index c640071..edb65bb 100755
--- a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmNetworkModule.py
+++ b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmNetworkModule.py
@@ -5,9 +5,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 @@ from OvmCommonModule import *
import traceback
import time
import re
-
+
logger = OvmLogger("OvmNetwork")
class Filter:
@@ -32,7 +32,7 @@ class Filter:
class Parser(object):
'''
classdocs
- '''
+ '''
def findall(self, pattern, samples):
"""
@param pattern: search pattern
@@ -47,7 +47,7 @@ class Parser(object):
for item in items:
result.append(item)
return result
-
+
def checkPattern(self, pattern, cmd_result):
"""
@param pattern: search pattern
@@ -59,10 +59,10 @@ class Parser(object):
if len(items) > 0:
return True
return False
-
+
def search(self, cmd_result, pattern):
return None
-
+
class OvmVlanDecoder(json.JSONDecoder):
def decode(self, jStr):
deDict = asciiLoads(jStr)
@@ -79,7 +79,7 @@ class OvmVlanEncoder(json.JSONEncoder):
safeDictSet(obj, dct, 'vid')
safeDictSet(obj, dct, 'pif')
return dct
-
+
def toOvmVlan(jStr):
return json.loads(jStr, cls=OvmVlanDecoder)
@@ -102,7 +102,7 @@ class OvmBridgeEncoder(json.JSONEncoder):
safeDictSet(obj, dct, 'attach')
safeDictSet(obj, dct, 'interfaces')
return dct
-
+
def toOvmBridge(jStr):
return json.loads(jStr, cls=OvmBridgeDecoder)
@@ -120,7 +120,7 @@ class OvmBridge(OvmInterface):
attach = ''
interfaces = []
-
+
class OvmNetwork(OvmObject):
'''
Network
@@ -137,7 +137,7 @@ class OvmNetwork(OvmObject):
@property
def bridges(self):
return self._getInterfaces("bridge")
-
+
def __init__(self):
self.Parser = Parser()
@@ -146,51 +146,51 @@ class OvmNetwork(OvmObject):
@param jsonString : parameter from client side
@return : succ xxxxx
ex. jsonString => {vid:100, pif:eth0}
- ex. return =>
+ ex. return =>
"""
-
+
#Pre-condition
#check Physical Interface Name
- if vlan.pif not in self.pifs.keys():
+ if vlan.pif not in self.pifs.keys():
msg = "Physical Interface(%s) does not exist" % vlan.pif
logger.debug(self._createVlan, msg)
raise Exception(msg)
- #Pre-condition
+ #Pre-condition
#check Vlan Interface Name
ifName = "%s.%s" % (vlan.pif, vlan.vid)
if ifName in self.vlans.keys():
msg = "Vlan Interface(%s) already exist, return it" % ifName
logger.debug(self._createVlan, msg)
return self.vlans[ifName]
-
+
doCmd(['vconfig', 'add', vlan.pif, vlan.vid])
self.bringUP(ifName)
logger.debug(self._createVlan, "Create vlan %s successfully"%ifName)
return self.vlans[ifName]
-
+
def _deleteVlan(self, name):
if name not in self.vlans.keys():
raise Exception("No vlan device %s found"%name)
-
+
vlan = self.vlans[name]
self.bringDown(vlan.name)
doCmd(['vconfig', 'rem', vlan.name])
logger.debug(self._deleteVlan, "Delete vlan %s successfully"%vlan.name)
-
-
+
+
def _createBridge(self, bridge):
"""
@return : success
ex. {bridge:xapi100, attach:eth0.100}
- create bridge interface, and attached it
+ create bridge interface, and attached it
cmd 1: ip link add bridge
cmd 2: ip link set dev
"""
-
+
if "xenbr" not in bridge.name and "vlan" not in bridge.name:
raise Exception("Invalid bridge name %s. Bridge name must be in partten xenbr/vlan, e.g. xenbr0"%bridge.name)
-
+
#pre-condition
#check Bridge Interface Name
if bridge.name in self.bridges.keys():
@@ -200,7 +200,7 @@ class OvmNetwork(OvmObject):
#pre-condition
#check attach must exist
- #possible to attach in PIF or VLAN
+ #possible to attach in PIF or VLAN
if bridge.attach not in self.vlans.keys() and bridge.attach not in self.pifs.keys():
msg = "%s is not either pif or vlan" % bridge.attach
logger.error(self._createBridge, msg)
@@ -211,17 +211,17 @@ class OvmNetwork(OvmObject):
self.bringUP(bridge.name)
logger.debug(self._createBridge, "Create bridge %s on %s successfully"%(bridge.name, bridge.attach))
return self.bridges[bridge.name]
-
+
def _getBridges(self):
return self.bridges.keys()
-
+
def _getVlans(self):
return self.vlans.keys()
-
+
def _deleteBridge(self, name):
if name not in self.bridges.keys():
raise Exception("Can not find bridge %s"%name)
-
+
bridge = self.bridges[name]
if bridge.attach in bridge.interfaces: bridge.interfaces.remove(bridge.attach)
if len(bridge.interfaces) != 0:
@@ -231,7 +231,7 @@ class OvmNetwork(OvmObject):
doCmd(['ip', 'link', 'del', bridge.name])
logger.debug(self._deleteBridge, "Delete bridge %s successfully"%bridge.name)
return True
-
+
def _getInterfaces(self, type):
"""
@param type : ["pif", "bridge", "tap"]
@@ -246,7 +246,7 @@ class OvmNetwork(OvmObject):
ifInst = OvmInterface()
ifInst.name = dev
ifs[dev] = ifInst
-
+
elif type == "vlan":
devs = self.Parser.findall(Filter.Network.IFNAME_VLAN, devices)
for dev in set(devs):
@@ -256,7 +256,7 @@ class OvmNetwork(OvmObject):
ifInst.pif = pif
ifInst.vid = vid
ifs[dev] = ifInst
-
+
elif type == "bridge":
devs = self.Parser.findall(Filter.Network.IFNAME_BRIDGE, devices)
for dev in set(devs):
@@ -271,13 +271,13 @@ class OvmNetwork(OvmObject):
ifs[dev] = ifInst
return ifs
-
+
def bringUP(self, ifName):
doCmd(['ifconfig', ifName, 'up'])
-
+
def bringDown(self, ifName):
doCmd(['ifconfig', ifName, 'down'])
-
+
@staticmethod
def createBridge(jStr):
try:
@@ -288,7 +288,7 @@ class OvmNetwork(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmNetwork.createBridge, errmsg)
raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.createBridge), errmsg)
-
+
@staticmethod
def deleteBridge(name):
try:
@@ -299,7 +299,7 @@ class OvmNetwork(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmNetwork.deleteBridge, errmsg)
raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.deleteBridge), errmsg)
-
+
@staticmethod
def getAllBridges():
try:
@@ -311,7 +311,7 @@ class OvmNetwork(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmNetwork.getAllBridges, errmsg)
raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.getAllBridges), errmsg)
-
+
@staticmethod
def getBridgeByIp(ip):
try:
@@ -327,8 +327,8 @@ class OvmNetwork(OvmObject):
except Exception, e:
errmsg = fmt_err_msg(e)
logger.error(OvmNetwork.getBridgeByIp, errmsg)
- raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.getBridgeByIp), errmsg)
-
+ raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.getBridgeByIp), errmsg)
+
@staticmethod
def getVlans():
try:
@@ -339,8 +339,8 @@ class OvmNetwork(OvmObject):
except Exception, e:
errmsg = fmt_err_msg(e)
logger.error(OvmNetwork.getVlans, errmsg)
- raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.getVlans), errmsg)
-
+ raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.getVlans), errmsg)
+
@staticmethod
def createVlan(jStr):
try:
@@ -353,7 +353,7 @@ class OvmNetwork(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmNetwork.createVlan, errmsg)
raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.createVlan), errmsg)
-
+
@staticmethod
def createVlanBridge(bridgeDetails, vlanDetails):
try:
@@ -368,7 +368,7 @@ class OvmNetwork(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmNetwork.createVlanBridge, errmsg)
raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.createVlanBridge), errmsg)
-
+
@staticmethod
def deleteVlanBridge(name):
try:
@@ -376,7 +376,7 @@ class OvmNetwork(OvmObject):
if name not in network.bridges.keys():
logger.debug(OvmNetwork.deleteVlanBridge, "No bridge %s found"%name)
return SUCC()
-
+
bridge = network.bridges[name]
vlanName = bridge.attach
if network._deleteBridge(name):
@@ -389,7 +389,7 @@ class OvmNetwork(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmNetwork.deleteVlanBridge, errmsg)
raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.deleteVlanBridge), errmsg)
-
+
@staticmethod
def getBridgeDetails(name):
try:
@@ -404,7 +404,7 @@ class OvmNetwork(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmNetwork.getBridgeDetails, errmsg)
raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.getBridgeDetails), errmsg)
-
+
@staticmethod
def deleteVlan(name):
try:
@@ -414,8 +414,8 @@ class OvmNetwork(OvmObject):
except Exception, e:
errmsg = fmt_err_msg(e)
logger.error(OvmNetwork.deleteVlan, errmsg)
- raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.deleteVlan), errmsg)
-
+ raise XmlRpcFault(toErrCode(OvmNetwork, OvmNetwork.deleteVlan), errmsg)
+
if __name__ == "__main__":
try:
OvmNetwork.getBridgeDetails(sys.argv[1])
@@ -424,10 +424,10 @@ if __name__ == "__main__":
# txt2 = json.dumps({"name":"xapi3", "attach":"eth0.104"})
# print nw.createVlan(txt)
# print nw.createBridge(txt2)
- #
+ #
# nw.deleteBridge("xapi3")
# nw.deleteVlan("eth0.104")
#=======================================================================
-
+
except Exception, e:
print e
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 bf330f2..650d868 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
@@ -5,9 +5,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
@@ -16,7 +16,7 @@
# under the License.
from OvmCommonModule import *
-logger = OvmLogger('OvmOCFS2')
+logger = OvmLogger('OvmOCFS2')
class OvmOCFS2(OvmObject):
def _prepareConf(self, cluster):
conf = '''cluster:
@@ -26,22 +26,22 @@ class OvmOCFS2(OvmObject):
dir = dirname(OCFS2_CONF)
if not isdir(dir):
os.makedirs(dir)
-
+
fd = open(OCFS2_CONF, 'w')
fd.write(conf)
fd.close()
-
+
def _addNode(self, name, nodeNum, ip, port, cluster, isOnline=True):
nodePath = '/sys/kernel/config/cluster/%s/node/%s'%(cluster, name)
if exists(nodePath):
logger.debug(OvmOCFS2._addNode, "node %s already exists, skip it(%s)"%(name, nodePath))
return
-
+
if not isOnline:
cmds = ['o2cb_ctl -C -n', name, '-t node', '-a number=%s'%nodeNum, '-a ip_address=%s'%ip, '-a ip_port=%s'%port, '-a cluster=%s'%cluster]
else:
cmds = ['o2cb_ctl -C -i -n', name, '-t node', '-a number=%s'%nodeNum, '-a ip_address=%s'%ip, '-a ip_port=%s'%port, '-a cluster=%s'%cluster]
-
+
try:
doCmd(cmds)
except ShellExceutedFailedException, e:
@@ -49,18 +49,18 @@ class OvmOCFS2(OvmObject):
logger.debug(OvmOCFS2._addNode, "node %s already exists, skip it(%s)"%(name, e.stderr))
else:
raise e
-
+
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
-
+
def _load(self):
cmd = ['service o2cb load']
doCmd(cmd)
-
+
def _start(self, cluster):
#blank line are answer by clicking enter
config='''
@@ -77,4 +77,4 @@ EOF
doCmd(cmd)
cmd = ['service o2cb start %s'%cluster]
doCmd(cmd)
-
+
diff --git a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmObjectModule.py b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmObjectModule.py
index ca26d84..c806f29 100755
--- a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmObjectModule.py
+++ b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmObjectModule.py
@@ -5,9 +5,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
diff --git a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmSecurityGroupModule.py b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmSecurityGroupModule.py
index 5ce68f8..076ffad 100755
--- a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmSecurityGroupModule.py
+++ b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmSecurityGroupModule.py
@@ -5,9 +5,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
@@ -34,11 +34,11 @@ class OvmSecurityGroup(OvmObject):
except:
print "ebtables was not found on the host"
return False
-
+
if not os.path.exists('/var/run/cloud'):
os.makedirs('/var/run/cloud')
-
- return OvmSecurityGroup.cleanup_rules()
+
+ return OvmSecurityGroup.cleanup_rules()
@staticmethod
def cleanup_rules():
@@ -52,8 +52,8 @@ class OvmSecurityGroup(OvmObject):
vm_name = chain
else:
continue
-
- cmd = "xm list | grep " + vm_name
+
+ cmd = "xm list | grep " + vm_name
try:
result = execute(cmd)
except:
@@ -62,10 +62,10 @@ class OvmSecurityGroup(OvmObject):
if result == None or len(result) == 0:
logging.debug("chain " + chain + " does not correspond to a vm, cleaning up")
cleanup.append(vm_name)
-
+
for vm_name in cleanup:
OvmSecurityGroup.delete_all_network_rules_for_vm(vm_name)
-
+
logging.debug("Cleaned up rules for " + str(len(cleanup)) + " chains")
return True
except:
@@ -111,26 +111,26 @@ class OvmSecurityGroup(OvmObject):
execute("iptables -A " + brfw + " -m physdev --physdev-is-bridged --physdev-out " + phydev + " -j ACCEPT")
execute("iptables -A " + brfw + " -m state --state RELATED,ESTABLISHED -j ACCEPT")
execute("iptables -A " + brfw + " -m physdev --physdev-is-bridged --physdev-is-out -j " + brfwout)
- execute("iptables -A " + brfw + " -m physdev --physdev-is-bridged --physdev-is-in -j " + brfwin)
-
+ execute("iptables -A " + brfw + " -m physdev --physdev-is-bridged --physdev-is-in -j " + brfwin)
+
return True
except:
try:
execute("iptables -F " + brfw)
except:
return False
-
+
return False
@staticmethod
def default_network_rules_user_vm(vm_name, vm_id, vm_ip, vm_mac, vif, bridge_name):
if not OvmSecurityGroup.add_fw_framework(bridge_name):
- return False
+ return False
OvmSecurityGroup.delete_iptables_rules_for_vm(vm_name)
OvmSecurityGroup.delete_ebtables_rules_for_vm(vm_name)
-
- bridge_firewall_chain = "BF-" + bridge_name
+
+ bridge_firewall_chain = "BF-" + bridge_name
vm_chain = vm_name
default_vm_chain = '-'.join(vm_chain.split('-')[:-1]) + "-def"
dom_id = getDomId(vm_name)
@@ -139,7 +139,7 @@ class OvmSecurityGroup(OvmObject):
execute("iptables -N " + vm_chain)
except:
execute("iptables -F " + vm_chain)
-
+
try:
execute("iptables -N " + default_vm_chain)
except:
@@ -163,13 +163,13 @@ class OvmSecurityGroup(OvmObject):
except:
logging.debug("Failed to program default rules for vm " + vm_name)
return False
-
+
OvmSecurityGroup.default_ebtables_rules(vm_chain, vm_ip, vm_mac, vif)
-
+
if vm_ip is not None:
if (OvmSecurityGroup.write_rule_log_for_vm(vm_name, vm_id, vm_ip, dom_id, '_initial_', '-1') == False):
logging.debug("Failed to log default network rules, ignoring")
-
+
logging.debug("Programmed default rules for vm " + vm_name)
return True
@@ -177,12 +177,12 @@ class OvmSecurityGroup(OvmObject):
def default_ebtables_rules(vm_name, vm_ip, vm_mac, vif):
vm_chain_in = vm_name + "-in"
vm_chain_out = vm_name + "-out"
-
+
for chain in [vm_chain_in, vm_chain_out]:
try:
execute("ebtables -t nat -N " + chain)
except:
- execute("ebtables -t nat -F " + chain)
+ execute("ebtables -t nat -F " + chain)
try:
execute("ebtables -t nat -A PREROUTING -i " + vif + " -j " + vm_chain_in)
@@ -190,27 +190,27 @@ class OvmSecurityGroup(OvmObject):
except:
logging.debug("Failed to program default rules")
return False
-
+
try:
execute("ebtables -t nat -A " + vm_chain_in + " -s ! " + vm_mac + " -j DROP")
execute("ebtables -t nat -A " + vm_chain_in + " -p ARP -s ! " + vm_mac + " -j DROP")
execute("ebtables -t nat -A " + vm_chain_in + " -p ARP --arp-mac-src ! " + vm_mac + " -j DROP")
if vm_ip is not None:
execute("ebtables -t nat -A " + vm_chain_in + " -p ARP --arp-ip-src ! " + vm_ip + " -j DROP")
- execute("ebtables -t nat -A " + vm_chain_in + " -p ARP --arp-op Request -j ACCEPT")
- execute("ebtables -t nat -A " + vm_chain_in + " -p ARP --arp-op Reply -j ACCEPT")
- execute("ebtables -t nat -A " + vm_chain_in + " -p ARP -j DROP")
+ execute("ebtables -t nat -A " + vm_chain_in + " -p ARP --arp-op Request -j ACCEPT")
+ execute("ebtables -t nat -A " + vm_chain_in + " -p ARP --arp-op Reply -j ACCEPT")
+ execute("ebtables -t nat -A " + vm_chain_in + " -p ARP -j DROP")
except:
logging.exception("Failed to program default ebtables IN rules")
return False
-
+
try:
execute("ebtables -t nat -A " + vm_chain_out + " -p ARP --arp-op Reply --arp-mac-dst ! " + vm_mac + " -j DROP")
if vm_ip is not None:
- execute("ebtables -t nat -A " + vm_chain_out + " -p ARP --arp-ip-dst ! " + vm_ip + " -j DROP")
- execute("ebtables -t nat -A " + vm_chain_out + " -p ARP --arp-op Request -j ACCEPT")
- execute("ebtables -t nat -A " + vm_chain_out + " -p ARP --arp-op Reply -j ACCEPT")
- execute("ebtables -t nat -A " + vm_chain_out + " -p ARP -j DROP")
+ execute("ebtables -t nat -A " + vm_chain_out + " -p ARP --arp-ip-dst ! " + vm_ip + " -j DROP")
+ execute("ebtables -t nat -A " + vm_chain_out + " -p ARP --arp-op Request -j ACCEPT")
+ execute("ebtables -t nat -A " + vm_chain_out + " -p ARP --arp-op Reply -j ACCEPT")
+ execute("ebtables -t nat -A " + vm_chain_out + " -p ARP -j DROP")
except:
logging.debug("Failed to program default ebtables OUT rules")
return False
@@ -222,14 +222,14 @@ class OvmSecurityGroup(OvmObject):
try:
vm_chain = vm_name
dom_id = getDomId(vm_name)
-
+
changes = []
changes = OvmSecurityGroup.check_rule_log_for_vm(vm_name, vm_id, vm_ip, dom_id, signature, seqno)
-
+
if not 1 in changes:
logging.debug("Rules already programmed for vm " + vm_name)
return True
-
+
if changes[0] or changes[1] or changes[2] or changes[3]:
if not OvmSecurityGroup.default_network_rules(vm_name, vm_id, vm_ip, vm_mac, vif, bridge_name):
return False
@@ -241,8 +241,8 @@ class OvmSecurityGroup(OvmObject):
logging.debug("Programming network rules for IP: " + vm_ip + " vmname=" + vm_name)
execute("iptables -F " + vm_chain)
-
- for line in lines:
+
+ for line in lines:
tokens = line.split(':')
if len(tokens) != 4:
continue
@@ -257,9 +257,9 @@ class OvmSecurityGroup(OvmObject):
i = ips.index('0.0.0.0/0')
del ips[i]
allow_any = True
-
+
port_range = start + ":" + end
- if ips:
+ if ips:
if protocol == 'all':
for ip in ips:
execute("iptables -I " + vm_chain + " -m state --state NEW -s " + ip + " -j ACCEPT")
@@ -272,7 +272,7 @@ class OvmSecurityGroup(OvmObject):
port_range = "any"
for ip in ips:
execute("iptables -I " + vm_chain + " -p icmp --icmp-type " + port_range + " -s " + ip + " -j ACCEPT")
-
+
if allow_any and protocol != 'all':
if protocol != 'icmp':
execute("iptables -I " + vm_chain + " -p " + protocol + " -m " + protocol + " --dport " + port_range + " -m state --state NEW -j ACCEPT")
@@ -281,17 +281,17 @@ class OvmSecurityGroup(OvmObject):
if start == "-1":
port_range = "any"
execute("iptables -I " + vm_chain + " -p icmp --icmp-type " + port_range + " -j ACCEPT")
-
- iptables = "iptables -A " + vm_chain + " -j DROP"
+
+ iptables = "iptables -A " + vm_chain + " -j DROP"
execute(iptables)
-
- return OvmSecurityGroup.write_rule_log_for_vm(vm_name, vm_id, vm_ip, dom_id, signature, seqno)
+
+ return OvmSecurityGroup.write_rule_log_for_vm(vm_name, vm_id, vm_ip, dom_id, signature, seqno)
except:
logging.debug("Failed to network rule !: " + sys.exc_type)
return False
@staticmethod
- def delete_all_network_rules_for_vm(vm_name, vif = None):
+ def delete_all_network_rules_for_vm(vm_name, vif = None):
OvmSecurityGroup.delete_iptables_rules_for_vm(vm_name)
OvmSecurityGroup.delete_ebtables_rules_for_vm(vm_name)
@@ -299,15 +299,15 @@ class OvmSecurityGroup(OvmObject):
default_vm_chain = None
if vm_name.startswith('i-') or vm_name.startswith('r-'):
default_vm_chain = '-'.join(vm_name.split('-')[:-1]) + "-def"
-
+
try:
- if default_vm_chain != None:
+ if default_vm_chain != None:
execute("iptables -F " + default_vm_chain)
except:
logging.debug("Ignoring failure to delete chain " + default_vm_chain)
-
+
try:
- if default_vm_chain != None:
+ if default_vm_chain != None:
execute("iptables -X " + vmchain_default)
except:
logging.debug("Ignoring failure to delete chain " + default_vm_chain)
@@ -316,12 +316,12 @@ class OvmSecurityGroup(OvmObject):
execute("iptables -F " + vm_chain)
except:
logging.debug("Ignoring failure to delete chain " + vm_chain)
-
+
try:
execute("iptables -X " + vm_chain)
except:
logging.debug("Ignoring failure to delete chain " + vm_chain)
-
+
if vif is not None:
try:
dnats = execute("iptables-save -t nat | grep " + vif + " | sed 's/-A/-D/'").split("\n")
@@ -329,15 +329,15 @@ class OvmSecurityGroup(OvmObject):
try:
execute("iptables -t nat " + dnat)
except:
- logging.debug("Igoring failure to delete dnat: " + dnat)
+ logging.debug("Igoring failure to delete dnat: " + dnat)
except:
pass
-
+
OvmSecurityGroup.remove_rule_log_for_vm(vm_name)
-
+
if 1 in [ vm_name.startswith(c) for c in ['r-', 's-', 'v-'] ]:
return True
-
+
return True
@staticmethod
@@ -347,7 +347,7 @@ class OvmSecurityGroup(OvmObject):
query = "iptables-save | grep " + vm_chain + " | grep physdev-is-bridged | sed 's/-A/-D/'"
delete_cmds = execute(query).split('\n')
delete_cmds.pop()
-
+
for cmd in delete_cmds:
try:
execute("iptables " + cmd)
@@ -356,7 +356,7 @@ class OvmSecurityGroup(OvmObject):
@staticmethod
def delete_ebtables_rules_for_vm(vm_name):
- vm_name = OvmSecurityGroup.truncate_vm_name(vm_name)
+ vm_name = OvmSecurityGroup.truncate_vm_name(vm_name)
query = "ebtables -t nat -L --Lx | grep ROUTING | grep " + vm_name + " | sed 's/-A/-D/'"
delete_cmds = execute(query).split('\n')
delete_cmds.pop()
@@ -366,9 +366,9 @@ class OvmSecurityGroup(OvmObject):
execute(cmd)
except:
logging.debug("Ignoring failure to delete ebtables rules for vm " + vm_name)
-
+
chains = [vm_name + "-in", vm_name + "-out"]
-
+
for chain in chains:
try:
execute("ebtables -t nat -F " + chain)
@@ -382,7 +382,7 @@ class OvmSecurityGroup(OvmObject):
truncated_vm_name = '-'.join(vm_name.split('-')[:-1])
else:
truncated_vm_name = vm_name
- return truncated_vm_name
+ return truncated_vm_name
@staticmethod
def write_rule_log_for_vm(vm_name, vm_id, vm_ip, dom_id, signature, seqno):
@@ -391,15 +391,15 @@ class OvmSecurityGroup(OvmObject):
logf = open(log_file_name, 'w')
output = ','.join([vm_name, vm_id, vm_ip, dom_id, signature, seqno])
- result = True
+ result = True
try:
logf.write(output)
logf.write('\n')
except:
logging.debug("Failed to write to rule log file " + log_file_name)
result = False
-
- logf.close()
+
+ logf.close()
return result
@staticmethod
@@ -412,7 +412,7 @@ class OvmSecurityGroup(OvmObject):
except:
logging.debug("Failed to delete rule log file " + log_file_name)
result = False
-
+
return result
@staticmethod
@@ -420,11 +420,11 @@ class OvmSecurityGroup(OvmObject):
log_file_name = "/var/run/cloud/" + vm_name + ".log"
if not os.path.exists(log_file_name):
return [True, True, True, True, True, True]
-
+
try:
lines = (line.rstrip() for line in open(log_file_name))
except:
- logging.debug("failed to open " + log_file_name)
+ logging.debug("failed to open " + log_file_name)
return [True, True, True, True, True, True]
[_vm_name, _vm_id, _vm_ip, _dom_id, _signature, _seqno] = ['_', '-1', '_', '-1', '_', '-1']
@@ -436,10 +436,9 @@ class OvmSecurityGroup(OvmObject):
logging.debug("Failed to parse log file for vm " + vm_name)
remove_rule_log_for_vm(vm_name)
return [True, True, True, True, True, True]
-
+
return [(vm_name != _vm_name), (vm_id != _vm_id), (vm_ip != _vm_ip), (dom_id != _dom_id), (signature != _signature), (seqno != _seqno)]
-
@@ -475,4 +474,5 @@ class OvmSecurityGroup(OvmObject):
-
+
+
diff --git a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmStoragePoolModule.py b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmStoragePoolModule.py
index f4933ec..176d54a 100755
--- a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmStoragePoolModule.py
+++ b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmStoragePoolModule.py
@@ -5,9 +5,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
@@ -50,7 +50,7 @@ def fromOvmStoragePool(pool):
def toOvmStoragePool(jStr):
return json.loads(jStr, cls=OvmStoragePoolDecoder)
-logger = OvmLogger('OvmStoragePool')
+logger = OvmLogger('OvmStoragePool')
class OvmStoragePool(OvmObject):
uuid = ''
type = ''
@@ -65,42 +65,42 @@ class OvmStoragePool(OvmObject):
for uuid, sr in d.items():
if sr.name_label == poolUuid:
return sr
-
+
raise Exception("No SR matching to %s" % poolUuid)
-
+
def _getSpaceinfoOfDir(self, dir):
stat = os.statvfs(dir)
freeSpace = stat.f_frsize * stat.f_bavail;
totalSpace = stat.f_blocks * stat.f_frsize;
return (totalSpace, freeSpace)
-
+
def _checkDirSizeForImage(self, dir, image):
(x, free_storage_size) = OvmStoragePool()._getSpaceinfoOfDir(dir)
image_size = os.path.getsize(image)
if image_size > (free_storage_size + 1024 * 1024 * 1024):
raise Exception("No space on dir %s (free storage:%s, vm size:%s)"%(dir, free_storage_size, image_size))
-
+
def _getAllMountPoints(self):
mps = []
d = db_dump('sr')
for uuid, sr in d.items():
mps.append(sr.mountpoint)
return mps
-
+
def _isMounted(self, path):
res = doCmd(['mount'])
return (path in res)
-
+
def _mount(self, target, mountpoint, readonly=False):
if not exists(mountpoint):
os.makedirs(mountpoint)
-
+
if not OvmStoragePool()._isMounted(mountpoint):
if readonly:
doCmd(['mount', target, mountpoint, '-r'])
else:
doCmd(['mount', target, mountpoint])
-
+
def _umount(self, mountpoint):
umountCmd = ['umount', '-f', mountpoint]
doCmd(umountCmd)
@@ -110,7 +110,7 @@ class OvmStoragePool(OvmObject):
doCmd(rmDirCmd)
else:
logger.warning(OvmStoragePool._umount, "Something wrong when umount %s, there are still files in directory:%s", mountpoint, " ".join(ls))
-
+
@staticmethod
def create(jStr):
try:
@@ -125,7 +125,7 @@ class OvmStoragePool(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmStoragePool.create, errmsg)
raise XmlRpcFault(toErrCode(OvmStoragePool, OvmStoragePool.create), errmsg)
-
+
@staticmethod
def getDetailsByUuid(uuid):
try:
@@ -147,7 +147,7 @@ class OvmStoragePool(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmStoragePool.getDetailsByUuid, errmsg)
raise XmlRpcFault(toErrCode(OvmStoragePool, OvmStoragePool.getDetailsByUuid), errmsg)
-
+
@staticmethod
def downloadTemplate(uuid, secPath):
secMountPoint = None
@@ -158,28 +158,28 @@ class OvmStoragePool(OvmObject):
secMountPoint = join("/var/cloud/", tmpUuid)
if not exists(secMountPoint):
os.makedirs(secMountPoint)
-
+
templateFile = None
if secPath.endswith("raw"):
secPathDir = os.path.dirname(secPath)
templateFile = os.path.basename(secPath)
else:
secPathDir = secPath
-
+
# mount as read-only
mountCmd = ['mount.nfs', secPathDir, secMountPoint, '-r']
doCmd(mountCmd)
-
+
if not templateFile:
for f in os.listdir(secMountPoint):
if isfile(join(secMountPoint, f)) and f.endswith('raw'):
templateFile = f
- break
-
+ break
+
if not templateFile:
raise Exception("Can not find raw template in secondary storage")
templateSecPath = join(secMountPoint, templateFile)
-
+
sr = OvmStoragePool()._getSrByNameLable(uuid)
priStorageMountPoint = sr.mountpoint
# Although mgmt server will check the size, we check again for safety
@@ -188,12 +188,12 @@ class OvmStoragePool(OvmObject):
if exists(seedDir):
raise Exception("%s already here, cannot override existing template" % seedDir)
os.makedirs(seedDir)
-
+
tgt = join(seedDir, templateFile)
cpTemplateCmd = ['cp', templateSecPath, tgt]
logger.info(OvmStoragePool.downloadTemplate, " ".join(cpTemplateCmd))
doCmd(cpTemplateCmd)
- templateSize = os.path.getsize(tgt)
+ templateSize = os.path.getsize(tgt)
logger.info(OvmStoragePool.downloadTemplate, "primary_storage_download success:installPath:%s, templateSize:%s"%(tgt,templateSize))
rs = toGson({"installPath":tgt, "templateSize":templateSize})
return rs
@@ -210,7 +210,7 @@ class OvmStoragePool(OvmObject):
logger.error(OvmStoragePool.downloadTemplate, 'unmount secondary storage at %s failed, %s'%(secMountPoint, errmsg))
@staticmethod
- def prepareOCFS2Nodes(clusterName, nodeString):
+ def prepareOCFS2Nodes(clusterName, nodeString):
def configureEtcHosts(nodes):
if not exists(ETC_HOSTS):
orignalConf = ""
@@ -218,14 +218,14 @@ class OvmStoragePool(OvmObject):
fd = open(ETC_HOSTS, "r")
orignalConf = fd.read()
fd.close()
-
+
pattern = r"(.*%s.*)|(.*%s.*)"
newlines = []
for n in nodes:
p = pattern % (n["ip_address"], n["name"])
orignalConf = re.sub(p, "", orignalConf)
newlines.append("%s\t%s\n"%(n["ip_address"], n["name"]))
-
+
orignalConf = orignalConf + "".join(newlines)
# remove extra empty lines
orignalConf = re.sub(r"\n\s*\n*", "\n", orignalConf)
@@ -233,7 +233,7 @@ class OvmStoragePool(OvmObject):
fd = open(ETC_HOSTS, "w")
fd.write(orignalConf)
fd.close()
-
+
def configureHostName(nodes):
myIp = successToMap(get_master_ip())['ip']
nodeName = None
@@ -241,7 +241,7 @@ class OvmStoragePool(OvmObject):
if myIp == n["ip_address"]:
nodeName = n["name"]
break
-
+
if nodeName == None: raise Exception("Cannot find node equals to my ip address:%s"%myIp)
if not exists(HOSTNAME_FILE):
originalConf = ""
@@ -249,7 +249,7 @@ class OvmStoragePool(OvmObject):
fd = open(HOSTNAME_FILE, "r")
originalConf = fd.read()
fd.close()
-
+
pattern = r"HOSTNAME=(.*)"
# remove any old hostname
originalConf = re.sub(pattern, "", originalConf)
@@ -260,31 +260,31 @@ class OvmStoragePool(OvmObject):
fd.write(originalConf)
fd.close()
doCmd(['hostname', nodeName])
-
+
def addNodes(nodes, clusterName):
ocfs2 = OvmOCFS2()
ocfs2._load()
isOnline = ocfs2._isClusterOnline(clusterName)
if not isOnline:
ocfs2._prepareConf(clusterName)
-
+
for n in nodes:
ocfs2._addNode(n['name'], n['number'], n['ip_address'], 7777, clusterName, isOnline)
-
+
def checkStaleCluster(clusterName):
if exists('/sys/kernel/config/cluster/'):
dirs = os.listdir('/sys/kernel/config/cluster/')
for dir in dirs:
if dir != clusterName:
errMsg = '''CloudStack detected there is a stale cluster(%s) on host %s. Please manually clean up it first then add again by
-1) remove the host from cloudstack
+1) remove the host from cloudstack
2) umount all OCFS2 device on host
3) /etc/init.d/o2cb offline %s
4) /etc/init.d/o2cb restart
if this doesn't resolve the problem, please check oracle manual to see how to offline a cluster
''' % (dir, successToMap(get_master_ip())['ip'], dir)
raise Exception(errMsg)
-
+
try:
checkStaleCluster(clusterName)
nodeString = nodeString.strip(";")
@@ -294,10 +294,10 @@ if this doesn't resolve the problem, please check oracle manual to see how to of
if len(params) != 3: raise Exception("Wrong parameter(%s) in node string(%s)"%(n, nodeString))
dict = {"number":params[0], "ip_address":params[1], "name":params[2]}
nodes.append(dict)
-
+
if len(nodes) > 255:
raise Exception("%s nodes beyond maximum 255 allowed by OCFS2"%len(nodes))
-
+
configureHostName(nodes)
configureEtcHosts(nodes)
addNodes(nodes, clusterName)
@@ -308,12 +308,12 @@ if this doesn't resolve the problem, please check oracle manual to see how to of
logger.debug(OvmStoragePool.prepareOCFS2Nodes, "Configure cluster.conf to:\n%s"%' '.join(conf))
rs = SUCC()
return rs
-
+
except Exception, e:
errmsg = fmt_err_msg(e)
logger.error(OvmStoragePool.prepareOCFS2Nodes, errmsg)
raise XmlRpcFault(toErrCode(OvmStoragePool, OvmStoragePool.prepareOCFS2Nodes), errmsg)
-
+
@staticmethod
def createTemplateFromVolume(secStorageMountPath, installPath, volumePath):
try:
@@ -323,7 +323,7 @@ if this doesn't resolve the problem, please check oracle manual to see how to of
vmName = getVmNameFromConfigureFile(vmCfg)
if vmName in doCmd(['xm', 'list']):
raise Exception("%s is still running, please stop it first then create template again"%vmName)
-
+
tmpUuid = get_uuid()
secMountPoint = join("/var/cloud/", tmpUuid)
OvmStoragePool()._mount(secStorageMountPath, secMountPoint)
@@ -335,7 +335,7 @@ if this doesn't resolve the problem, please check oracle manual to see how to of
logger.warning(OvmStoragePool.createTemplateFromVolume, "%s is already here, delete it since it is most likely stale"%destPath)
doCmd(['rm', '-rf', destPath])
OvmStoragePool()._checkDirSizeForImage(secMountPoint, volumePath)
-
+
os.makedirs(destPath)
newName = get_uuid() + ".raw"
destName = join(destPath, newName)
@@ -345,18 +345,18 @@ if this doesn't resolve the problem, please check oracle manual to see how to of
OvmStoragePool()._umount(secMountPoint)
rs = toGson({"installPath":resInstallPath, "templateFileName":newName, "virtualSize":size, "physicalSize":size})
return rs
-
+
except Exception, e:
try:
if exists(secMountPoint):
OvmStoragePool()._umount(secMountPoint)
except Exception, e:
- logger.warning(OvmStoragePool.createTemplateFromVolume, "umount %s failed"%secMountPoint)
-
+ logger.warning(OvmStoragePool.createTemplateFromVolume, "umount %s failed"%secMountPoint)
+
errmsg = fmt_err_msg(e)
logger.error(OvmStoragePool.createTemplateFromVolume, errmsg)
raise XmlRpcFault(toErrCode(OvmStoragePool, OvmStoragePool.createTemplateFromVolume), errmsg)
-
+
@staticmethod
def delete(uuid):
try:
@@ -368,8 +368,8 @@ if this doesn't resolve the problem, please check oracle manual to see how to of
except Exception, e:
errmsg = fmt_err_msg(e)
logger.error(OvmStoragePool.delete, errmsg)
- raise XmlRpcFault(toErrCode(OvmStoragePool, OvmStoragePool.delete), errmsg)
-
+ raise XmlRpcFault(toErrCode(OvmStoragePool, OvmStoragePool.delete), errmsg)
+
@staticmethod
def copyVolume(secStorageMountPath, volumeFolderOnSecStorage, volumePath, storagePoolUuid, toSec):
def copyToSecStorage(secMountPoint, volumeFolderOnSecStorage, volumePath):
@@ -387,7 +387,7 @@ if this doesn't resolve the problem, please check oracle manual to see how to of
destName = join(destPath, newName)
doCmd(['cp', volumePath, destName])
return destName
-
+
def copyToPrimary(secMountPoint, volumeFolderOnSecStorage, volumePath, primaryMountPath):
srcPath = join(secMountPoint, volumeFolderOnSecStorage.lstrip("/"), volumePath.lstrip("/"))
if not srcPath.endswith(".raw"): srcPath = srcPath + ".raw"
@@ -399,7 +399,7 @@ if this doesn't resolve the problem, please check oracle manual to see how to of
destName = join(destPath, newName)
doCmd(['cp', srcPath, destName])
return destName
-
+
secMountPoint = ""
try:
tmpUuid = get_uuid()
@@ -412,7 +412,7 @@ if this doesn't resolve the problem, please check oracle manual to see how to of
primaryStoragePath = sr.mountpoint
resultPath = copyToPrimary(secMountPoint, volumeFolderOnSecStorage, volumePath, primaryStoragePath)
OvmStoragePool()._umount(secMountPoint)
-
+
# ingratiate bad mgmt server design, it asks 'installPath' but it only wants the volume name without suffix
volumeUuid = basename(resultPath).rstrip(".raw")
rs = toGson({"installPath":volumeUuid})
@@ -422,11 +422,10 @@ if this doesn't resolve the problem, please check oracle manual to see how to of
if exists(secMountPoint):
OvmStoragePool()._umount(secMountPoint)
except Exception, e:
- logger.warning(OvmStoragePool.copyVolume, "umount %s failed"%secMountPoint)
-
+ logger.warning(OvmStoragePool.copyVolume, "umount %s failed"%secMountPoint)
+
errmsg = fmt_err_msg(e)
logger.error(OvmStoragePool.copyVolume, errmsg)
raise XmlRpcFault(toErrCode(OvmStoragePool, OvmStoragePool.copyVolume), errmsg)
-
-
-
\ No newline at end of file
+
+
diff --git a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmVifModule.py b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmVifModule.py
index 561b1a9..1519843 100755
--- a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmVifModule.py
+++ b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmVifModule.py
@@ -5,9 +5,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
@@ -27,7 +27,7 @@ class OvmVifDecoder(json.JSONDecoder):
vif.mac = deDict['mac']
vif.bridge = deDict['bridge']
return vif
-
+
class OvmVifEncoder(json.JSONEncoder):
def default(self, obj):
if not isinstance(obj, OvmVif): raise Exception("%s is not instance of OvmVif"%type(obj))
@@ -36,7 +36,7 @@ class OvmVifEncoder(json.JSONEncoder):
safeDictSet(obj, dct, 'bridge')
safeDictSet(obj, dct, 'type')
safeDictSet(obj, dct, 'name')
- return dct
+ return dct
def fromOvmVif(vif):
return normalizeToGson(json.dumps(vif, cls=OvmVifEncoder))
@@ -60,6 +60,6 @@ class OvmVif(OvmObject):
bridge = ''
type = ''
mode = ''
-
+
def toXenString(self):
return "%s,%s,%s"%(self.mac, self.bridge, self.type)
diff --git a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmVmModule.py b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmVmModule.py
index 5e9e521..ff7e5d5 100755
--- a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmVmModule.py
+++ b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmVmModule.py
@@ -5,9 +5,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
@@ -71,7 +71,7 @@ class OvmVmEncoder(json.JSONEncoder):
disks = fromOvmDiskList(obj.disks)
dct['disks'] = disks
return dct
-
+
def toOvmVm(jStr):
return json.loads(jStr, cls=OvmVmDecoder)
@@ -88,7 +88,7 @@ class OvmVm(OvmObject):
name = ''
bootDev = ''
type = ''
-
+
def _getVifs(self, vmName):
vmPath = OvmHost()._vmNameToPath(vmName)
domId = OvmHost()._getDomainIdByName(vmName)
@@ -104,9 +104,9 @@ class OvmVm(OvmObject):
safeSetAttr(vif, 'bridge', bridge)
safeSetAttr(vif, 'type', type)
lst.append(vif)
-
+
return lst
-
+
def _getVifsFromConfig(self, vmPath):
vifs = successToMap(xen_get_vifs(vmPath))
lst = []
@@ -120,16 +120,16 @@ class OvmVm(OvmObject):
safeSetAttr(vif, 'type', type)
lst.append(vif)
return lst
-
+
def _getIsoMountPath(self, vmPath):
vmName = basename(vmPath)
priStoragePath = vmPath.rstrip(join('running_pool', vmName))
return join(priStoragePath, 'iso_pool', vmName)
-
+
def _getVmTypeFromConfigFile(self, vmPath):
vmType = successToMap(xen_get_vm_type(vmPath))['type']
return vmType.replace('hvm', 'HVM').replace('para', 'PV')
-
+
def _tapAOwnerFile(self, vmPath):
# Create a file with name convention 'host_ip_address' in vmPath
# Because xm list doesn't return vm that has been stopped, we scan
@@ -140,30 +140,30 @@ class OvmVm(OvmObject):
fd = open(join(vmPath, ownerFileName), 'w')
fd.write(ownerFileName)
fd.close()
-
+
def _cleanUpOwnerFile(self, vmPath):
for f in os.listdir(vmPath):
fp = join(vmPath, f)
if isfile(fp) and f.startswith(OWNER_FILE_PREFIX):
os.remove(fp)
-
+
@staticmethod
- def create(jsonString):
+ def create(jsonString):
def dumpCfg(vmName, cfgPath):
cfgFd = open(cfgPath, 'r')
cfg = cfgFd.readlines()
cfgFd.close()
logger.info(OvmVm.create, "Start %s with configure:\n\n%s\n"%(vmName, "".join(cfg)))
-
+
def setVifsType(vifs, type):
for vif in vifs:
vif.type = type
-
+
def hddBoot(vm, vmPath):
vmType = vm.type
if vmType == "FROMCONFIGFILE":
vmType = OvmVm()._getVmTypeFromConfigFile(vmPath)
-
+
cfgDict = {}
if vmType == "HVM":
cfgDict['builder'] = "'hvm'"
@@ -175,7 +175,7 @@ class OvmVm(OvmObject):
else:
cfgDict['bootloader'] = "'/usr/bin/pygrub'"
vifType = 'netfront'
-
+
cfgDict['name'] = "'%s'"%vm.name
cfgDict['disk'] = "[]"
cfgDict['vcpus'] = "''"
@@ -183,17 +183,17 @@ class OvmVm(OvmObject):
cfgDict['on_crash'] = "'destroy'"
cfgDict['on_reboot'] = "'restart'"
cfgDict['vif'] = "[]"
-
+
items = []
for k in cfgDict.keys():
item = " = ".join([k, cfgDict[k]])
items.append(item)
vmSpec = "\n".join(items)
-
+
vmCfg = open(join(vmPath, 'vm.cfg'), 'w')
vmCfg.write(vmSpec)
vmCfg.close()
-
+
setVifsType(vm.vifs, vifType)
raiseExceptionIfFail(xen_set_vcpus(vmPath, vm.cpuNum))
raiseExceptionIfFail(xen_set_memory(vmPath, BytesToM(vm.memory)))
@@ -201,7 +201,7 @@ class OvmVm(OvmObject):
vifs = [OvmVif.toXenString(v) for v in vm.vifs]
for vif in vifs:
raiseExceptionIfFail(xen_set_vifs(vmPath, vif))
-
+
for disk in vm.disks:
raiseExceptionIfFail(xen_add_disk(vmPath, disk.path, mode=disk.type))
@@ -215,7 +215,7 @@ class OvmVm(OvmObject):
# it's tricky !
raiseExceptionIfFail(xen_config_boot_sequence(vmPath, 'd'))
raiseExceptionIfFail(xen_config_boot_sequence(vmPath, 'c'))
-
+
raiseExceptionIfFail(xen_correct_cfg(cfgFile, vmPath))
xen_correct_qos_cfg(cfgFile)
dumpCfg(vm.name, cfgFile)
@@ -223,7 +223,7 @@ class OvmVm(OvmObject):
raiseExceptionIfFail(start_vm(vmPath, server))
rs = SUCC()
return rs
-
+
def cdBoot(vm, vmPath):
isoMountPath = None
try:
@@ -233,7 +233,7 @@ class OvmVm(OvmObject):
cdrom = disk
break
if not cdrom: raise Exception("Cannot find Iso in disks")
-
+
isoOnSecStorage = dirname(cdrom.path)
isoName = basename(cdrom.path)
isoMountPath = OvmVm()._getIsoMountPath(vmPath)
@@ -241,10 +241,10 @@ class OvmVm(OvmObject):
isoPath = join(isoMountPath, isoName)
if not exists(isoPath):
raise Exception("Cannot found iso %s at %s which mounts to %s"%(isoName, isoOnSecStorage, isoMountPath))
-
+
stdout = run_cmd(args=['file', isoPath])
if not stdout.strip().endswith("(bootable)"): raise Exception("ISO %s is not bootable"%cdrom.path)
-
+
#now alter cdrom to correct path
cdrom.path = isoPath
if len(vm.vifs) != 0:
@@ -253,7 +253,7 @@ class OvmVm(OvmObject):
vifCfg = ','.join([vif.mac, vif.bridge, 'ioemu'])
else:
vifCfg = ''
-
+
rootDiskSize = os.path.getsize(vm.rootDisk.path)
rooDiskCfg = ':'.join([join(vmPath, basename(vm.rootDisk.path)), str(BytesToG(rootDiskSize)), 'True'])
disks = [rooDiskCfg]
@@ -264,7 +264,7 @@ class OvmVm(OvmObject):
disks.append(cfg)
disksCfg = ','.join(disks)
server = successToMap(get_master_ip())['ip']
-
+
raiseExceptionIfFail(install_vm_hvm(vmPath, BytesToM(vm.memory), vm.cpuNum, vifCfg, disksCfg, cdrom.path, vncpassword='', dedicated_server=server))
rs = SUCC()
return rs
@@ -273,13 +273,13 @@ class OvmVm(OvmObject):
doCmd(['umount', '-f', isoMountPath])
errmsg = fmt_err_msg(e)
raise Exception(errmsg)
-
+
try:
vm = toOvmVm(jsonString)
logger.debug(OvmVm.create, "creating vm, spec:%s"%jsonString)
rootDiskPath = vm.rootDisk.path
if not exists(rootDiskPath): raise Exception("Cannot find root disk %s"%rootDiskPath)
-
+
rootDiskDir = dirname(rootDiskPath)
vmPath = join(dirname(rootDiskDir), vm.name)
if not exists(vmPath):
@@ -287,7 +287,7 @@ class OvmVm(OvmObject):
vmNameFile = open(join(rootDiskDir, 'vmName'), 'w')
vmNameFile.write(vm.name)
vmNameFile.close()
-
+
OvmVm()._tapAOwnerFile(rootDiskDir)
# set the VM to DOWN before starting, OVS agent will check this status
set_vm_status(vmPath, 'DOWN')
@@ -302,7 +302,7 @@ class OvmVm(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmVm.create, errmsg)
raise XmlRpcFault(toErrCode(OvmVm, OvmVm.create), errmsg)
-
+
@staticmethod
def stop(vmName):
try:
@@ -311,7 +311,7 @@ class OvmVm(OvmObject):
except NoVmFoundException, e:
logger.info(OvmVm.stop, "vm %s is already stopped"%vmName)
return SUCC()
-
+
logger.info(OvmVm.stop, "Stop vm %s"%vmName)
try:
vmPath = OvmHost()._vmNameToPath(vmName)
@@ -327,7 +327,7 @@ class OvmVm(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmVm.stop, errmsg)
raise XmlRpcFault(toErrCode(OvmVm, OvmVm.stop), errmsg)
-
+
@staticmethod
def reboot(vmName):
try:
@@ -347,12 +347,12 @@ class OvmVm(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmVm.reboot, errmsg)
raise XmlRpcFault(toErrCode(OvmVm, OvmVm.reboot), errmsg)
-
+
@staticmethod
- def getDetails(vmName):
+ def getDetails(vmName):
try:
vm = OvmVm()
-
+
try:
OvmHost()._getDomainIdByName(vmName)
vmPath = OvmHost()._vmNameToPath(vmName)
@@ -360,8 +360,8 @@ class OvmVm(OvmObject):
except NoVmFoundException, e:
vmPath = OvmHost()._getVmPathFromPrimaryStorage(vmName)
vifsFromConfig = True
-
-
+
+
if not isdir(vmPath):
# The case is, when vm starting was not completed at primaryStroageDownload or createVolume(e.g. mgmt server stop), the mgmt
# server will keep vm state in staring, then a stop command will be sent. The stop command will delete bridges that vm attaches,
@@ -373,7 +373,7 @@ class OvmVm(OvmObject):
vm.vifs.extend(vm._getVifsFromConfig(vmPath))
else:
vm.vifs.extend(vm._getVifs(vmName))
-
+
safeSetAttr(vm, 'name', vmName)
disks = successToMap(xen_get_vdisks(vmPath))['vdisks'].split(',')
rootDisk = None
@@ -398,7 +398,7 @@ class OvmVm(OvmObject):
safeSetAttr(vm, 'powerState', vmStatus['status'])
vmType = successToMap(xen_get_vm_type(vmPath))['type'].replace('hvm', 'HVM').replace('para', 'PV')
safeSetAttr(vm, 'type', vmType)
-
+
rs = fromOvmVm(vm)
logger.info(OvmVm.getDetails, rs)
return rs
@@ -406,7 +406,7 @@ class OvmVm(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmVm.getDetails, errmsg)
raise XmlRpcFault(toErrCode(OvmVm, OvmVm.getDetails), errmsg)
-
+
@staticmethod
def getVmStats(vmName):
def getVcpuNumAndUtils():
@@ -421,7 +421,7 @@ class OvmVm(OvmObject):
nvCpus = len(items)
if nvCpus == 0:
raise Exception("vm %s has 0 vcpus !!!"%vmName)
-
+
xmInfo = successToMap(xen_get_xm_info())
nCpus = int(xmInfo['nr_cpus'])
totalUtils = 0.0
@@ -432,8 +432,8 @@ class OvmVm(OvmObject):
return (nvCpus, avgUtils)
finally:
session_logout()
-
-
+
+
try:
try:
OvmHost()._getDomainIdByName(vmName)
@@ -456,15 +456,15 @@ class OvmVm(OvmObject):
avgUtils = 0
rxBytes = 0
txBytes = 0
-
+
rs = toGson({"cpuNum":nvcpus, "cpuUtil":avgUtils, "rxBytes":rxBytes, "txBytes":txBytes})
logger.debug(OvmVm.getVmStats, rs)
- return rs
+ return rs
except Exception, e:
errmsg = fmt_err_msg(e)
logger.error(OvmVm.getVmStats, errmsg)
raise XmlRpcFault(toErrCode(OvmVm, OvmVm.getVmStats), errmsg)
-
+
@staticmethod
def migrate(vmName, targetHost):
try:
@@ -477,7 +477,7 @@ class OvmVm(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmVm.migrate, errmsg)
raise XmlRpcFault(toErrCode(OvmVm, OvmVm.migrate), errmsg)
-
+
@staticmethod
def register(vmName):
try:
@@ -492,7 +492,7 @@ class OvmVm(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmVm.register, errmsg)
raise XmlRpcFault(toErrCode(OvmVm, OvmVm.register), errmsg)
-
+
@staticmethod
def getVncPort(vmName):
try:
@@ -504,7 +504,7 @@ class OvmVm(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmVm.getVncPort, errmsg)
raise XmlRpcFault(toErrCode(OvmVm, OvmVm.getVncPort), errmsg)
-
+
@staticmethod
def detachOrAttachIso(vmName, iso, isAttach):
try:
@@ -514,11 +514,11 @@ class OvmVm(OvmObject):
else:
scope = 'cfg'
vmPath = OvmHost()._getVmPathFromPrimaryStorage(vmName)
-
+
vmType = OvmVm()._getVmTypeFromConfigFile(vmPath)
if vmType != 'HVM':
raise Exception("Only HVM supports attaching/detaching ISO")
-
+
if not isAttach:
iso = ''
else:
@@ -527,14 +527,14 @@ class OvmVm(OvmObject):
isoOnSecStorage = dirname(iso)
OvmStoragePool()._mount(isoOnSecStorage, isoMountPoint)
iso = join(isoMountPoint, isoName)
-
+
exceptionIfNoSuccess(xen_change_vm_cdrom(vmPath, iso, scope))
return SUCC()
except Exception, e:
errmsg = fmt_err_msg(e)
logger.error(OvmVm.detachOrAttachIso, errmsg)
raise XmlRpcFault(toErrCode(OvmVm, OvmVm.detachOrAttachIso), errmsg)
-
+
if __name__ == "__main__":
import sys
print OvmVm.getDetails(sys.argv[1])
diff --git a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmVolumeModule.py b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmVolumeModule.py
index eb99033..b155276 100755
--- a/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmVolumeModule.py
+++ b/plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmVolumeModule.py
@@ -5,9 +5,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
@@ -34,7 +34,7 @@ class OvmVolumeDecoder(json.JSONDecoder):
setAttrFromDict(vol, 'size', deDict, long)
setAttrFromDict(vol, 'poolUuid', deDict)
return vol
-
+
class OvmVolumeEncoder(json.JSONEncoder):
def default(self, obj):
if not isinstance(obj, OvmVolume): raise Exception("%s is not instance of OvmVolume"%type(obj))
@@ -45,7 +45,7 @@ class OvmVolumeEncoder(json.JSONEncoder):
safeDictSet(obj, dct, 'path')
safeDictSet(obj, dct, 'size')
return dct
-
+
def toOvmVolume(jStr):
return json.loads(jStr, cls=OvmVolumeDecoder)
@@ -58,7 +58,7 @@ class OvmVolume(OvmObject):
poolUuid = ''
path = ''
size = 0
-
+
@staticmethod
def createDataDisk(poolUuid, size, isRoot):
try:
@@ -75,7 +75,7 @@ class OvmVolume(OvmObject):
freeSpace = pool._getSpaceinfoOfDir(path)
if freeSpace < vol.size:
raise Exception("%s has not enough space (available:%s, required:%s"%(path, freeSpace, vol.size))
-
+
vol.uuid = get_uuid()
vol.name = vol.uuid + '.raw'
filePath = join(path, vol.name)
@@ -88,7 +88,7 @@ class OvmVolume(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmVolume.createDataDisk, errmsg)
raise XmlRpcFault(toErrCode(OvmVolume, OvmVolume.createDataDisk, errmsg))
-
+
@staticmethod
def createFromTemplate(poolUuid, templateUrl):
try:
@@ -121,7 +121,7 @@ class OvmVolume(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmVolume.createFromTemplate, errmsg)
raise XmlRpcFault(toErrCode(OvmVolume, OvmVolume.createFromTemplate), errmsg)
-
+
@staticmethod
def destroy(poolUuid, path):
try:
@@ -148,12 +148,11 @@ class OvmVolume(OvmObject):
errmsg = fmt_err_msg(e)
logger.error(OvmVolume.destroy, errmsg)
raise XmlRpcFault(toErrCode(OvmVolume, OvmVolume.destroy), errmsg)
-
-
-
+
+
+
if __name__ == "__main__":
print OvmVolume.detachOrAttachIso(sys.argv[1], '', False)
-
-
-
-
\ No newline at end of file
+
+
+
diff --git a/plugins/network-elements/stratosphere-ssp/sspmock/sspmock.py b/plugins/network-elements/stratosphere-ssp/sspmock/sspmock.py
index 9ac646e..7eb632b 100644
--- a/plugins/network-elements/stratosphere-ssp/sspmock/sspmock.py
+++ b/plugins/network-elements/stratosphere-ssp/sspmock/sspmock.py
@@ -5,9 +5,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
diff --git a/python/bindir/cloud-external-ipallocator.py b/python/bindir/cloud-external-ipallocator.py
index 1033b19..2626e7f 100755
--- a/python/bindir/cloud-external-ipallocator.py
+++ b/python/bindir/cloud-external-ipallocator.py
@@ -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 @@
-
+
import web
import socket, struct
@@ -52,11 +52,11 @@ class dhcp:
start_ip_num = self.ipToNum(dhcp_start);
end_ip_num = self.ipToNum(dhcp_end)
print(start_ip_num, end_ip_num)
-
+
for ip in range(start_ip_num, end_ip_num + 1):
- self.availIP.append(ip)
- print(self.availIP[0], self.availIP[len(self.availIP) - 1])
-
+ self.availIP.append(ip)
+ print(self.availIP[0], self.availIP[len(self.availIP) - 1])
+
#load the ip already allocated
self.reloadAllocatedIP()
@@ -69,7 +69,7 @@ class dhcp:
def getFreeIP(self):
if len(self.availIP) > 0:
ip = self.numToIp(self.availIP[0])
- self.availIP.remove(self.availIP[0])
+ self.availIP.remove(self.availIP[0])
return ip
else:
return None
@@ -88,13 +88,13 @@ class dhcp:
def reloadAllocatedIP(self):
dhcp_hosts = augtool.match("/files/etc/dnsmasq.conf/dhcp-host").stdout.decode('utf-8').strip().splitlines()
-
+
for host in dhcp_hosts:
if host.find("dhcp-host") != -1:
allocatedIP = self.ipToNum(host.split("=")[1].strip().split(",")[1])
- if allocatedIP in self.availIP:
+ if allocatedIP in self.availIP:
self.availIP.remove(allocatedIP)
-
+
def allocateIP(self, mac):
newIP = self.getFreeIP()
dhcp_host = augtool.match("/files/etc/dnsmasq.conf/dhcp-host").stdout.decode('utf-8').strip()
@@ -112,7 +112,7 @@ class dhcp:
for host in dhcp_host.splitlines():
if host.find(ip) != -1:
path = host.split("=")[0].strip()
-
+
if path == None:
print("Can't find " + str(ip) + " in conf file")
return None
@@ -121,9 +121,9 @@ class dhcp:
script = """rm %s
save"""%(path)
augtool < script
-
+
self.availIP.remove(ip)
-
+
#reset dnsmasq
service("dnsmasq", "restart", stdout=None, stderr=None)
@@ -145,7 +145,7 @@ class ipallocator:
if not freeIP:
return "0,0,0"
print("Find an available IP: " + freeIP)
-
+
return freeIP + "," + dhcpInit.getNetmask() + "," + dhcpInit.getRouter()
elif command == "releaseIpAddr":
ip = user_data.ip
diff --git a/python/incubation/cloud-web-ipallocator.py b/python/incubation/cloud-web-ipallocator.py
index 1033b19..2626e7f 100755
--- a/python/incubation/cloud-web-ipallocator.py
+++ b/python/incubation/cloud-web-ipallocator.py
@@ -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 @@
-
+
import web
import socket, struct
@@ -52,11 +52,11 @@ class dhcp:
start_ip_num = self.ipToNum(dhcp_start);
end_ip_num = self.ipToNum(dhcp_end)
print(start_ip_num, end_ip_num)
-
+
for ip in range(start_ip_num, end_ip_num + 1):
- self.availIP.append(ip)
- print(self.availIP[0], self.availIP[len(self.availIP) - 1])
-
+ self.availIP.append(ip)
+ print(self.availIP[0], self.availIP[len(self.availIP) - 1])
+
#load the ip already allocated
self.reloadAllocatedIP()
@@ -69,7 +69,7 @@ class dhcp:
def getFreeIP(self):
if len(self.availIP) > 0:
ip = self.numToIp(self.availIP[0])
- self.availIP.remove(self.availIP[0])
+ self.availIP.remove(self.availIP[0])
return ip
else:
return None
@@ -88,13 +88,13 @@ class dhcp:
def reloadAllocatedIP(self):
dhcp_hosts = augtool.match("/files/etc/dnsmasq.conf/dhcp-host").stdout.decode('utf-8').strip().splitlines()
-
+
for host in dhcp_hosts:
if host.find("dhcp-host") != -1:
allocatedIP = self.ipToNum(host.split("=")[1].strip().split(",")[1])
- if allocatedIP in self.availIP:
+ if allocatedIP in self.availIP:
self.availIP.remove(allocatedIP)
-
+
def allocateIP(self, mac):
newIP = self.getFreeIP()
dhcp_host = augtool.match("/files/etc/dnsmasq.conf/dhcp-host").stdout.decode('utf-8').strip()
@@ -112,7 +112,7 @@ class dhcp:
for host in dhcp_host.splitlines():
if host.find(ip) != -1:
path = host.split("=")[0].strip()
-
+
if path == None:
print("Can't find " + str(ip) + " in conf file")
return None
@@ -121,9 +121,9 @@ class dhcp:
script = """rm %s
save"""%(path)
augtool < script
-
+
self.availIP.remove(ip)
-
+
#reset dnsmasq
service("dnsmasq", "restart", stdout=None, stderr=None)
@@ -145,7 +145,7 @@ class ipallocator:
if not freeIP:
return "0,0,0"
print("Find an available IP: " + freeIP)
-
+
return freeIP + "," + dhcpInit.getNetmask() + "," + dhcpInit.getRouter()
elif command == "releaseIpAddr":
ip = user_data.ip
diff --git a/python/lib/cloudutils/__init__.py b/python/lib/cloudutils/__init__.py
index 978b68a..13a8339 100644
--- a/python/lib/cloudutils/__init__.py
+++ b/python/lib/cloudutils/__init__.py
@@ -5,9 +5,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
diff --git a/python/lib/cloudutils/cloudException.py b/python/lib/cloudutils/cloudException.py
index 9da29c2..5b2105b 100644
--- a/python/lib/cloudutils/cloudException.py
+++ b/python/lib/cloudutils/cloudException.py
@@ -5,9 +5,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
@@ -23,7 +23,7 @@ class CloudRuntimeException(Exception):
value = sys.exc_info()[1]
if value is not None:
self.errMsg += ", due to:" + str(value)
-
+
self.details = formatExceptionInfo()
def __str__(self):
return self.errMsg
diff --git a/python/lib/cloudutils/configFileOps.py b/python/lib/cloudutils/configFileOps.py
index ecc437d..698f2b3 100644
--- a/python/lib/cloudutils/configFileOps.py
+++ b/python/lib/cloudutils/configFileOps.py
@@ -5,9 +5,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
@@ -27,7 +27,7 @@ class configFileOps:
self.op = op
self.separator = separator
def setState(self, state):
- self.state = state
+ self.state = state
def getState(self):
return self.state
@@ -35,18 +35,18 @@ class configFileOps:
self.fileName = fileName
self.entries = []
self.backups = []
-
+
if cfg is not None:
cfg.cfoHandlers.append(self)
def addEntry(self, name, value, separator="="):
e = self.entry(name, value, "add", separator)
self.entries.append(e)
-
+
def rmEntry(self, name, value, separator="="):
entry = self.entry(name, value, "rm", separator)
self.entries.append(entry)
-
+
def getEntry(self, name, separator="="):
try:
ctx = open(self.fileName).read(-1)
@@ -74,7 +74,7 @@ class configFileOps:
matchString = "^\ *" + entry.name + "\ *=\ *" + entry.value
else:
matchString = "^\ *" + entry.name + "\ *" + entry.value
-
+
match = re.match(matchString, line)
if match is not None:
if entry.op == "add" and entry.separator == "=":
@@ -88,9 +88,9 @@ class configFileOps:
entry.setState("set")
self.backups.append([line, None])
matched = True
- break
-
- if not matched:
+ break
+
+ if not matched:
newLines.append(line)
for entry in self.entries:
@@ -102,7 +102,7 @@ class configFileOps:
entry.setState("set")
fp.close()
-
+
open(self.fileName, "w").writelines(newLines)
def replace_line(self, startswith,stanza,always_add=False):
@@ -126,18 +126,18 @@ class configFileOps:
return self.replace_line(startswith,stanza,always_add=True)
def add_lines(self, lines, addToBackup=True):
- fp = open(self.fileName).read(-1)
+ fp = open(self.fileName).read(-1)
sh = re.escape(lines)
- match = re.search(sh, fp, re.MULTILINE)
+ match = re.search(sh, fp, re.MULTILINE)
if match is not None:
return
-
+
fp += lines
open(self.fileName, "w").write(fp)
self.backups.append([None, lines])
-
+
def replace_lines(self, src, dst, addToBackup=True):
- fp = open(self.fileName).read(-1)
+ fp = open(self.fileName).read(-1)
sh = re.escape(src)
if dst is None:
dst = ""
@@ -168,7 +168,7 @@ class configFileOps:
newlines.append(line)
open(self.fileName, "w").writelines(newlines)
-
+
def backup(self):
for oldLine, newLine in self.backups:
if newLine is None:
diff --git a/python/lib/cloudutils/networkConfig.py b/python/lib/cloudutils/networkConfig.py
index 5a357c0..6a18b28 100644
--- a/python/lib/cloudutils/networkConfig.py
+++ b/python/lib/cloudutils/networkConfig.py
@@ -5,9 +5,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
@@ -32,16 +32,16 @@ class networkConfig:
self.type = type
self.name = name
#dhcp or static
- self.method = None
-
+ self.method = None
+
@staticmethod
def listNetworks():
- devs = os.listdir("/sys/class/net/")
- devs = list(filter(networkConfig.isBridge, devs))
+ devs = os.listdir("/sys/class/net/")
+ devs = list(filter(networkConfig.isBridge, devs))
return devs
@staticmethod
def getDefaultNetwork():
- cmd = bash("route -n|awk \'/^0.0.0.0/ {print $2,$8}\'")
+ cmd = bash("route -n|awk \'/^0.0.0.0/ {print $2,$8}\'")
if not cmd.isSuccess():
logging.debug("Failed to get default route")
raise CloudRuntimeException("Failed to get default route")
@@ -67,7 +67,7 @@ class networkConfig:
cmds = ""
if not networkConfig.isBridge(brName):
cmds = "ip link add name %s type bridge ;"%brName
-
+
cmds += "ifconfig %s up;"%brName
cmds += "ip link set dev %s master %s"%(dev, brName)
return bash(cmds).isSuccess()
@@ -75,10 +75,10 @@ class networkConfig:
@staticmethod
def isBridgeEnslavedWithDevices(brName):
if not networkConfig.isBridge(brName):
- return False
+ return False
if not os.listdir("/sys/class/net/%s/brif"%brName):
- return False
+ return False
return True
@@ -96,7 +96,7 @@ class networkConfig:
@staticmethod
def isBridgePort(devName):
return os.path.exists("/sys/class/net/%s/brport" % devName)
-
+
@staticmethod
def isBridge(devName):
return os.path.exists("/sys/class/net/%s/bridge" % devName)
@@ -116,7 +116,7 @@ class networkConfig:
bridgeName = None
if os.path.exists("/sys/class/net/%s/brport/bridge"%devName):
realPath = os.path.realpath("/sys/class/net/%s/brport/bridge"%devName)
- bridgeName = realPath.split("/")[-1]
+ bridgeName = realPath.split("/")[-1]
return bridgeName
@staticmethod
@@ -130,7 +130,7 @@ class networkConfig:
return dev
return None
-
+
@staticmethod
def getDevInfo(dev):
if not networkConfig.isNetworkDev(dev):
diff --git a/scripts/network/exdhcp/dhcpd_edithosts.py b/scripts/network/exdhcp/dhcpd_edithosts.py
index ec64f80..97bccd8 100644
--- a/scripts/network/exdhcp/dhcpd_edithosts.py
+++ b/scripts/network/exdhcp/dhcpd_edithosts.py
@@ -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
@@ -38,7 +38,7 @@ def lock():
if count > sleep_max:
print "Can not get file lock at %s, time expired" % file_lock
return False
-
+
try:
f = open(file_lock, "w")
f.close()
@@ -104,7 +104,7 @@ if __name__ == "__main__":
if len(sys.argv) < 7:
print usage
sys.exit(1)
-
+
mac = sys.argv[1]
ip = sys.argv[2]
hostname = sys.argv[3]
diff --git a/scripts/network/ping/baremetal_user_data.py b/scripts/network/ping/baremetal_user_data.py
index 24391f7..5a18935 100755
--- a/scripts/network/ping/baremetal_user_data.py
+++ b/scripts/network/ping/baremetal_user_data.py
@@ -5,9 +5,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
@@ -41,12 +41,12 @@ def writeIfNotHere(fileName, texts):
if not t in entries:
entries.append(t)
need = True
-
- if need:
+
+ if need:
f = open(fileName, 'w')
f.write(''.join(entries))
f.close()
-
+
def createRedirectEntry(vmIp, folder, filename):
entry = "RewriteRule ^%s$ ../%s/%%{REMOTE_ADDR}/%s [L,NC,QSA]" % (filename, folder, filename)
htaccessFolder="/var/www/html/latest"
@@ -54,7 +54,7 @@ def createRedirectEntry(vmIp, folder, filename):
if not os.path.exists(htaccessFolder):
os.makedirs(htaccessFolder)
writeIfNotHere(htaccessFile, ["Options +FollowSymLinks", "RewriteEngine On", entry])
-
+
htaccessFolder = os.path.join("/var/www/html/", folder, vmIp)
if not os.path.exists(htaccessFolder):
os.makedirs(htaccessFolder)
@@ -63,23 +63,23 @@ def createRedirectEntry(vmIp, folder, filename):
f = open(htaccessFile, 'w')
f.write(entry)
f.close()
-
+
if folder in ['metadata', 'meta-data']:
entry1="RewriteRule ^meta-data/(.+)$ ../%s/%%{REMOTE_ADDR}/$1 [L,NC,QSA]" % folder
htaccessFolder="/var/www/html/latest"
htaccessFile=os.path.join(htaccessFolder, ".htaccess")
entry2="RewriteRule ^meta-data/$ ../%s/%%{REMOTE_ADDR}/meta-data [L,NC,QSA]" % folder
writeIfNotHere(htaccessFile, [entry1, entry2])
-
+
def addUserData(vmIp, folder, fileName, contents):
-
+
baseFolder = os.path.join(HTML_ROOT, folder, vmIp)
if not os.path.exists(baseFolder):
os.makedirs(baseFolder)
-
+
createRedirectEntry(vmIp, folder, fileName)
-
+
datafileName = os.path.join(HTML_ROOT, folder, vmIp, fileName)
metaManifest = os.path.join(HTML_ROOT, folder, vmIp, "meta-data")
if folder == "userdata":
@@ -87,11 +87,11 @@ def addUserData(vmIp, folder, fileName, contents):
contents = base64.urlsafe_b64decode(contents)
else:
contents = ""
-
+
f = open(datafileName, 'w')
- f.write(contents)
+ f.write(contents)
f.close()
-
+
if folder == "metadata" or folder == "meta-data":
writeIfNotHere(metaManifest, [fileName])
@@ -101,4 +101,4 @@ if __name__ == '__main__':
for entry in allEntires:
(vmIp, folder, fileName, contents) = entry.split(',', 3)
addUserData(vmIp, folder, fileName, contents)
- sys.exit(0)
+ sys.exit(0)
diff --git a/scripts/network/ping/prepare_kickstart_bootfile.py b/scripts/network/ping/prepare_kickstart_bootfile.py
index 4378293..27baece 100755
--- a/scripts/network/ping/prepare_kickstart_bootfile.py
+++ b/scripts/network/ping/prepare_kickstart_bootfile.py
@@ -9,12 +9,12 @@
# 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.
-#
+#
# Automatically generated by addcopyright.py at 04/03/2012
-
+
# Usage: prepare_tftp_bootfile.py tftp_dir mac cifs_server share directory image_to_restore cifs_username cifs_password
import os, sys
@@ -28,7 +28,7 @@ TIMEOUT 26
DISPLAY boot.msg
LABEL default
KERNEL %s
-APPEND ramdisk_size=66000 initrd=%s ksdevice=%s ks=%s
+APPEND ramdisk_size=66000 initrd=%s ksdevice=%s ks=%s
'''
fmt2 = '''DEFAULT default
PROMPT 1
@@ -73,6 +73,6 @@ if __name__ == "__main__":
exit(1)
(tftp_dir, mac, kernel, initrd, ks_file, ks_device) = sys.argv[1:]
-
+
ret = prepare()
exit(ret)
diff --git a/scripts/network/ping/prepare_kickstart_kernel_initrd.py b/scripts/network/ping/prepare_kickstart_kernel_initrd.py
index ff61848..116d179 100755
--- a/scripts/network/ping/prepare_kickstart_kernel_initrd.py
+++ b/scripts/network/ping/prepare_kickstart_kernel_initrd.py
@@ -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
@@ -29,7 +29,7 @@ def cmd(cmdstr, err=True):
print cmdstr
if os.system(cmdstr) != 0 and err:
raise Exception("Failed to run shell command: %s" % cmdstr)
-
+
def prepare():
global kernel, initrd, copy_to
try:
@@ -64,12 +64,12 @@ def prepare():
except Exception, e:
print e
return 1
-
+
if __name__ == "__main__":
if len(sys.argv) < 4:
print "Usage: prepare_kickstart_kerneal_initrd.py path_to_kernel path_to_initrd path_kernel_initrd_copy_to"
sys.exit(1)
-
+
(kernel, initrd, copy_to) = sys.argv[1:]
sys.exit(prepare())
-
+
diff --git a/scripts/network/ping/prepare_tftp_bootfile.py b/scripts/network/ping/prepare_tftp_bootfile.py
index fe9bd9b..00d8bb0 100644
--- a/scripts/network/ping/prepare_tftp_bootfile.py
+++ b/scripts/network/ping/prepare_tftp_bootfile.py
@@ -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
@@ -83,7 +83,7 @@ if __name__ == "__main__":
exit(1)
(cmd, tftp_dir, mac, cifs_server, share, directory, template_dir, cifs_username, cifs_password, ip, netmask, gateway) = sys.argv[1:]
-
+
if cmd == "restore":
ret = prepare(True)
elif cmd == "backup":
@@ -91,5 +91,5 @@ if __name__ == "__main__":
else:
print "Unknown cmd: %s"%cmd
ret = 1
-
+
exit(ret)
diff --git a/scripts/util/ipmi.py b/scripts/util/ipmi.py
index c9e9a66..2b5c36c 100755
--- a/scripts/util/ipmi.py
+++ b/scripts/util/ipmi.py
@@ -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
@@ -16,7 +16,7 @@
# specific language governing permissions and limitations
# under the License.
-
+
import sys, os, subprocess, errno, re
@@ -72,7 +72,7 @@ class Command:
else: return l
def __str__(self):
return '<Command %r>'%self.__get_recursive_name(sep=" ")
-
+
def __repr__(self): return self.__str__()
@@ -134,13 +134,13 @@ def reboot(args):
if o.ret:
print o.stderr
return 1
-
+
if "is on" in o.stdout:
o = ipmitool("-H", hostname, "-U", usrname, "-P", password, "chassis", "power", "cycle")
else:
o = ipmitool("-H", hostname, "-U", usrname, "-P", password, "chassis", "power", "reset")
-
+
if o.ret:
print o.stderr
return 1
@@ -172,7 +172,7 @@ def boot_or_reboot(args):
if o.ret:
print o.stderr
return 1
-
+
if "is on" in o.stdout:
return reboot(args)
elif "is off" in o.stdout:
@@ -181,7 +181,7 @@ def boot_or_reboot(args):
else:
print "unknown power status:" + o.stdout
return 1
-
+
call_table = {"ping":ping, "boot_dev":boot_dev, "reboot":reboot, "power":power, "boot_or_reboot":boot_or_reboot}
def dispatch(args):
diff --git a/scripts/util/macgen.py b/scripts/util/macgen.py
index 55a45c9..ab3c777 100755
--- a/scripts/util/macgen.py
+++ b/scripts/util/macgen.py
@@ -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
@@ -16,7 +16,7 @@
# specific language governing permissions and limitations
# under the License.
-
+
# $Id: macgen.py 9132 2010-06-04 20:17:43Z manuel $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/util/macgen.py $
# macgen.py script to generate a MAC address for Red Hat Virtualization guests
diff --git a/scripts/vm/hypervisor/vmware/discover_networks.py b/scripts/vm/hypervisor/vmware/discover_networks.py
index 0a401e1..8f58fee 100755
--- a/scripts/vm/hypervisor/vmware/discover_networks.py
+++ b/scripts/vm/hypervisor/vmware/discover_networks.py
@@ -47,14 +47,14 @@ def get_clusters(content, cluster=None):
clusters.append(c)
hosts = c.host
for host in hosts:
- hostClusterNameDict[host.name] = c.name
+ hostClusterNameDict[host.name] = c.name
break
else:
for c in cluster_view.view:
clusters.append(c)
hosts = c.host
for host in hosts:
- hostClusterNameDict[host.name] = c.name
+ hostClusterNameDict[host.name] = c.name
cluster_view.Destroy()
log_message('\t{} cluster(s) found'.format(len(clusters)))
for c in clusters:
@@ -187,7 +187,7 @@ def add_network(portGroup, vlanId, isolatedPvlanType, isolatedPvlan, vSwitch, vm
cluster = hostClusterNameDict[host]
except KeyError:
cluster = vmClusterName
-
+
network = {"portgroup": portGroup, "cluster": cluster, "host": host, "switch": vSwitch, "virtualmachines": vms}
if vlanId != '':
network["vlanid"] = vlanId
@@ -267,7 +267,7 @@ def main():
content = serviceInstance.RetrieveContent()
if args.cluster:
clusters = get_clusters(content, args.cluster)
- else:
+ else:
clusters = get_clusters(content)
hosts = []
if len(clusters) > 0:
diff --git a/scripts/vm/hypervisor/xenserver/cloudstack_pluginlib.py b/scripts/vm/hypervisor/xenserver/cloudstack_pluginlib.py
index 926c5c8..1b3a58c 100644
--- a/scripts/vm/hypervisor/xenserver/cloudstack_pluginlib.py
+++ b/scripts/vm/hypervisor/xenserver/cloudstack_pluginlib.py
@@ -5,9 +5,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
diff --git a/scripts/vm/hypervisor/xenserver/mockxcpplugin.py b/scripts/vm/hypervisor/xenserver/mockxcpplugin.py
index 0de24ca..f7c8437 100644
--- a/scripts/vm/hypervisor/xenserver/mockxcpplugin.py
+++ b/scripts/vm/hypervisor/xenserver/mockxcpplugin.py
@@ -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
diff --git a/scripts/vm/hypervisor/xenserver/ovs-vif-flows.py b/scripts/vm/hypervisor/xenserver/ovs-vif-flows.py
index 62601bf..b3d3917 100644
--- a/scripts/vm/hypervisor/xenserver/ovs-vif-flows.py
+++ b/scripts/vm/hypervisor/xenserver/ovs-vif-flows.py
@@ -5,9 +5,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
@@ -86,7 +86,7 @@ def main(command, vif_raw):
return
bridge = pluginlib.do_cmd([pluginlib.VSCTL_PATH, 'iface-to-br', this_vif])
-
+
# find xs network for this bridge, verify is used for ovs tunnel network
xs_nw_uuid = pluginlib.do_cmd([pluginlib.XE_PATH, "network-list",
"bridge=%s" % bridge, "--minimal"])
diff --git a/scripts/vm/hypervisor/xenserver/perfmon.py b/scripts/vm/hypervisor/xenserver/perfmon.py
index eb14e32..e4b0101 100755
--- a/scripts/vm/hypervisor/xenserver/perfmon.py
+++ b/scripts/vm/hypervisor/xenserver/perfmon.py
@@ -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
@@ -87,7 +87,7 @@ class RRDUpdates:
return result
def get_vm_data(self, uuid, param, row):
- #pp = pprint.PrettyPrinter(indent=4)
+ #pp = pprint.PrettyPrinter(indent=4)
#pp.pprint(self.vm_reports)
report = self.vm_reports[uuid]
col = report[param]
diff --git a/scripts/vm/hypervisor/xenserver/xcposs/NFSSR.py b/scripts/vm/hypervisor/xenserver/xcposs/NFSSR.py
index 627fed2..306f941 100644
--- a/scripts/vm/hypervisor/xenserver/xcposs/NFSSR.py
+++ b/scripts/vm/hypervisor/xenserver/xcposs/NFSSR.py
@@ -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
@@ -36,7 +36,7 @@ CAPABILITIES = ["SR_PROBE","SR_UPDATE", "SR_CACHING", \
CONFIGURATION = [ [ 'server', 'hostname or IP address of NFS server (required)' ], \
[ 'serverpath', 'path on remote server (required)' ] ]
-
+
DRIVER_INFO = {
'name': 'NFS VHD',
'description': 'SR plugin which stores disks as VHD files on a remote NFS filesystem',
@@ -123,7 +123,7 @@ class NFSSR(FileSR.FileSR):
def probe(self):
# Verify NFS target and port
util._testHost(self.dconf['server'], NFSPORT, 'NFSTarget')
-
+
self.validate_remotepath(True)
self.check_server()
@@ -155,7 +155,7 @@ class NFSSR(FileSR.FileSR):
raise xs_errors.XenError('NFSUnMount', opterr=exc.errstr)
return super(NFSSR, self).detach(sr_uuid)
-
+
def create(self, sr_uuid, size):
util._testHost(self.dconf['server'], NFSPORT, 'NFSTarget')
@@ -186,8 +186,8 @@ class NFSSR(FileSR.FileSR):
# except util.CommandException, inst:
# if inst.code != errno.EEXIST:
# self.detach(sr_uuid)
- # raise xs_errors.XenError('NFSCreate',
- # opterr='remote directory creation error is %d'
+ # raise xs_errors.XenError('NFSCreate',
+ # opterr='remote directory creation error is %d'
# % inst.code)
self.detach(sr_uuid)
@@ -216,7 +216,7 @@ class NFSSR(FileSR.FileSR):
if not loadLocked:
return NFSFileVDI(self, uuid)
return NFSFileVDI(self, uuid)
-
+
def _checkmount(self):
return util.ioretry(lambda: util.pathexists(self.path)) \
and util.ioretry(lambda: util.ismount(self.path))
diff --git a/scripts/vm/hypervisor/xenserver/xcpserver/NFSSR.py b/scripts/vm/hypervisor/xenserver/xcpserver/NFSSR.py
index 11f0491..62031e3 100755
--- a/scripts/vm/hypervisor/xenserver/xcpserver/NFSSR.py
+++ b/scripts/vm/hypervisor/xenserver/xcpserver/NFSSR.py
@@ -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
@@ -36,7 +36,7 @@ CAPABILITIES = ["SR_PROBE","SR_UPDATE", "SR_CACHING", \
CONFIGURATION = [ [ 'server', 'hostname or IP address of NFS server (required)' ], \
[ 'serverpath', 'path on remote server (required)' ] ]
-
+
DRIVER_INFO = {
'name': 'NFS VHD',
'description': 'SR plugin which stores disks as VHD files on a remote NFS filesystem',
@@ -123,7 +123,7 @@ class NFSSR(FileSR.FileSR):
def probe(self):
# Verify NFS target and port
util._testHost(self.dconf['server'], NFSPORT, 'NFSTarget')
-
+
self.validate_remotepath(True)
self.check_server()
@@ -155,7 +155,7 @@ class NFSSR(FileSR.FileSR):
raise xs_errors.XenError('NFSUnMount', opterr=exc.errstr)
return super(NFSSR, self).detach(sr_uuid)
-
+
def create(self, sr_uuid, size):
util._testHost(self.dconf['server'], NFSPORT, 'NFSTarget')
@@ -186,8 +186,8 @@ class NFSSR(FileSR.FileSR):
# except util.CommandException, inst:
# if inst.code != errno.EEXIST:
# self.detach(sr_uuid)
- # raise xs_errors.XenError('NFSCreate',
- # opterr='remote directory creation error is %d'
+ # raise xs_errors.XenError('NFSCreate',
+ # opterr='remote directory creation error is %d'
# % inst.code)
self.detach(sr_uuid)
@@ -216,7 +216,7 @@ class NFSSR(FileSR.FileSR):
if not loadLocked:
return NFSFileVDI(self, uuid)
return NFSFileVDI(self, uuid)
-
+
def _checkmount(self):
return util.ioretry(lambda: util.pathexists(self.path)) \
and util.ioretry(lambda: util.ismount(self.path))
diff --git a/scripts/vm/hypervisor/xenserver/xenserver56/InterfaceReconfigure.py b/scripts/vm/hypervisor/xenserver/xenserver56/InterfaceReconfigure.py
index 3723ef2..2807f70 100755
--- a/scripts/vm/hypervisor/xenserver/xenserver56/InterfaceReconfigure.py
+++ b/scripts/vm/hypervisor/xenserver/xenserver56/InterfaceReconfigure.py
@@ -5,9 +5,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
@@ -339,12 +339,12 @@ def db_init_from_cache(cache):
global _db
assert(_db is None)
_db = DatabaseCache(cache_file=cache)
-
+
def db_init_from_xenapi(session):
- global _db
+ global _db
assert(_db is None)
_db = DatabaseCache(session_ref=session)
-
+
class DatabaseCache(object):
def __read_xensource_inventory(self):
filename = root_prefix() + "/etc/xensource-inventory"
@@ -626,7 +626,7 @@ def ethtool_settings(oc):
# {VIF,PIF,Network}.other-config:mtu.
#
# type parameter is a string describing the object that the oc parameter
-# is from. e.g. "PIF", "Network"
+# is from. e.g. "PIF", "Network"
def mtu_setting(nw, type, oc):
mtu = None
@@ -635,7 +635,7 @@ def mtu_setting(nw, type, oc):
mtu = nwrec['MTU']
else:
mtu = "1500"
-
+
if oc.has_key('mtu'):
log("Override Network.MTU setting on bridge %s from %s.MTU is %s" % \
(nwrec['bridge'], type, mtu))
@@ -796,7 +796,7 @@ class Datapath(object):
datapath for a given PIF. Does not include configuration of the
IP address on the ipdev.
"""
-
+
def __init__(self, pif):
self._pif = pif
@@ -804,7 +804,7 @@ class Datapath(object):
"""Write ifcfg TYPE field for an IPdev, plus any type specific
fields to cfg
"""
- raise NotImplementedError
+ raise NotImplementedError
def preconfigure(self, parent):
"""Prepare datapath configuration for PIF, but do not actually
@@ -813,7 +813,7 @@ class Datapath(object):
Any configuration files should be attached to parent.
"""
raise NotImplementedError
-
+
def bring_down_existing(self):
"""Tear down any existing network device configuration which
needs to be undone in order to bring this PIF up.
@@ -831,7 +831,7 @@ class Datapath(object):
Should not bring up the IPdev.
"""
raise NotImplementedError
-
+
def post(self):
"""Called after the IPdev has been brought up.
@@ -846,17 +846,17 @@ class Datapath(object):
IPdev has already been brought down.
"""
raise NotImplementedError
-
+
def DatapathFactory(pif):
# XXX Need a datapath object for bridgeless PIFs
try:
network_conf = open(root_prefix() + "/etc/xensource/network.conf", 'r')
network_backend = network_conf.readline().strip()
- network_conf.close()
+ network_conf.close()
except Exception, e:
raise Error("failed to determine network backend:" + e)
-
+
if network_backend == "bridge":
from InterfaceReconfigureBridge import DatapathBridge
return DatapathBridge(pif)
diff --git a/scripts/vm/hypervisor/xenserver/xenserver56/NFSSR.py b/scripts/vm/hypervisor/xenserver/xenserver56/NFSSR.py
index a9cd58d..b8489e7 100755
--- a/scripts/vm/hypervisor/xenserver/xenserver56/NFSSR.py
+++ b/scripts/vm/hypervisor/xenserver/xenserver56/NFSSR.py
@@ -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
@@ -36,7 +36,7 @@ CAPABILITIES = ["SR_PROBE","SR_UPDATE", \
CONFIGURATION = [ [ 'server', 'hostname or IP address of NFS server (required)' ], \
[ 'serverpath', 'path on remote server (required)' ] ]
-
+
DRIVER_INFO = {
'name': 'NFS VHD',
'description': 'SR plugin which stores disks as VHD files on a remote NFS filesystem',
@@ -124,7 +124,7 @@ class NFSSR(FileSR.FileSR):
def probe(self):
# Verify NFS target and port
util._testHost(self.dconf['server'], NFSPORT, 'NFSTarget')
-
+
self.validate_remotepath(True)
self.check_server()
@@ -157,7 +157,7 @@ class NFSSR(FileSR.FileSR):
raise xs_errors.XenError('NFSUnMount', opterr=exc.errstr)
return super(NFSSR, self).detach(sr_uuid)
-
+
@FileSR.locking("SRUnavailable")
def create(self, sr_uuid, size):
@@ -189,8 +189,8 @@ class NFSSR(FileSR.FileSR):
# except util.CommandException, inst:
# if inst.code != errno.EEXIST:
# self.detach(sr_uuid)
- # raise xs_errors.XenError('NFSCreate',
- # opterr='remote directory creation error is %d'
+ # raise xs_errors.XenError('NFSCreate',
+ # opterr='remote directory creation error is %d'
# % inst.code)
self.detach(sr_uuid)
@@ -220,7 +220,7 @@ class NFSSR(FileSR.FileSR):
if not loadLocked:
return NFSFileVDINolock(self, uuid)
return NFSFileVDI(self, uuid)
-
+
def _checkmount(self):
return util.ioretry(lambda: util.pathexists(self.path)) \
and util.ioretry(lambda: util.ismount(self.path))
diff --git a/scripts/vm/hypervisor/xenserver/xenserver56fp1/NFSSR.py b/scripts/vm/hypervisor/xenserver/xenserver56fp1/NFSSR.py
index 290c587..b8c1157 100755
--- a/scripts/vm/hypervisor/xenserver/xenserver56fp1/NFSSR.py
+++ b/scripts/vm/hypervisor/xenserver/xenserver56fp1/NFSSR.py
@@ -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
@@ -37,7 +37,7 @@ CAPABILITIES = ["SR_PROBE","SR_UPDATE", "SR_CACHING", \
CONFIGURATION = [ [ 'server', 'hostname or IP address of NFS server (required)' ], \
[ 'serverpath', 'path on remote server (required)' ] ]
-
+
DRIVER_INFO = {
'name': 'NFS VHD',
'description': 'SR plugin which stores disks as VHD files on a remote NFS filesystem',
@@ -124,7 +124,7 @@ class NFSSR(FileSR.FileSR):
def probe(self):
# Verify NFS target and port
util._testHost(self.dconf['server'], NFSPORT, 'NFSTarget')
-
+
self.validate_remotepath(True)
self.check_server()
@@ -156,7 +156,7 @@ class NFSSR(FileSR.FileSR):
raise xs_errors.XenError('NFSUnMount', opterr=exc.errstr)
return super(NFSSR, self).detach(sr_uuid)
-
+
def create(self, sr_uuid, size):
util._testHost(self.dconf['server'], NFSPORT, 'NFSTarget')
@@ -187,8 +187,8 @@ class NFSSR(FileSR.FileSR):
# except util.CommandException, inst:
# if inst.code != errno.EEXIST:
# self.detach(sr_uuid)
- # raise xs_errors.XenError('NFSCreate',
- # opterr='remote directory creation error is %d'
+ # raise xs_errors.XenError('NFSCreate',
+ # opterr='remote directory creation error is %d'
# % inst.code)
self.detach(sr_uuid)
@@ -217,7 +217,7 @@ class NFSSR(FileSR.FileSR):
if not loadLocked:
return NFSFileVDI(self, uuid)
return NFSFileVDI(self, uuid)
-
+
def _checkmount(self):
return util.ioretry(lambda: util.pathexists(self.path)) \
and util.ioretry(lambda: util.ismount(self.path))
diff --git a/scripts/vm/hypervisor/xenserver/xenserver60/NFSSR.py b/scripts/vm/hypervisor/xenserver/xenserver60/NFSSR.py
index 0d6badb..9a3fa8b 100755
--- a/scripts/vm/hypervisor/xenserver/xenserver60/NFSSR.py
+++ b/scripts/vm/hypervisor/xenserver/xenserver60/NFSSR.py
@@ -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
@@ -38,7 +38,7 @@ CAPABILITIES = ["SR_PROBE","SR_UPDATE", "SR_CACHING",
CONFIGURATION = [ [ 'server', 'hostname or IP address of NFS server (required)' ], \
[ 'serverpath', 'path on remote server (required)' ] ]
-
+
DRIVER_INFO = {
'name': 'NFS VHD',
'description': 'SR plugin which stores disks as VHD files on a remote NFS filesystem',
@@ -129,7 +129,7 @@ class NFSSR(FileSR.FileSR):
def probe(self):
# Verify NFS target and port
util._testHost(self.dconf['server'], NFSPORT, 'NFSTarget')
-
+
self.validate_remotepath(True)
self.check_server()
@@ -161,7 +161,7 @@ class NFSSR(FileSR.FileSR):
raise xs_errors.XenError('NFSUnMount', opterr=exc.errstr)
return super(NFSSR, self).detach(sr_uuid)
-
+
def create(self, sr_uuid, size):
util._testHost(self.dconf['server'], NFSPORT, 'NFSTarget')
@@ -192,8 +192,8 @@ class NFSSR(FileSR.FileSR):
# except util.CommandException, inst:
# if inst.code != errno.EEXIST:
# self.detach(sr_uuid)
- # raise xs_errors.XenError('NFSCreate',
- # opterr='remote directory creation error is %d'
+ # raise xs_errors.XenError('NFSCreate',
+ # opterr='remote directory creation error is %d'
# % inst.code)
self.detach(sr_uuid)
@@ -222,7 +222,7 @@ class NFSSR(FileSR.FileSR):
if not loadLocked:
return NFSFileVDI(self, uuid)
return NFSFileVDI(self, uuid)
-
+
def _checkmount(self):
return util.ioretry(lambda: util.pathexists(self.path)) \
and util.ioretry(lambda: util.ismount(self.path))
diff --git a/scripts/vm/network/vnet/cloudstack_pluginlib.py b/scripts/vm/network/vnet/cloudstack_pluginlib.py
index 8d036fb..e5022ae 100755
--- a/scripts/vm/network/vnet/cloudstack_pluginlib.py
+++ b/scripts/vm/network/vnet/cloudstack_pluginlib.py
@@ -5,9 +5,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
diff --git a/scripts/vm/network/vnet/ovstunnel.py b/scripts/vm/network/vnet/ovstunnel.py
index ebb7215..92e2f62 100755
--- a/scripts/vm/network/vnet/ovstunnel.py
+++ b/scripts/vm/network/vnet/ovstunnel.py
@@ -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
diff --git a/test/integration/__init__.py b/test/integration/__init__.py
index 978b68a..13a8339 100644
--- a/test/integration/__init__.py
+++ b/test/integration/__init__.py
@@ -5,9 +5,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
diff --git a/test/integration/broken/maint/test_escalation_templates.py b/test/integration/broken/maint/test_escalation_templates.py
index 1d0824a..63898e8 100644
--- a/test/integration/broken/maint/test_escalation_templates.py
+++ b/test/integration/broken/maint/test_escalation_templates.py
@@ -108,8 +108,8 @@ class TestlistTemplates(cloudstackTestCase):
name,value )
self.RestartServers()
time.sleep(self.testdata["sleep"])
-
-
+
+
@attr(tags=["advanced", "basic"], required_hardware="true")
def test_01_CS40139_listtemplate_with_different_pagesize(self):
"""
@@ -135,7 +135,7 @@ class TestlistTemplates(cloudstackTestCase):
domainid=self.domain.id,
max=1000
)
-
+
for i in range(0, 850):
template_created = Template.register(
self.apiclient,
@@ -219,7 +219,7 @@ class TestlistTemplates(cloudstackTestCase):
"""
self.updateConfigurAndRestart("allow.public.user.templates", "false")
-
+
user_account = Account.create(
self.apiclient,
self.testdata["account2"],
diff --git a/test/integration/broken/maint/test_vpc_host_maintenance.py b/test/integration/broken/maint/test_vpc_host_maintenance.py
index 37dc950..5d1f3e8 100644
--- a/test/integration/broken/maint/test_vpc_host_maintenance.py
+++ b/test/integration/broken/maint/test_vpc_host_maintenance.py
@@ -456,7 +456,7 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
Host.update(self.apiclient, id=self.hosts[0].id, hosttags="hosttag1,hosttag2")
Host.update(self.apiclient, id=self.hosts[1].id, hosttags="hosttag1,hosttag2")
-
+
self.validate_vm_deployment()
self.debug("Stop the host on which the VPC virtual router is running")
try:
@@ -477,11 +477,11 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
True,
"List routers shall return a valid VPCVR for account"
)
-
+
router = routers[0]
-
+
try:
-
+
timeout = self.services["timeout"]
self.debug("Timeout Value %d : " % timeout)
while True:
@@ -490,7 +490,7 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
id = router.id,
state = "Running"
)
-
+
if list_router_response is not None:
break
elif timeout == 0:
@@ -499,12 +499,12 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
time.sleep(self.services["sleep"])
timeout = timeout - 1
self.debug("Waiting for %d seconds - %d tries left" % (self.services["sleep"],timeout))
-
+
self.debug("Verified that the Router is in Running State")
-
+
except Exception as e:
self.fail("Failed to find the Router in Running state %s " % e)
-
+
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
@@ -537,7 +537,7 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
# 1. Successfully cancel the Maintenance mode on the host.
# 2. Migrate the VMs back successfully onto the host.
# 3. Check that the network connectivity exists with the migrated VMs.
-
+
try:
timeout = self.services["timeout"]
while True:
@@ -545,7 +545,7 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
self.apiclient,
id=self.vpcvr.hostid,
resourcestate="Maintenance")
-
+
if list_host_response is not None:
break
elif timeout == 0:
@@ -553,9 +553,9 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
time.sleep(self.services["sleep"])
timeout = timeout - 1
-
+
self.debug("Verified that the Host is in Maintenance State")
-
+
except:
self.fail("Failed to find the Host in maintenance state")
@@ -569,7 +569,7 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
self.apiclient,
id=self.vpcvr.hostid,
state="Up")
-
+
if list_host_response is not None:
break
elif timeout == 0:
@@ -577,9 +577,9 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
time.sleep(self.services["sleep"])
timeout = timeout - 1
-
+
self.debug("Verified that the Host is in Up State after Canceling Maintenance Mode")
-
+
except Exception as e:
self.fail("Failed to cancel maintenance mode on host: %s" % e)
@@ -626,13 +626,13 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
# effected due to reconnection.
try:
- timeout = self.services["timeout"]
+ timeout = self.services["timeout"]
while True:
list_host_response = Host.list(
self.apiclient,
id=self.vpcvr.hostid,
resourcestate="Enabled")
-
+
if list_host_response is not None:
break
elif timeout == 0:
@@ -640,9 +640,9 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
time.sleep(self.services["sleep"])
timeout = timeout - 1
-
+
self.debug("Verified that the Host is in Up State")
-
+
except:
self.fail("Failed to find the Host in Up State")
diff --git a/test/integration/broken/misc/test_vm_sync.py b/test/integration/broken/misc/test_vm_sync.py
index 6f2f4e9..c26127d 100644
--- a/test/integration/broken/misc/test_vm_sync.py
+++ b/test/integration/broken/misc/test_vm_sync.py
@@ -137,7 +137,7 @@ class TestDeployVMSync(cloudstackTestCase):
list_vms = VirtualMachine.list(self.apiclient, ids=[self.vm1.id, self.vm2.id, self.vm3.id], listAll=True)
self.assertTrue(isinstance(list_vms, list) and len(list_vms) == 3, msg = "List VM response is empty")
- for vm in list_vms:
+ for vm in list_vms:
if vm.id == self.vm1.id:
self.assertTrue(vm.state == "Running", msg = "VM {0} is expected to be in running state".format(vm.name))
elif vm.id == self.vm2.id or vm.id == self.vm3.id:
diff --git a/test/integration/broken/test_vpn_service.py b/test/integration/broken/test_vpn_service.py
index b5b886d..7d6c21e 100644
--- a/test/integration/broken/test_vpn_service.py
+++ b/test/integration/broken/test_vpn_service.py
@@ -201,7 +201,7 @@ class TestVPNService(cloudstackTestCase):
# IP by using ike-scan
self.create_VPN(self.public_ip)
-
+
cmd = ['ike-scan', self.public_ip, '-s', '4534'] # Random port
stdout = subprocess.check_output(cmd)
diff --git a/test/integration/component/__init__.py b/test/integration/component/__init__.py
index 978b68a..13a8339 100644
--- a/test/integration/component/__init__.py
+++ b/test/integration/component/__init__.py
@@ -5,9 +5,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
diff --git a/test/integration/component/maint/test_egress_rules_host_maintenance.py b/test/integration/component/maint/test_egress_rules_host_maintenance.py
index 5018a14..40a3913 100644
--- a/test/integration/component/maint/test_egress_rules_host_maintenance.py
+++ b/test/integration/component/maint/test_egress_rules_host_maintenance.py
@@ -5,9 +5,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
diff --git a/test/integration/component/maint/test_ip_resource_count_for_vpc.py b/test/integration/component/maint/test_ip_resource_count_for_vpc.py
index 3557931..a7dfa25 100644
--- a/test/integration/component/maint/test_ip_resource_count_for_vpc.py
+++ b/test/integration/component/maint/test_ip_resource_count_for_vpc.py
@@ -125,7 +125,7 @@ class Services:
# Max networks allowed as per hypervisor
# Xenserver -> 5, VMWare -> 9
},
-
+
"virtual_machine": {
"displayname": "Test VM",
"username": "root",
diff --git a/test/integration/component/maint/testpath_vMotion_vmware.py b/test/integration/component/maint/testpath_vMotion_vmware.py
index 4768319..834f6b9 100644
--- a/test/integration/component/maint/testpath_vMotion_vmware.py
+++ b/test/integration/component/maint/testpath_vMotion_vmware.py
@@ -2488,7 +2488,7 @@ class TestStorageLiveMigrationVmware(cloudstackTestCase):
"""
4. Deploy a windows VM, set vmware.vcenter.session.timeout to a low value
- and do migration, migration should fail
+ and do migration, migration should fail
"""
vm = "virtual_machine3"
@@ -2498,7 +2498,7 @@ class TestStorageLiveMigrationVmware(cloudstackTestCase):
# list cluster for that host
vm_cluster = list_clusters(self.apiclient, id=vm_host.clusterid, listall=True)[0]
#list all hosts in the cluster
- host_list = list_hosts(self.apiclient, clusterid=vm_cluster.id, listall=True)
+ host_list = list_hosts(self.apiclient, clusterid=vm_cluster.id, listall=True)
Configurations.update(
self.apiclient,
"vmware.vcenter.session.timeout",
@@ -2611,7 +2611,7 @@ class TestStorageLiveMigrationVmware(cloudstackTestCase):
self.apiclient,
"Running"
)
- # Create 2 data disks
+ # Create 2 data disks
data_disk_1 = Volume.create(
self.apiclient,
self.testdata["volume"],
@@ -2677,7 +2677,7 @@ class TestStorageLiveMigrationVmware(cloudstackTestCase):
self.apiclient,
ssvm.id,
"Running"
- )
+ )
# Try vMotion on virtual_machine_1 to the host which is in maintenance
destinationHost, destinationPools, vol_list = get_destination_pools_hosts(self, list_vm_1, storage_scope, storage_type)
@@ -2825,7 +2825,7 @@ class TestStorageLiveMigrationVmware(cloudstackTestCase):
self.apiclient,
"Running"
)
- # Create 2 data disks
+ # Create 2 data disks
data_disk_1 = Volume.create(
self.apiclient,
self.testdata["volume"],
diff --git a/test/integration/component/test_acl_isolatednetwork.py b/test/integration/component/test_acl_isolatednetwork.py
index 2347b27..5126aff 100644
--- a/test/integration/component/test_acl_isolatednetwork.py
+++ b/test/integration/component/test_acl_isolatednetwork.py
@@ -5,17 +5,17 @@
# 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.
-"""
-Test cases relating to access checks for createNetwork(), deploying VM in an isolated network and restartNetwork() for Admin, domain admin and regular users
+"""
+Test cases relating to access checks for createNetwork(), deploying VM in an isolated network and restartNetwork() for Admin, domain admin and regular users
"""
# Import Local Modules
diff --git a/test/integration/component/test_acl_isolatednetwork_delete.py b/test/integration/component/test_acl_isolatednetwork_delete.py
index bf464d6..122e9ed 100644
--- a/test/integration/component/test_acl_isolatednetwork_delete.py
+++ b/test/integration/component/test_acl_isolatednetwork_delete.py
@@ -5,16 +5,16 @@
# 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.
-"""
+"""
Test cases relating to acess checks for deleteNetwork() for Admin, domain admin and regular users
@@ -64,7 +64,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
cls.default_apikey = cls.apiclient.connection.apiKey
cls.default_secretkey = cls.apiclient.connection.securityKey
- # Create domains
+ # Create domains
cls.domain_1 = Domain.create(
cls.apiclient,
cls.acldata["domain1"]
@@ -115,7 +115,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
user = cls.generateKeysForUser(cls.apiclient,cls.account_d1a)
cls.user_d1a_apikey = user.apikey
cls.user_d1a_secretkey = user.secretkey
-
+
cls.account_d1b = Account.create(
cls.apiclient,
cls.acldata["accountD1B"],
@@ -126,7 +126,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
user = cls.generateKeysForUser(cls.apiclient,cls.account_d1b)
cls.user_d1b_apikey = user.apikey
cls.user_d1b_secretkey = user.secretkey
-
+
# Create 1 admin and 2 user accounts for doamin_11
cls.account_d11 = Account.create(
cls.apiclient,
@@ -138,7 +138,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
user = cls.generateKeysForUser(cls.apiclient,cls.account_d11)
cls.user_d11_apikey = user.apikey
cls.user_d11_secretkey = user.secretkey
-
+
cls.account_d11a = Account.create(
cls.apiclient,
cls.acldata["accountD11A"],
@@ -149,7 +149,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
user = cls.generateKeysForUser(cls.apiclient,cls.account_d11a)
cls.user_d11a_apikey = user.apikey
cls.user_d11a_secretkey = user.secretkey
-
+
cls.account_d11b = Account.create(
cls.apiclient,
cls.acldata["accountD11B"],
@@ -160,7 +160,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
user = cls.generateKeysForUser(cls.apiclient,cls.account_d11b)
cls.user_d11b_apikey = user.apikey
cls.user_d11b_secretkey = user.secretkey
-
+
# Create 2 user accounts and 1 admin account for doamin_111
cls.account_d111 = Account.create(
cls.apiclient,
@@ -172,7 +172,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
user = cls.generateKeysForUser(cls.apiclient,cls.account_d111)
cls.user_d111_apikey = user.apikey
cls.user_d111_secretkey = user.secretkey
-
+
cls.account_d111a = Account.create(
cls.apiclient,
cls.acldata["accountD111A"],
@@ -183,7 +183,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
user = cls.generateKeysForUser(cls.apiclient,cls.account_d111a)
cls.user_d111a_apikey = user.apikey
cls.user_d111a_secretkey = user.secretkey
-
+
cls.account_d111b = Account.create(
cls.apiclient,
cls.acldata["accountD111B"],
@@ -194,7 +194,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
user = cls.generateKeysForUser(cls.apiclient,cls.account_d111b)
cls.user_d111b_apikey = user.apikey
cls.user_d111b_secretkey = user.secretkey
-
+
# Create 2 user accounts for doamin_12
cls.account_d12a = Account.create(
cls.apiclient,
@@ -206,7 +206,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
user = cls.generateKeysForUser(cls.apiclient,cls.account_d12a)
cls.user_d12a_apikey = user.apikey
cls.user_d12a_secretkey = user.secretkey
-
+
cls.account_d12b = Account.create(
cls.apiclient,
cls.acldata["accountD12B"],
@@ -217,9 +217,9 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
user = cls.generateKeysForUser(cls.apiclient,cls.account_d12b)
cls.user_d12b_apikey = user.apikey
cls.user_d12b_secretkey = user.secretkey
-
+
# Create 1 user account for domain_2
-
+
cls.account_d2a = Account.create(
cls.apiclient,
cls.acldata["accountD2"],
@@ -239,22 +239,22 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
admin=False,
)
cls._cleanup.append(cls.account_roota)
-
+
user = cls.generateKeysForUser(cls.apiclient,cls.account_roota)
cls.user_roota_apikey = user.apikey
cls.user_roota_secretkey = user.secretkey
-
+
cls.account_root = Account.create(
cls.apiclient,
cls.acldata["accountROOT"],
admin=True,
)
cls._cleanup.append(cls.account_root)
-
+
user = cls.generateKeysForUser(cls.apiclient,cls.account_root)
cls.user_root_apikey = user.apikey
cls.user_root_secretkey = user.secretkey
-
+
# create service offering
cls.service_offering = ServiceOffering.create(
cls.apiclient,
@@ -265,63 +265,63 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
cls.zone = get_zone(cls.apiclient,cls.testclient.getZoneForTests())
cls.acldata['mode'] = cls.zone.networktype
cls.template = get_template(cls.apiclient, cls.zone.id, cls.acldata["ostype"])
-
+
cls.apiclient.connection.apiKey = cls.default_apikey
cls.apiclient.connection.securityKey = cls.default_secretkey
-
+
list_isolated_network_offerings_response = NetworkOffering.list(
cls.apiclient,
name="DefaultIsolatedNetworkOfferingWithSourceNatService"
)
cls.isolated_network_offering_id = list_isolated_network_offerings_response[0].id
-
+
## Create Network objects for Update API related test cases
-
+
cls.apiclient.connection.apiKey = cls.user_root_apikey
- cls.apiclient.connection.securityKey = cls.user_root_secretkey
+ cls.apiclient.connection.securityKey = cls.user_root_secretkey
cls.network_root = cls.createNetwork(cls.apiclient,cls.account_root,cls.isolated_network_offering_id,cls.zone)
-
+
cls.apiclient.connection.apiKey = cls.user_d1_apikey
- cls.apiclient.connection.securityKey = cls.user_d1_secretkey
+ cls.apiclient.connection.securityKey = cls.user_d1_secretkey
cls.network_d1 = cls.createNetwork(cls.apiclient,cls.account_d1,cls.isolated_network_offering_id,cls.zone)
-
+
cls.apiclient.connection.apiKey = cls.user_d1a_apikey
- cls.apiclient.connection.securityKey = cls.user_d1a_secretkey
+ cls.apiclient.connection.securityKey = cls.user_d1a_secretkey
cls.network_d1a = cls.createNetwork(cls.apiclient,cls.account_d1a,cls.isolated_network_offering_id,cls.zone)
-
+
cls.apiclient.connection.apiKey = cls.user_d1b_apikey
- cls.apiclient.connection.securityKey = cls.user_d1b_secretkey
+ cls.apiclient.connection.securityKey = cls.user_d1b_secretkey
cls.network_d1b = cls.createNetwork(cls.apiclient,cls.account_d1b,cls.isolated_network_offering_id,cls.zone)
-
+
cls.apiclient.connection.apiKey = cls.user_d11a_apikey
- cls.apiclient.connection.securityKey = cls.user_d11a_secretkey
+ cls.apiclient.connection.securityKey = cls.user_d11a_secretkey
cls.network_d11a = cls.createNetwork(cls.apiclient,cls.account_d11a,cls.isolated_network_offering_id,cls.zone)
-
+
cls.apiclient.connection.apiKey = cls.user_d11b_apikey
- cls.apiclient.connection.securityKey = cls.user_d11b_secretkey
+ cls.apiclient.connection.securityKey = cls.user_d11b_secretkey
cls.network_d11b = cls.createNetwork(cls.apiclient,cls.account_d11b,cls.isolated_network_offering_id,cls.zone)
-
+
cls.apiclient.connection.apiKey = cls.user_d12a_apikey
- cls.apiclient.connection.securityKey = cls.user_d12a_secretkey
+ cls.apiclient.connection.securityKey = cls.user_d12a_secretkey
cls.network_d12a = cls.createNetwork(cls.apiclient,cls.account_d12a,cls.isolated_network_offering_id,cls.zone)
-
+
cls.apiclient.connection.apiKey = cls.user_roota_apikey
- cls.apiclient.connection.securityKey = cls.user_roota_secretkey
+ cls.apiclient.connection.securityKey = cls.user_roota_secretkey
cls.network_roota = cls.createNetwork(cls.apiclient,cls.account_roota,cls.isolated_network_offering_id,cls.zone)
-
+
cls.apiclient.connection.apiKey = cls.user_d111a_apikey
- cls.apiclient.connection.securityKey = cls.user_d111a_secretkey
+ cls.apiclient.connection.securityKey = cls.user_d111a_secretkey
cls.network_d111a = cls.createNetwork(cls.apiclient,cls.account_d111a,cls.isolated_network_offering_id,cls.zone)
-
+
cls.apiclient.connection.apiKey = cls.user_d111b_apikey
- cls.apiclient.connection.securityKey = cls.user_d111b_secretkey
+ cls.apiclient.connection.securityKey = cls.user_d111b_secretkey
cls.network_d111b = cls.createNetwork(cls.apiclient,cls.account_d111b,cls.isolated_network_offering_id,cls.zone)
-
-
+
+
cls.apiclient.connection.apiKey = cls.user_d2a_apikey
- cls.apiclient.connection.securityKey = cls.user_d2a_secretkey
+ cls.apiclient.connection.securityKey = cls.user_d2a_secretkey
cls.network_d2a = cls.createNetwork(cls.apiclient,cls.account_d2a,cls.isolated_network_offering_id,cls.zone)
-
+
except Exception as e:
cls.tearDownClass()
raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
diff --git a/test/integration/component/test_acl_listsnapshot.py b/test/integration/component/test_acl_listsnapshot.py
index 9e6a8d0..32d701a 100644
--- a/test/integration/component/test_acl_listsnapshot.py
+++ b/test/integration/component/test_acl_listsnapshot.py
@@ -5,16 +5,16 @@
# 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.
-"""
+"""
Test cases relating to listSnapshot() relating to parameters - id,listall,isrecursive,account and domainid
"""
# Import Local Modules
@@ -63,7 +63,7 @@ class TestSnapshotList(cloudstackTestCase):
cls.default_apikey = cls.apiclient.connection.apiKey
cls.default_secretkey = cls.apiclient.connection.securityKey
- # Create domains
+ # Create domains
cls.domain_1 = Domain.create(
cls.apiclient,
cls.acldata["domain1"]
@@ -198,7 +198,7 @@ class TestSnapshotList(cloudstackTestCase):
cls.user_d2a_apikey = user.apikey
cls.user_d2a_secretkey = user.secretkey
- # Create admin user account
+ # Create admin user account
cls.account_a = Account.create(
cls.apiclient,
diff --git a/test/integration/component/test_acl_listvm.py b/test/integration/component/test_acl_listvm.py
index 5c27f29..b058d55 100644
--- a/test/integration/component/test_acl_listvm.py
+++ b/test/integration/component/test_acl_listvm.py
@@ -5,16 +5,16 @@
# 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.
-"""
+"""
Test cases relating to listVirtualMachine() relating to parameters - id,listall,isrecursive,account and domainid
"""
# Import Local Modules
diff --git a/test/integration/component/test_acl_listvolume.py b/test/integration/component/test_acl_listvolume.py
index c63bfe2..f3fae13 100644
--- a/test/integration/component/test_acl_listvolume.py
+++ b/test/integration/component/test_acl_listvolume.py
@@ -5,16 +5,16 @@
# 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.
-"""
+"""
Test cases relating to listVolumes() relating to parameters - id,listall,isrecursive,account and domainid
"""
# Import Local Modules
@@ -60,7 +60,7 @@ class TestVolumeList(cloudstackTestCase):
cls.default_apikey = cls.apiclient.connection.apiKey
cls.default_secretkey = cls.apiclient.connection.securityKey
- # Create domains
+ # Create domains
cls.domain_1 = Domain.create(
cls.apiclient,
cls.acldata["domain1"]
@@ -195,7 +195,7 @@ class TestVolumeList(cloudstackTestCase):
cls.user_d2a_apikey = user.apikey
cls.user_d2a_secretkey = user.secretkey
- # Create admin user account
+ # Create admin user account
cls.account_a = Account.create(
cls.apiclient,
diff --git a/test/integration/component/test_acl_sharednetwork.py b/test/integration/component/test_acl_sharednetwork.py
index 25b01a7..170dc15 100644
--- a/test/integration/component/test_acl_sharednetwork.py
+++ b/test/integration/component/test_acl_sharednetwork.py
@@ -5,9 +5,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
@@ -67,7 +67,7 @@ class TestSharedNetwork(cloudstackTestCase):
cls.default_apikey = cls.apiclient.connection.apiKey
cls.default_secretkey = cls.apiclient.connection.securityKey
- # Create domains
+ # Create domains
cls.domain_1 = Domain.create(
cls.apiclient,
cls.acldata["domain1"]
@@ -98,167 +98,167 @@ class TestSharedNetwork(cloudstackTestCase):
admin=True,
domainid=cls.domain_1.id
)
-
+
user = cls.generateKeysForUser(cls.apiclient,cls.account_d1)
cls.user_d1_apikey = user.apikey
cls.user_d1_secretkey = user.secretkey
-
+
cls.account_d1a = Account.create(
cls.apiclient,
cls.acldata["accountD1A"],
admin=False,
domainid=cls.domain_1.id
- )
+ )
user = cls.generateKeysForUser(cls.apiclient,cls.account_d1a)
cls.user_d1a_apikey = user.apikey
cls.user_d1a_secretkey = user.secretkey
-
-
+
+
cls.account_d1b = Account.create(
cls.apiclient,
cls.acldata["accountD1B"],
admin=False,
domainid=cls.domain_1.id
)
-
+
user = cls.generateKeysForUser(cls.apiclient,cls.account_d1b)
cls.user_d1b_apikey = user.apikey
cls.user_d1b_secretkey = user.secretkey
-
+
# Create 1 admin and 2 user accounts for doamin_11
cls.account_d11 = Account.create(
cls.apiclient,
cls.acldata["accountD11"],
admin=True,
domainid=cls.domain_11.id
- )
+ )
user = cls.generateKeysForUser(cls.apiclient,cls.account_d11)
cls.user_d11_apikey = user.apikey
cls.user_d11_secretkey = user.secretkey
-
+
cls.account_d11a = Account.create(
cls.apiclient,
cls.acldata["accountD11A"],
admin=False,
domainid=cls.domain_11.id
- )
+ )
user = cls.generateKeysForUser(cls.apiclient,cls.account_d11a)
cls.user_d11a_apikey = user.apikey
cls.user_d11a_secretkey = user.secretkey
-
+
cls.account_d11b = Account.create(
cls.apiclient,
cls.acldata["accountD11B"],
admin=False,
domainid=cls.domain_11.id
- )
+ )
user = cls.generateKeysForUser(cls.apiclient,cls.account_d11b)
cls.user_d11b_apikey = user.apikey
cls.user_d11b_secretkey = user.secretkey
-
+
# Create 2 user accounts and 1 admin account for doamin_111
-
+
cls.account_d111 = Account.create(
cls.apiclient,
cls.acldata["accountD111"],
admin=True,
domainid=cls.domain_111.id
- )
+ )
user = cls.generateKeysForUser(cls.apiclient,cls.account_d111)
cls.user_d111_apikey = user.apikey
cls.user_d111_secretkey = user.secretkey
-
+
cls.account_d111a = Account.create(
cls.apiclient,
cls.acldata["accountD111A"],
admin=False,
domainid=cls.domain_111.id
- )
+ )
user = cls.generateKeysForUser(cls.apiclient,cls.account_d111a)
cls.user_d111a_apikey = user.apikey
cls.user_d111a_secretkey = user.secretkey
-
+
cls.account_d111b = Account.create(
cls.apiclient,
cls.acldata["accountD111B"],
admin=False,
domainid=cls.domain_111.id
- )
+ )
user = cls.generateKeysForUser(cls.apiclient,cls.account_d111b)
cls.user_d111b_apikey = user.apikey
cls.user_d111b_secretkey = user.secretkey
-
+
# Create 2 user accounts for doamin_12
cls.account_d12a = Account.create(
cls.apiclient,
cls.acldata["accountD12A"],
admin=False,
domainid=cls.domain_12.id
- )
+ )
user = cls.generateKeysForUser(cls.apiclient,cls.account_d12a)
cls.user_d12a_apikey = user.apikey
cls.user_d12a_secretkey = user.secretkey
-
+
cls.account_d12b = Account.create(
cls.apiclient,
cls.acldata["accountD12B"],
admin=False,
domainid=cls.domain_12.id
- )
-
+ )
+
user = cls.generateKeysForUser(cls.apiclient,cls.account_d12b)
cls.user_d12b_apikey = user.apikey
cls.user_d12b_secretkey = user.secretkey
-
+
# Create 1 user account for domain_2
-
+
cls.account_d2a = Account.create(
cls.apiclient,
cls.acldata["accountD2"],
admin=False,
domainid=cls.domain_2.id
)
-
+
user = cls.generateKeysForUser(cls.apiclient,cls.account_d2a)
cls.user_d2a_apikey = user.apikey
cls.user_d2a_secretkey = user.secretkey
-
-
+
+
# Create 1 user account and admin account in "ROOT" domain
-
+
cls.account_roota = Account.create(
cls.apiclient,
cls.acldata["accountROOTA"],
admin=False,
)
-
+
user = cls.generateKeysForUser(cls.apiclient,cls.account_roota)
cls.user_roota_apikey = user.apikey
cls.user_roota_secretkey = user.secretkey
-
+
cls.account_root = Account.create(
cls.apiclient,
cls.acldata["accountROOTA"],
admin=True,
)
-
+
user = cls.generateKeysForUser(cls.apiclient,cls.account_root)
cls.user_root_apikey = user.apikey
cls.user_root_secretkey = user.secretkey
-
+
# create service offering
cls.service_offering = ServiceOffering.create(
cls.apiclient,
cls.acldata["service_offering"]["small"]
)
-
+
cls.zone = get_zone(cls.apiclient,cls.testclient.getZoneForTests())
cls.acldata['mode'] = cls.zone.networktype
cls.template = get_template(cls.apiclient, cls.zone.id, cls.acldata["ostype"])
-
+
cls.apiclient.connection.apiKey = cls.default_apikey
cls.apiclient.connection.securityKey = cls.default_secretkey
-
+
list_shared_network_offerings_response = NetworkOffering.list(
cls.apiclient,
name="DefaultSharedNetworkOffering",
@@ -279,7 +279,7 @@ class TestSharedNetwork(cloudstackTestCase):
networkofferingid=cls.shared_network_offering_id,
zoneid=cls.zone.id
)
-
+
cls.shared_network_domain_d11 = Network.create(
cls.apiclient,
cls.acldata["network_domain_with_no_subdomain_access"],
@@ -288,7 +288,7 @@ class TestSharedNetwork(cloudstackTestCase):
domainid=cls.domain_11.id,
subdomainaccess=False
)
-
+
cls.shared_network_domain_with_subdomain_d11 = Network.create(
cls.apiclient,
cls.acldata["network_domain_with_subdomain_access"],
@@ -297,7 +297,7 @@ class TestSharedNetwork(cloudstackTestCase):
domainid=cls.domain_11.id,
subdomainaccess=True
)
-
+
cls.shared_network_account_d111a = Network.create(
cls.apiclient,
cls.acldata["network_account"],
@@ -402,7 +402,7 @@ class TestSharedNetwork(cloudstackTestCase):
Validate that regular user in any subdomain is allowed to deploy VM in a shared network created with scope="all"
"""
- # deploy VM as user in a subdomain under ROOT
+ # deploy VM as user in a subdomain under ROOT
self.apiclient.connection.apiKey = self.user_d11a_apikey
self.apiclient.connection.securityKey = self.user_d11a_secretkey
@@ -428,7 +428,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as an admin user in a subdomain under ROOT
-
+
self.apiclient.connection.apiKey = self.user_d11_apikey
self.apiclient.connection.securityKey = self.user_d11_secretkey
self.vmdata["name"] = self.acldata["vmD11"]["name"] +"-shared-scope-all"
@@ -454,7 +454,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as user in ROOT domain
-
+
self.apiclient.connection.apiKey = self.user_roota_apikey
self.apiclient.connection.securityKey = self.user_roota_secretkey
self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-all"
@@ -478,7 +478,7 @@ class TestSharedNetwork(cloudstackTestCase):
Validate that admin user in ROOT domain is allowed to deploy VM in a shared network created with scope="all"
"""
# deploy VM as admin user in ROOT domain
-
+
self.apiclient.connection.apiKey = self.user_root_apikey
self.apiclient.connection.securityKey = self.user_root_secretkey
self.vmdata["name"] = self.acldata["vmROOT"]["name"] + "-shared-scope-all"
@@ -505,7 +505,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as user in a domain that has shared network with no subdomain access
-
+
self.apiclient.connection.apiKey = self.user_d11a_apikey
self.apiclient.connection.securityKey = self.user_d11a_secretkey
self.vmdata["name"] = self.acldata["vmD11A"]["name"] +"-shared-scope-domain-nosubdomainaccess"
@@ -532,7 +532,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
#deploy VM as an admin user in a domain that has shared network with no subdomain access
-
+
self.apiclient.connection.apiKey = self.user_d11_apikey
self.apiclient.connection.securityKey = self.user_d11_secretkey
self.vmdata["name"] = self.acldata["vmD11"]["name"] +"-shared-scope-domain-nosubdomainaccess"
@@ -558,7 +558,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as user in a subdomain under a domain that has shared network with no subdomain access
-
+
self.apiclient.connection.apiKey = self.user_d111a_apikey
self.apiclient.connection.securityKey = self.user_d111a_secretkey
self.vmdata["name"] = self.acldata["vmD111A"]["name"] +"-shared-scope-domain-nosubdomainaccess"
@@ -585,7 +585,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as an admin user in a subdomain under a domain that has shared network with no subdomain access
-
+
self.apiclient.connection.apiKey = self.user_d111_apikey
self.apiclient.connection.securityKey = self.user_d111_secretkey
self.vmdata["name"] = self.acldata["vmD111"]["name"] +"-shared-scope-domain-nosubdomainaccess"
@@ -614,7 +614,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as user in parentdomain of a domain that has shared network with no subdomain access
-
+
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
self.vmdata["name"] = self.acldata["vmD1A"]["name"] +"-shared-scope-domain-nosubdomainaccess"
@@ -642,7 +642,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as an admin user in parentdomain of a domain that has shared network with no subdomain access
-
+
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
self.vmdata["name"] = self.acldata["vmD1"]["name"] +"-shared-scope-domain-nosubdomainaccess"
@@ -671,12 +671,12 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as user in ROOT domain
-
+
self.apiclient.connection.apiKey = self.user_roota_apikey
self.apiclient.connection.securityKey = self.user_roota_secretkey
self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-domain-nosubdomainaccess"
self.vmdata["displayname"] = self.acldata["vmROOTA"]["displayname"] + "-shared-scope-domain-nosubdomainaccess"
- try:
+ try:
vm = VirtualMachine.create(
self.apiclient,
self.vmdata,
@@ -696,16 +696,16 @@ class TestSharedNetwork(cloudstackTestCase):
@attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deployVM_in_sharedNetwork_scope_domain_nosubdomainaccess_ROOTadmin(self):
"""
- Validate that admin in ROOT domain is NOT allowed to deploy VM in a shared network created with scope="domain" and no subdomain access
+ Validate that admin in ROOT domain is NOT allowed to deploy VM in a shared network created with scope="domain" and no subdomain access
"""
# deploy VM as admin user in ROOT domain
-
+
self.apiclient.connection.apiKey = self.user_root_apikey
self.apiclient.connection.securityKey = self.user_root_secretkey
self.vmdata["name"] = self.acldata["vmROOT"]["name"] + "-shared-scope-domain-nosubdomainaccess"
self.vmdata["displayname"] = self.acldata["vmROOT"]["displayname"] + "-shared-scope-domain-nosubdomainaccess"
- try:
+ try:
vm = VirtualMachine.create(
self.apiclient,
self.vmdata,
@@ -731,7 +731,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as user in a domain that has shared network with subdomain access
-
+
self.apiclient.connection.apiKey = self.user_d11a_apikey
self.apiclient.connection.securityKey = self.user_d11a_secretkey
self.vmdata["name"] = self.acldata["vmD11A"]["name"] +"-shared-scope-domain-withsubdomainaccess"
@@ -758,7 +758,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as an admin user in a domain that has shared network with subdomain access
-
+
self.apiclient.connection.apiKey = self.user_d11_apikey
self.apiclient.connection.securityKey = self.user_d11_secretkey
self.vmdata["name"] = self.acldata["vmD11"]["name"] +"-shared-scope-domain-withsubdomainaccess"
@@ -784,7 +784,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as user in a subdomain under a domain that has shared network with subdomain access
-
+
self.apiclient.connection.apiKey = self.user_d111a_apikey
self.apiclient.connection.securityKey = self.user_d111a_secretkey
self.vmdata["name"] = self.acldata["vmD111A"]["name"] +"-shared-scope-domain-withsubdomainaccess"
@@ -809,7 +809,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as an admin user in a subdomain under a domain that has shared network with subdomain access
-
+
self.apiclient.connection.apiKey = self.user_d111_apikey
self.apiclient.connection.securityKey = self.user_d111_secretkey
self.vmdata["name"] = self.acldata["vmD111"]["name"] +"-shared-scope-domain-withsubdomainaccess"
@@ -834,7 +834,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as user in parentdomain of a domain that has shared network with subdomain access
-
+
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
self.vmdata["name"] = self.acldata["vmD1A"]["name"] +"-shared-scope-domain-withsubdomainaccess"
@@ -862,7 +862,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as an admin user in parentdomain of a domain that has shared network with subdomain access
-
+
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
self.vmdata["name"] = self.acldata["vmD1"]["name"] +"-shared-scope-domain-withsubdomainaccess"
@@ -891,7 +891,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as user in ROOT domain
-
+
self.apiclient.connection.apiKey = self.user_roota_apikey
self.apiclient.connection.securityKey = self.user_roota_secretkey
self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-domain-withsubdomainaccess"
@@ -919,7 +919,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as admin user in ROOT domain
-
+
self.apiclient.connection.apiKey = self.user_root_apikey
self.apiclient.connection.securityKey = self.user_root_secretkey
self.vmdata["name"] = self.acldata["vmROOT"]["name"] + "-shared-scope-domain-withsubdomainaccess"
@@ -950,7 +950,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as user under the same domain but belonging to a different account from the acount that has a shared network with scope=account
-
+
self.apiclient.connection.apiKey = self.user_d111b_apikey
self.apiclient.connection.securityKey = self.user_d111b_secretkey
self.vmdata["name"] = self.acldata["vmD111B"]["name"] +"-shared-scope-domain-withsubdomainaccess"
@@ -979,7 +979,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as admin user for a domain that has an account with shared network with scope=account
-
+
self.apiclient.connection.apiKey = self.user_d111_apikey
self.apiclient.connection.securityKey = self.user_d111_secretkey
self.vmdata["name"] = self.acldata["vmD111"]["name"] +"-shared-scope-domain-withsubdomainaccess"
@@ -1007,7 +1007,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as account with shared network with scope=account
-
+
self.apiclient.connection.apiKey = self.user_d111a_apikey
self.apiclient.connection.securityKey = self.user_d111a_secretkey
self.vmdata["name"] = self.acldata["vmD111A"]["name"] +"-shared-scope-domain-withsubdomainaccess"
@@ -1032,8 +1032,8 @@ class TestSharedNetwork(cloudstackTestCase):
Validate that regular user from a domain different from that of the account is NOT allowed to deploy VM in a shared network created with scope="account" for an account
"""
- # deploy VM as a user in a subdomain under ROOT
-
+ # deploy VM as a user in a subdomain under ROOT
+
self.apiclient.connection.apiKey = self.user_d2a_apikey
self.apiclient.connection.securityKey = self.user_d2a_secretkey
self.vmdata["name"] = self.acldata["vmD2A"]["name"] +"-shared-scope-account"
@@ -1062,7 +1062,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as user in ROOT domain
-
+
self.apiclient.connection.apiKey = self.user_roota_apikey
self.apiclient.connection.securityKey = self.user_roota_secretkey
self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-account"
@@ -1090,7 +1090,7 @@ class TestSharedNetwork(cloudstackTestCase):
"""
# deploy VM as admin user in ROOT domain
-
+
self.apiclient.connection.apiKey = self.user_root_apikey
self.apiclient.connection.securityKey = self.user_root_secretkey
self.vmdata["name"] = self.acldata["vmROOT"]["name"] + "-shared-scope-account"
diff --git a/test/integration/component/test_acl_sharednetwork_deployVM-impersonation.py b/test/integration/component/test_acl_sharednetwork_deployVM-impersonation.py
index 2bd62dc..1cb445b 100644
--- a/test/integration/component/test_acl_sharednetwork_deployVM-impersonation.py
+++ b/test/integration/component/test_acl_sharednetwork_deployVM-impersonation.py
@@ -5,9 +5,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
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
"""
- Test cases for deploying Virtual Machine using impersonation (passing account and domainId parameters) for shared network
+ Test cases for deploying Virtual Machine using impersonation (passing account and domainId parameters) for shared network
"""
# Import Local Modules
import marvin
@@ -67,7 +67,7 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
cls.default_apikey = cls.apiclient.connection.apiKey
cls.default_secretkey = cls.apiclient.connection.securityKey
- # Create domains
+ # Create domains
cls.domain_1 = Domain.create(
cls.apiclient,
cls.acldata["domain1"]
@@ -402,7 +402,7 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
"""
Valiate that ROOT admin is able to deploy a VM for any user in a subdomain in a shared network with scope=all
"""
- # Deploy VM as user in a subdomain under ROOT
+ # Deploy VM as user in a subdomain under ROOT
self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
@@ -984,7 +984,7 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
Valiate that ROOT admin is NOT able to deploy a VM for a admin user in a shared network with scope=account which the admin user does not have access to
"""
- # Deploy VM as an admin user in a subdomain under ROOT
+ # Deploy VM as an admin user in a subdomain under ROOT
self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
@@ -1100,7 +1100,7 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
Valiate that Domain admin is able to deploy a VM for a sub domain user in a shared network with scope=all
"""
- # Deploy VM as user in a subdomain under ROOT
+ # Deploy VM as user in a subdomain under ROOT
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
self.vmdata["name"] = self.acldata["vmD11A"]["name"] + "-shared-scope-all-domain-admin"
@@ -1126,7 +1126,7 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
Valiate that Domain admin is able to deploy a VM for a sub domain admin user in a shared network with scope=all
"""
- # Deploy VM as an admin user in a subdomain under ROOT
+ # Deploy VM as an admin user in a subdomain under ROOT
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
self.vmdata["name"] = self.acldata["vmD11"]["name"] + "-shared-scope-all-domain-admin"
@@ -1698,7 +1698,7 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
Valiate that Domain admin is able NOT able to deploy a VM for an regular user from a differnt domain in a shared network with scope=account
"""
- # Deploy VM as an admin user in a subdomain under ROOT
+ # Deploy VM as an admin user in a subdomain under ROOT
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
self.vmdata["name"] = self.acldata["vmD2A"]["name"] + "-shared-scope-account-domain-admin"
diff --git a/test/integration/component/test_affinity_groups.py b/test/integration/component/test_affinity_groups.py
index a2bb642..e31c04c 100644
--- a/test/integration/component/test_affinity_groups.py
+++ b/test/integration/component/test_affinity_groups.py
@@ -65,7 +65,7 @@ class Services:
"type": "host anti-affinity",
},
"virtual_machine" : {
-
+
},
"new_domain": {
"name": "New Domain",
diff --git a/test/integration/component/test_affinity_groups_projects.py b/test/integration/component/test_affinity_groups_projects.py
index 16135e2..ae5da06 100644
--- a/test/integration/component/test_affinity_groups_projects.py
+++ b/test/integration/component/test_affinity_groups_projects.py
@@ -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
@@ -109,11 +109,11 @@ class TestCreateAffinityGroup(cloudstackTestCase):
cls.zone.id,
cls.services["ostype"]
)
-
+
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["template"] = cls.template.id
cls.services["zoneid"] = cls.zone.id
-
+
cls.domain_admin_account = Account.create(
cls.api_client,
cls.services["domain_admin_account"],
@@ -127,7 +127,7 @@ class TestCreateAffinityGroup(cloudstackTestCase):
cls.api_client,
cls.services["account"],
domainid=cls.domain.id
- )
+ )
cls.account_api_client = cls.testClient.getUserApiClient(cls.account.name, cls.domain.name, 0)
@@ -145,7 +145,7 @@ class TestCreateAffinityGroup(cloudstackTestCase):
account=cls.domain_admin_account.name,
domainid=cls.domain_admin_account.domainid
)
-
+
cls.project2 = Project.create(
cls.api_client,
cls.services["project2"],
@@ -167,7 +167,7 @@ class TestCreateAffinityGroup(cloudstackTestCase):
cls.services["service_offering"],
domainid=cls.account.domainid
)
-
+
cls._cleanup = []
return
@@ -209,7 +209,7 @@ class TestCreateAffinityGroup(cloudstackTestCase):
return AffinityGroup.create(api_client, aff_grp, None, None, projectid)
except Exception as e:
raise Exception("Error: Creation of Affinity Group failed : %s" % e)
-
+
@attr(tags=["simulator", "basic", "advanced"], required_hardware="false")
def test_01_admin_create_aff_grp_for_project(self):
"""
@@ -223,7 +223,7 @@ class TestCreateAffinityGroup(cloudstackTestCase):
self.assertTrue(list_aff_grps[0].id == aff_grp.id)
self.assertTrue(list_aff_grps[0].projectid == self.project.id)
self.cleanup.append(aff_grp)
-
+
@attr(tags=["simulator", "basic", "advanced"], required_hardware="false")
def test_02_doadmin_create_aff_grp_for_project(self):
"""
@@ -236,7 +236,7 @@ class TestCreateAffinityGroup(cloudstackTestCase):
self.assertTrue(list_aff_grps[0].id == aff_grp.id)
self.assertTrue(list_aff_grps[0].projectid == self.project.id)
self.cleanup.append(aff_grp)
-
+
@attr(tags=["vogxn", "simulator", "basic", "advanced"], required_hardware="false")
def test_03_user_create_aff_grp_for_project(self):
"""
@@ -249,19 +249,19 @@ class TestCreateAffinityGroup(cloudstackTestCase):
self.assertTrue(list_aff_grps[0].id == aff_grp.id)
self.assertTrue(list_aff_grps[0].projectid == self.project.id)
self.cleanup.append(aff_grp)
-
+
@attr(tags=["simulator", "basic", "advanced"], required_hardware="false")
def test_4_user_create_aff_grp_existing_name_for_project(self):
"""
Test create affinity group that exists (same name) for projects
@return:
"""
-
+
failed_aff_grp = None
aff_grp = self.create_aff_grp(api_client=self.account_api_client)
with self.assertRaises(Exception):
failed_aff_grp = self.create_aff_grp(api_client=self.account_api_client,aff_grp_name = aff_grp.name)
-
+
if failed_aff_grp:
self.cleanup.append(failed_aff_grp)
self.cleanup.append(aff_grp)
@@ -284,11 +284,11 @@ class TestListAffinityGroups(cloudstackTestCase):
cls.zone.id,
cls.services["ostype"]
)
-
+
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["template"] = cls.template.id
cls.services["zoneid"] = cls.zone.id
-
+
cls.domain_admin_account = Account.create(
cls.api_client,
cls.services["domain_admin_account"],
@@ -302,7 +302,7 @@ class TestListAffinityGroups(cloudstackTestCase):
cls.api_client,
cls.services["account"],
domainid=cls.domain.id
- )
+ )
cls.account_api_client = cls.testClient.getUserApiClient(cls.account.name, cls.domain.name, 0)
@@ -320,7 +320,7 @@ class TestListAffinityGroups(cloudstackTestCase):
account=cls.domain_admin_account.name,
domainid=cls.domain_admin_account.domainid
)
-
+
cls.project2 = Project.create(
cls.api_client,
cls.services["project2"],
@@ -342,7 +342,7 @@ class TestListAffinityGroups(cloudstackTestCase):
cls.services["service_offering"],
domainid=cls.account.domainid
)
-
+
cls._cleanup = []
return
@@ -523,7 +523,7 @@ class TestListAffinityGroups(cloudstackTestCase):
#Wait for expunge interval to cleanup VM
wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"])
self.cleanup.append(aff_grp)
-
+
class TestDeleteAffinityGroups(cloudstackTestCase):
@classmethod
@@ -542,11 +542,11 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
cls.zone.id,
cls.services["ostype"]
)
-
+
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["template"] = cls.template.id
cls.services["zoneid"] = cls.zone.id
-
+
cls.domain_admin_account = Account.create(
cls.api_client,
cls.services["domain_admin_account"],
@@ -560,7 +560,7 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
cls.api_client,
cls.services["account"],
domainid=cls.domain.id
- )
+ )
cls.account_api_client = cls.testClient.getUserApiClient(cls.account.name, cls.domain.name, 0)
@@ -578,7 +578,7 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
account=cls.domain_admin_account.name,
domainid=cls.domain_admin_account.domainid
)
-
+
cls.project2 = Project.create(
cls.api_client,
cls.services["project2"],
@@ -600,7 +600,7 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
cls.services["service_offering"],
domainid=cls.account.domainid
)
-
+
cls._cleanup = []
return
@@ -685,10 +685,10 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
aff_grp2 = self.create_aff_grp(self.account_api_client)
aff_grp1.delete(self.account_api_client)
-
+
with self.assertRaises(Exception):
list_aff_grps = AffinityGroup.list(self.api_client, id=aff_grp1.id)
-
+
self.cleanup.append(aff_grp2)
@attr(tags=["simulator", "basic", "advanced"], required_hardware="false")
@@ -724,11 +724,11 @@ class TestUpdateVMAffinityGroups(cloudstackTestCase):
cls.zone.id,
cls.services["ostype"]
)
-
+
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["template"] = cls.template.id
cls.services["zoneid"] = cls.zone.id
-
+
cls.domain_admin_account = Account.create(
cls.api_client,
cls.services["domain_admin_account"],
@@ -742,7 +742,7 @@ class TestUpdateVMAffinityGroups(cloudstackTestCase):
cls.api_client,
cls.services["account"],
domainid=cls.domain.id
- )
+ )
cls.account_api_client = cls.testClient.getUserApiClient(cls.account.name, cls.domain.name, 0)
@@ -760,7 +760,7 @@ class TestUpdateVMAffinityGroups(cloudstackTestCase):
account=cls.domain_admin_account.name,
domainid=cls.domain_admin_account.domainid
)
-
+
cls.project2 = Project.create(
cls.api_client,
cls.services["project2"],
@@ -782,7 +782,7 @@ class TestUpdateVMAffinityGroups(cloudstackTestCase):
cls.services["service_offering"],
domainid=cls.account.domainid
)
-
+
cls._cleanup = []
return
@@ -891,7 +891,7 @@ class TestUpdateVMAffinityGroups(cloudstackTestCase):
wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"])
aff_grp1.delete(self.api_client)
aff_grp2.delete(self.api_client)
-
+
class TestDeployVMAffinityGroups(cloudstackTestCase):
@@ -911,7 +911,7 @@ class TestDeployVMAffinityGroups(cloudstackTestCase):
cls.zone.id,
cls.services["ostype"]
)
-
+
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["template"] = cls.template.id
cls.services["zoneid"] = cls.zone.id
@@ -972,7 +972,7 @@ class TestDeployVMAffinityGroups(cloudstackTestCase):
cls.services["service_offering"],
domainid=cls.account.domainid
)
-
+
return
def setUp(self):
@@ -1074,9 +1074,9 @@ class TestDeployVMAffinityGroups(cloudstackTestCase):
vm_failed = None
with self.assertRaises(Exception):
vm_failed = self.create_vm_in_aff_grps(self.account_api_client,ag_list=[aff_grp.name])
-
+
self.assertEqual(len(hosts), len(vms), "Received %s and %s " % (hosts, vms))
-
+
if vm_failed:
vm_failed.expunge(self.api_client)
diff --git a/test/integration/component/test_allocation_states.py b/test/integration/component/test_allocation_states.py
index 78c7203..695d896 100644
--- a/test/integration/component/test_allocation_states.py
+++ b/test/integration/component/test_allocation_states.py
@@ -5,9 +5,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
diff --git a/test/integration/component/test_asa1000v_fw.py b/test/integration/component/test_asa1000v_fw.py
index 43d06d1..35d9474 100644
--- a/test/integration/component/test_asa1000v_fw.py
+++ b/test/integration/component/test_asa1000v_fw.py
@@ -5,9 +5,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
diff --git a/test/integration/component/test_assign_vm.py b/test/integration/component/test_assign_vm.py
index 9d8ccea..c2ee442 100644
--- a/test/integration/component/test_assign_vm.py
+++ b/test/integration/component/test_assign_vm.py
@@ -422,7 +422,7 @@ class TestVMOwnership(cloudstackTestCase):
self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'], snapshot=True)
with self.assertRaises(Exception):
self.virtual_machine.assign_virtual_machine(self.apiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id)
-
+
@attr(tags = ["advanced"])
@log_test_exceptions
def test_14_move_across_subdomain_vm_project(self):
diff --git a/test/integration/component/test_baremetal.py b/test/integration/component/test_baremetal.py
index a27e76c..352e797 100644
--- a/test/integration/component/test_baremetal.py
+++ b/test/integration/component/test_baremetal.py
@@ -5,9 +5,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
@@ -86,7 +86,7 @@ class TestBaremetal(cloudstackTestCase):
networkoffering = NetworkOffering.create(self.apiclient, self.services["network_offering"])
networkoffering.update(self.apiclient, state="Enabled")
self.cleanup.append(networkoffering)
-
+
physical_network = PhysicalNetwork.list(self.apiclient, zoneid=self.zoneid)[0];
dhcp_provider = NetworkServiceProvider.list(self.apiclient, name="BaremetalDhcpProvider", physical_network_id=physical_network.id)[0]
NetworkServiceProvider.update(
@@ -106,10 +106,10 @@ class TestBaremetal(cloudstackTestCase):
id=userdata_provider.id,
state='Enabled'
)
-
+
network = Network.create(self.apiclient, self.services["network"], zoneid=self.zoneid, networkofferingid=networkoffering.id)
self.cleanup.insert(0, network)
-
+
pod = Pod.list(self.apiclient)[0]
cmd = createVlanIpRange.createVlanIpRangeCmd()
cmd.podid = pod.id
@@ -120,4 +120,4 @@ class TestBaremetal(cloudstackTestCase):
cmd.endip = "10.1.1.40"
cmd.forVirtualNetwork="false"
self.apiclient.createVlanIpRange(cmd)
-
+
diff --git a/test/integration/component/test_blocker_bugs.py b/test/integration/component/test_blocker_bugs.py
index c71ca42..7b497cf 100644
--- a/test/integration/component/test_blocker_bugs.py
+++ b/test/integration/component/test_blocker_bugs.py
@@ -5,9 +5,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
@@ -177,8 +177,8 @@ class TestTemplate(cloudstackTestCase):
#3. Deploy VM should return password set in template.
builtin_info = get_builtin_template_info(self.apiclient, self.zone.id)
- self.services["template"]["url"] = builtin_info[0]
- self.services["template"]["hypervisor"] = builtin_info[1]
+ self.services["template"]["url"] = builtin_info[0]
+ self.services["template"]["hypervisor"] = builtin_info[1]
self.services["template"]["format"] = builtin_info[2]
temp = self.services["template"]
self.debug("Registering a new template")
diff --git a/test/integration/component/test_browse_templates.py b/test/integration/component/test_browse_templates.py
index 2573f5f..ba2a6e1 100644
--- a/test/integration/component/test_browse_templates.py
+++ b/test/integration/component/test_browse_templates.py
@@ -80,7 +80,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
"Check for default cent OS template readiness ")
cls.service_offering = ServiceOffering.create(
- cls.apiclient,
+ cls.apiclient,
cls.testdata["service_offering"]
)
cls._cleanup.append(cls.service_offering)
@@ -267,7 +267,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
uploadfile = url.split('/')[-1]
r = requests.get(url, stream=True)
with open(uploadfile, 'wb') as f:
- for chunk in r.iter_content(chunk_size=1024):
+ for chunk in r.iter_content(chunk_size=1024):
if chunk: # filter out keep-alive new chunks
f.write(chunk)
f.flush()
@@ -285,7 +285,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False)
print(results.status_code)
- if results.status_code !=200:
+ if results.status_code !=200:
self.fail("Upload is not fine")
self.validate_uploaded_template(self.apiclient, getuploadparamsresponce.id)
@@ -366,7 +366,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
uploadfile = url.split('/')[-1]
r = requests.get(url, stream=True)
with open(uploadfile, 'wb') as f:
- for chunk in r.iter_content(chunk_size=1024):
+ for chunk in r.iter_content(chunk_size=1024):
if chunk: # filter out keep-alive new chunks
f.write(chunk)
f.flush()
@@ -378,7 +378,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False)
print(results.status_code)
- if results.status_code !=200:
+ if results.status_code !=200:
self.fail("Upload is not fine")
self.validate_uploaded_template(self.apiclient, getuploadparamsresponce.id)
@@ -410,7 +410,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
uploadfile = url.split('/')[-1]
r = requests.get(url, stream=True)
with open(uploadfile, 'wb') as f:
- for chunk in r.iter_content(chunk_size=1024):
+ for chunk in r.iter_content(chunk_size=1024):
if chunk: # filter out keep-alive new chunks
f.write(chunk)
f.flush()
@@ -428,7 +428,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False)
print(results.status_code)
- if results.status_code !=200:
+ if results.status_code !=200:
self.fail("Upload is not fine")
for z1 in lzones:
@@ -459,7 +459,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
uploadfile = url.split('/')[-1]
r = requests.get(url, stream=True)
with open(uploadfile, 'wb') as f:
- for chunk in r.iter_content(chunk_size=1024):
+ for chunk in r.iter_content(chunk_size=1024):
if chunk: # filter out keep-alive new chunks
f.write(chunk)
f.flush()
@@ -478,7 +478,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
time.sleep(60)
print(results.status_code)
- if results.status_code !=200:
+ if results.status_code !=200:
self.fail("Upload is not fine")
return(getuploadparamsresponce)
@@ -959,7 +959,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
)
list_zones_response = list_zones(self.apiclient)
-
+
self.assertEqual(
isinstance(list_zones_response, list),
True,
@@ -1014,13 +1014,13 @@ class TestBrowseUploadVolume(cloudstackTestCase):
"Check list response returns a valid list"
)
iprange = ipranges_response[0]
-
+
#Fetch corresponding Physical Network of SSVM's Zone
listphyntwk = PhysicalNetwork.list(
self.apiclient,
zoneid=ssvm.zoneid
)
-
+
# Execute the following assertion in all zones except EIP-ELB Zones
if not (self.zone.networktype.lower() == 'basic' and isinstance(NetScaler.list(self.apiclient,physicalnetworkid=listphyntwk[0].id), list) is True):
self.assertEqual(
@@ -1082,7 +1082,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
cmd = stopSystemVm.stopSystemVmCmd()
cmd.id = ssvm.id
self.apiclient.stopSystemVm(cmd)
-
+
timeout = self.testdata["timeout"]
while True:
list_ssvm_response = list_ssvms(
@@ -1094,10 +1094,10 @@ class TestBrowseUploadVolume(cloudstackTestCase):
break
if timeout == 0:
raise Exception("List SSVM call failed!")
-
+
time.sleep(self.testdata["sleep"])
timeout = timeout - 1
-
+
self.assertEqual(
isinstance(list_ssvm_response, list),
True,
@@ -1124,13 +1124,13 @@ class TestBrowseUploadVolume(cloudstackTestCase):
state='Running',
zoneid=self.zone.id
)
-
+
self.assertEqual(
isinstance(list_ssvm_response, list),
True,
"Check list response returns a valid list"
)
-
+
ssvm_response = list_ssvm_response[0]
hosts = list_hosts(
@@ -1164,7 +1164,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
break
if timeout == 0:
raise Exception("List SSVM call failed!")
-
+
time.sleep(self.testdata["sleep"])
timeout = timeout - 1
@@ -1227,7 +1227,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
break
if timeout == 0:
raise Exception("List SSVM call failed!")
-
+
time.sleep(self.testdata["sleep"])
timeout = timeout - 1
@@ -1257,7 +1257,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
True,
"Check whether SSVM has public IP field"
)
-
+
# Wait for the agent to be up
self.waitForSystemVMAgent(ssvm_response.name)
@@ -1510,10 +1510,10 @@ class TestBrowseUploadVolume(cloudstackTestCase):
@attr(tags = ["TODO"], required_hardware="true")
def test_02_SSVM_Life_Cycle_With_Browser_Template_TPath(self):
"""
- Test SSVM_Life_Cycle_With_Browser_template_TPath
+ Test SSVM_Life_Cycle_With_Browser_template_TPath
"""
try:
-
+
self.debug("========================= Test 11: Stop and Start SSVM and Perform Browser based volume validations ========================= ")
self.stop_ssvm()
diff --git a/test/integration/component/test_browse_volumes.py b/test/integration/component/test_browse_volumes.py
index 73b4cbb..6100a88 100644
--- a/test/integration/component/test_browse_volumes.py
+++ b/test/integration/component/test_browse_volumes.py
@@ -1978,7 +1978,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
@attr(tags=["advanced", "advancedns", "smoke", "basic"], required_hardware="true")
def test_01_Browser_volume_Life_cycle_tpath(self):
"""
- Test Browser_volume_Life_cycle - This includes upload volume,attach to a VM, write data ,Stop ,Start, Reboot,Reset of a VM, detach,attach back to the VM, delete volumes
+ Test Browser_volume_Life_cycle - This includes upload volume,attach to a VM, write data ,Stop ,Start, Reboot,Reset of a VM, detach,attach back to the VM, delete volumes
"""
try:
@@ -2228,7 +2228,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
@attr(tags=["advanced", "advancedns", "smoke", "basic"], required_hardware="true")
def test_03_Browser_Upload_Volume_Global_Config_TPath(self):
"""
- Test Browser_Upload_Volume_Global_Config limits
+ Test Browser_Upload_Volume_Global_Config limits
"""
try:
diff --git a/test/integration/component/test_host.py b/test/integration/component/test_host.py
index 56913f0..c0969d7 100644
--- a/test/integration/component/test_host.py
+++ b/test/integration/component/test_host.py
@@ -41,7 +41,7 @@ class TestHostHA(cloudstackTestCase):
self.logger.addHandler(self.stream_handler)
self.apiclient = self.testClient.getApiClient()
self.hypervisor = self.testClient.getHypervisorInfo()
- self.mgtSvrDetails = self.config.__dict__["mgtSvr"][0].__dict__
+ self.mgtSvrDetails = self.config.__dict__["mgtSvr"][0].__dict__
self.dbclient = self.testClient.getDbConnection()
self.services = self.testClient.getParsedTestDataConfig()
self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
@@ -85,7 +85,7 @@ class TestHostHA(cloudstackTestCase):
"sleep": 60,
"timeout": 10,
}
-
+
def tearDown(self):
try:
@@ -96,10 +96,10 @@ class TestHostHA(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e)
return
-
+
def checkHostDown(self, fromHostIp, testHostIp):
try:
- ssh = SshClient(fromHostIp, 22, "root", "password")
+ ssh = SshClient(fromHostIp, 22, "root", "password")
res = ssh.execute("ping -c 1 %s" % testHostIp)
result = str(res)
if result.count("100% packet loss") == 1:
@@ -109,10 +109,10 @@ class TestHostHA(cloudstackTestCase):
except Exception as e:
self.logger.debug("Got exception %s" % e)
return False, 1
-
+
def checkHostUp(self, fromHostIp, testHostIp):
try:
- ssh = SshClient(fromHostIp, 22, "root", "password")
+ ssh = SshClient(fromHostIp, 22, "root", "password")
res = ssh.execute("ping -c 1 %s" % testHostIp)
result = str(res)
if result.count(" 0% packet loss") == 1:
@@ -122,7 +122,7 @@ class TestHostHA(cloudstackTestCase):
except Exception as e:
self.logger.debug("Got exception %s" % e)
return False, 1
-
+
def checkHostStateInCloudstack(self, state, hostId):
try:
listHost = Host.list(
@@ -137,7 +137,7 @@ class TestHostHA(cloudstackTestCase):
True,
"Check if listHost returns a valid response"
)
-
+
self.assertEqual(
len(listHost),
1,
@@ -181,7 +181,7 @@ class TestHostHA(cloudstackTestCase):
def test_01_host_ha_with_nfs_storagepool_with_vm(self):
Configurations.update(self.apiclient, "ping.timeout", "150")
self.updateConfigurAndRestart("ping.interval", "150")
-
+
listHost = Host.list(
self.apiclient,
type='Routing',
@@ -190,11 +190,11 @@ class TestHostHA(cloudstackTestCase):
)
for host in listHost:
self.logger.debug('Hypervisor = {}'.format(host.id))
-
+
hostToTest = listHost[0]
hostUpInCloudstack = wait_until(40, 10, self.checkHostStateInCloudstack, "Up", hostToTest.id)
- if not(hostUpInCloudstack):
+ if not(hostUpInCloudstack):
raise self.fail("Host is not up %s, in cloudstack so failing test " % (hostToTest.ipaddress))
- return
+ return
diff --git a/test/integration/component/test_interop_xd_ccp.py b/test/integration/component/test_interop_xd_ccp.py
index 6987b52..ae5a9ae 100644
--- a/test/integration/component/test_interop_xd_ccp.py
+++ b/test/integration/component/test_interop_xd_ccp.py
@@ -79,7 +79,7 @@ class TestXDCCPInterop(cloudstackTestCase):
cls.apiclient,
type="Routing"
)
-
+
if hosts is None:
raise unittest.SkipTest(
"There are no hypervisor's available.Check list hosts response")
@@ -98,7 +98,7 @@ class TestXDCCPInterop(cloudstackTestCase):
raise unittest.SkipTest("Interop is not supported on KVM")
cls.uploadurl=cls.services["interop"][cls.uploadtemplateformat]["url"]
-
+
cls.xtemplate = get_template(
cls.apiclient,
cls.zone.id,
@@ -140,7 +140,7 @@ class TestXDCCPInterop(cloudstackTestCase):
timeout = cls.services["vgpu"]["timeout"]
while True:
- time.sleep(cls.services["vgpu"]["sleep"])
+ time.sleep(cls.services["vgpu"]["sleep"])
list_template_response = Template.list(
cls.apiclient,
templatefilter=cls.services["templatefilter"],
@@ -182,7 +182,7 @@ class TestXDCCPInterop(cloudstackTestCase):
cls.services["small"],
accountid=cls.account.name,
domainid=cls.account.domainid,
- serviceofferingid=cls.service_offering.id,
+ serviceofferingid=cls.service_offering.id,
mode=cls.services['mode'],
startvm="false"
)
@@ -324,7 +324,7 @@ class TestXDCCPInterop(cloudstackTestCase):
for zone1 in listallzones:
if zone1.allocationstate=="Enabled":
zonesavailable=zonesavailable+1
-
+
if zonesavailable<1:
self.fail("Check if zones are listed")
@@ -450,7 +450,7 @@ class TestXDCCPInterop(cloudstackTestCase):
@attr(tags = ["devcloud", "advanced", "advancedns", "basic", "sg"], required_hardware="true")
def test_07_start_vm(self):
"""
- Test Start Stopped Virtual Machine with volumes attached
+ Test Start Stopped Virtual Machine with volumes attached
"""
list_vm_response = VirtualMachine.list(
@@ -502,7 +502,7 @@ class TestXDCCPInterop(cloudstackTestCase):
"""
vm_available=0
-
+
cmd = listVirtualMachines.listVirtualMachinesCmd()
cmd.listall = True
cmd.zoneid=self.zone.id
@@ -563,7 +563,7 @@ class TestXDCCPInterop(cloudstackTestCase):
@attr(tags = ["devcloud", "advanced", "advancedns", "basic", "sg"], required_hardware="true")
def test_10_detach_volume(self):
"""
- Test Detach Volume
+ Test Detach Volume
"""
list_volume_response1 = Volume.list(
@@ -1200,7 +1200,7 @@ class TestXDCCPInterop(cloudstackTestCase):
self.skipTest("template creation from volume feature is not supported on %s" % self.hypervisor.lower())
try:
-
+
noffering=NetworkOffering.list(
self.user_api_client,
name="DefaultIsolatedNetworkOfferingWithSourceNatService"
diff --git a/test/integration/component/test_netscaler_configs.py b/test/integration/component/test_netscaler_configs.py
index 3bbd68a..b9db393 100644
--- a/test/integration/component/test_netscaler_configs.py
+++ b/test/integration/component/test_netscaler_configs.py
@@ -1146,10 +1146,10 @@ class TestGuestNetworkWithNetScaler(_NetScalerDeployVMBase):
"""
# Validate the following
- # 1. Configure Netscaler for load balancing.
+ # 1. Configure Netscaler for load balancing.
# 2. Create a Network offering with LB services provided by Netscaler
# and all other services by VR.
- # 3.Create a new account/user.
+ # 3.Create a new account/user.
# 4. Deploy the first VM using a network from the above created
# Network offering.
# In Netscaler:
@@ -1268,10 +1268,10 @@ class TestGuestNetworkWithNetScaler(_NetScalerDeployVMBase):
"""
# Validate the following
- # 1. Configure Netscaler for load balancing.
+ # 1. Configure Netscaler for load balancing.
# 2. Create a Network offering with LB services provided by Netscaler
# and all other services by VR.
- # 3.Create a new account/user.
+ # 3.Create a new account/user.
# 4. Deploy the first VM using a network from the above created
# Network offering.
# In Netscaler:
@@ -2031,7 +2031,7 @@ class TestServiceProvider(_NetScalerDeployVMBase):
"""
# Validate the following
- # 1. Configure Netscaler for load balancing.
+ # 1. Configure Netscaler for load balancing.
# 2. Create a Network offering. Do not enable the network offering
# 3. Try to create a network with this network offering.
# 4. Network creation should fail
@@ -2077,7 +2077,7 @@ class TestServiceProvider(_NetScalerDeployVMBase):
"""
# Validate the following
- # 1. Configure Netscaler for load balancing.
+ # 1. Configure Netscaler for load balancing.
# 2. Disable the service provider. Create a Network offering.
# 3. Try to create a network. Network creation should fail
@@ -2110,7 +2110,7 @@ class TestServiceProvider(_NetScalerDeployVMBase):
"""
# Validate the following
- # 1. Configure Netscaler for load balancing.
+ # 1. Configure Netscaler for load balancing.
# 2. Create a Network offering. Create instances and acquire public Ip
# 3. Disabled service provider and again try to create LB rules
# 4.Deploy VM should fail
@@ -2274,10 +2274,10 @@ class TestDeleteNetscaler(_NetScalerDeployVMBase):
"""
# Validate the following
- # 1. Configure Netscaler for load balancing.
+ # 1. Configure Netscaler for load balancing.
# 2. Create a Network offering with LB services provided by Netscaler
# and all other services by VR.
- # 3.Create a new account/user.
+ # 3.Create a new account/user.
# 4. Deploy the first VM using a network from the above created
# Network offering.
# 5. Attempt to delete Netscaler load balancer from zone.
diff --git a/test/integration/component/test_netscaler_lb_algo.py b/test/integration/component/test_netscaler_lb_algo.py
index 9e5001c..b0401eb 100644
--- a/test/integration/component/test_netscaler_lb_algo.py
+++ b/test/integration/component/test_netscaler_lb_algo.py
@@ -1663,7 +1663,7 @@ class TestLbAlgoSbLc(cloudstackTestCase):
except Exception as e:
if cls.exception_string.lower() in e.lower():
cls.skiptest = True
- cls.exception_msg =e
+ cls.exception_msg =e
else:
cls.tearDownClass()
raise Exception("Warning: Exception in setUpClass: %s" % e)
diff --git a/test/integration/component/test_non_contiguous_vlan.py b/test/integration/component/test_non_contiguous_vlan.py
index 3224a3a..41adb44 100644
--- a/test/integration/component/test_non_contiguous_vlan.py
+++ b/test/integration/component/test_non_contiguous_vlan.py
@@ -132,7 +132,7 @@ class TestNonContiguousVLANRanges(cloudstackTestCase):
self.physicalnetworkid = self.physicalnetwork.id
self.existingvlan = self.physicalnetwork.vlan
-
+
if self.vlan == None:
self.fail("Failed to set non contiguous vlan ids to test. Free some ids from \
from existing physical networks at extreme ends")
diff --git a/test/integration/component/test_organization_states.py b/test/integration/component/test_organization_states.py
index 2abb286..a84f59d 100644
--- a/test/integration/component/test_organization_states.py
+++ b/test/integration/component/test_organization_states.py
@@ -5,16 +5,16 @@
# 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.
-"""
+"""
Test cases relating to enabling/diabling of zone/pod/cluster/host
diff --git a/test/integration/component/test_project_configs.py b/test/integration/component/test_project_configs.py
index e2925ec..92337b9 100644
--- a/test/integration/component/test_project_configs.py
+++ b/test/integration/component/test_project_configs.py
@@ -5,9 +5,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
@@ -1213,7 +1213,7 @@ class TestProjectInviteTimeout(cloudstackTestCase):
def test_09_invite_to_project_by_email(self):
"""Test invite user to project by email"""
-
+
# Validate the following:
# 1. Set configuration to 5 mins
# 2. Create a Project
diff --git a/test/integration/component/test_project_limits.py b/test/integration/component/test_project_limits.py
index 4e13aa5..9a0a2b5 100644
--- a/test/integration/component/test_project_limits.py
+++ b/test/integration/component/test_project_limits.py
@@ -909,7 +909,7 @@ class TestResourceLimitsProject(cloudstackTestCase):
max=1,
projectid=self.project.id
)
-
+
# Register the First Template in the project
self.debug("Register the First Template in the project")
builtin_info = get_builtin_template_info(self.apiclient, self.zone.id)
@@ -949,7 +949,7 @@ class TestResourceLimitsProject(cloudstackTestCase):
time.sleep(self.services["sleep"])
timeout = timeout - 1
-
+
#Verify template response to check whether template added successfully
self.assertEqual(
isinstance(list_template_response, list),
diff --git a/test/integration/component/test_project_usage.py b/test/integration/component/test_project_usage.py
index 10028ed..ea7f740 100644
--- a/test/integration/component/test_project_usage.py
+++ b/test/integration/component/test_project_usage.py
@@ -871,7 +871,7 @@ class TestTemplateUsage(cloudstackTestCase):
time.sleep(self.services["sleep"])
timeout = timeout - 1
-
+
#Verify template response to check whether template added successfully
self.assertEqual(
isinstance(list_template_response, list),
@@ -891,9 +891,9 @@ class TestTemplateUsage(cloudstackTestCase):
True,
"Template state is not ready, it is %s" % template_response.isready
)
-
+
self.debug("Created template with ID: %s" % template.id)
-
+
# Delete template
template.delete(self.apiclient)
self.debug("Deleted template with ID: %s" % template.id)
diff --git a/test/integration/component/test_redundant_router_services.py b/test/integration/component/test_redundant_router_services.py
index 02d4d72..66e9870 100644
--- a/test/integration/component/test_redundant_router_services.py
+++ b/test/integration/component/test_redundant_router_services.py
@@ -5,9 +5,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
diff --git a/test/integration/component/test_secsr_mount.py b/test/integration/component/test_secsr_mount.py
index 3a69ec2..ee2afb5 100644
--- a/test/integration/component/test_secsr_mount.py
+++ b/test/integration/component/test_secsr_mount.py
@@ -94,7 +94,7 @@ class TestSecSRMount(cloudstackTestCase):
for storage_pool in storage_pools:
if storage_pool.type == 'NetworkFilesystem':
return False
-
+
return True
def download(self, apiclient, template_id, retries=12, interval=5):
@@ -149,10 +149,10 @@ class TestSecSRMount(cloudstackTestCase):
"xenserver"],
required_hardware="true")
def test_01_prepare_template_local_storage(self):
-
+
if not self.isOnlyLocalStorageAvailable():
self.skipTest("Skipping this test as this is for Local storage on only.")
-
+
listHost = Host.list(
self.apiclient,
type='Routing',
@@ -161,20 +161,20 @@ class TestSecSRMount(cloudstackTestCase):
)
for host in listHost:
self.logger.debug('Host id %s, hypervisor %s, localstorage %s' % (host.id, host.hypervisor, host.islocalstorageactive))
-
+
if len(listHost) < 2:
self.logger.debug("Prepare secondary storage race condition can be tested with two or more host only %s, found" % len(listHost));
self.skipTest("Prepare secondary storage can be tested with two host only %s, found" % len(listHost))
-
+
list_template_response = Template.list(
self.apiclient,
templatefilter='all',
zoneid=self.zone.id)
-
+
template_response = list_template_response[0]
-
+
self.logger.debug('Template id %s is Ready %s' % (template_response.id, template_response.isready))
-
+
if template_response.isready != True:
self.skipTest('Template id %s is Not Ready' % (template_response.id))
diff --git a/test/integration/component/test_stopped_vm.py b/test/integration/component/test_stopped_vm.py
index 4872ab2..1fef070 100644
--- a/test/integration/component/test_stopped_vm.py
+++ b/test/integration/component/test_stopped_vm.py
@@ -764,10 +764,10 @@ class TestDeployHaEnabledVM(cloudstackTestCase):
# Get Zone, Domain and templates
cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.skip = False
-
+
if cls.hypervisor.lower() == 'lxc':
if not find_storage_pool_type(cls.apiclient, storagetype='rbd'):
- cls.skip = True
+ cls.skip = True
return
cls.domain = get_domain(cls.api_client)
diff --git a/test/integration/component/test_tags.py b/test/integration/component/test_tags.py
index 79211c4..3a1de84 100644
--- a/test/integration/component/test_tags.py
+++ b/test/integration/component/test_tags.py
@@ -292,7 +292,7 @@ class TestResourceTags(cloudstackTestCase):
tag['resid'],
tag['restype'],
{concrete_tag['key']: concrete_tag['value']})
-
+
return
@attr(tags=["advanced"], required_hardware="false")
@@ -880,7 +880,7 @@ class TestResourceTags(cloudstackTestCase):
tag_key = 'scope5'
tag_value = 'test_05_vm_tag'
-
+
self.debug("Creating a tag for user VM")
tag = Tag.create(
self.apiclient,
@@ -1165,7 +1165,7 @@ class TestResourceTags(cloudstackTestCase):
tag_key = 'scope8'
tag_value = 'test_08_volume_tag'
-
+
if self.hypervisor.lower() == 'lxc':
if not find_storage_pool_type(self.apiclient, storagetype='rbd'):
self.skipTest("RBD storage type is required for data volumes for LXC")
@@ -1366,7 +1366,7 @@ class TestResourceTags(cloudstackTestCase):
tag_key = 'scope10'
tag_value = 'test_10_network_tag'
-
+
self.debug("Fetching the network details for account: %s" %
self.account.name)
networks = Network.list(
@@ -1465,7 +1465,7 @@ class TestResourceTags(cloudstackTestCase):
tag_key = 'scope11'
tag_value = 'test_11_migrate_tagged_vm_del'
-
+
if self.hypervisor.lower() in ['lxc']:
self.skipTest("vm migrate feature is not supported on %s" % self.hypervisor.lower())
@@ -1578,7 +1578,7 @@ class TestResourceTags(cloudstackTestCase):
tag_key = 'scope13'
tag_value = 'test_13_tag_case_insensitive'
-
+
self.debug("Creating a tag for user VM")
tag_1 = Tag.create(
self.apiclient,
@@ -1656,7 +1656,7 @@ class TestResourceTags(cloudstackTestCase):
tag_key = 'scope14'
tag_value = 'test_14_special_char_mutiple_tags'
-
+
self.debug("Creating a tag for user VM")
tag = Tag.create(
self.apiclient,
@@ -1729,7 +1729,7 @@ class TestResourceTags(cloudstackTestCase):
tag_key = 'scope15'
tag_value = 'test_15_project_tag'
-
+
# Create project as a domain admin
project = Project.create(
self.apiclient,
@@ -1824,9 +1824,9 @@ class TestResourceTags(cloudstackTestCase):
tag_key = 'scope16'
tag_value = 'test_16_query_tags_other_account'
-
+
self.debug("Creating user accounts..")
-
+
user_account = Account.create(
self.apiclient,
self.services["user"],
@@ -1910,7 +1910,7 @@ class TestResourceTags(cloudstackTestCase):
)
except Exception as e:
self.fail("Failed to delete the tag - %s" % e)
-
+
return
@attr(tags=["advanced", "basic"], required_hardware="false")
@@ -1925,7 +1925,7 @@ class TestResourceTags(cloudstackTestCase):
tag_key = 'scope17'
tag_value = 'test_17_query_tags_admin_account'
-
+
self.debug("Creating user accounts..")
user_account = Account.create(
@@ -2000,7 +2000,7 @@ class TestResourceTags(cloudstackTestCase):
)
except Exception as e:
self.fail("Failed to delete the tag - %s" % e)
-
+
return
@attr(tags=["advanced", "basic", "simulator"], required_hardware="false")
@@ -2013,7 +2013,7 @@ class TestResourceTags(cloudstackTestCase):
tag_key = 'scope18'
tag_value = 'test_18_invalid_list_parameters'
-
+
self.debug("Creating a tag for user VM")
tag = Tag.create(
self.apiclient,
@@ -2060,8 +2060,8 @@ class TestResourceTags(cloudstackTestCase):
# 2. Add same tag.
tag_key = 'scope19'
- tag_value = 'test_19_delete_add_same_tag'
-
+ tag_value = 'test_19_delete_add_same_tag'
+
self.debug("Creating a tag for user VM")
tag = Tag.create(
self.apiclient,
@@ -2165,9 +2165,9 @@ class TestResourceTags(cloudstackTestCase):
tag_key = 'scope20'
tag_value = 'test_20_create_tags_multiple_resources'
-
+
self.debug("Creating volume for account: %s " % self.account.name)
-
+
volume = Volume.create(
self.apiclient,
self.services["volume"],
@@ -2272,8 +2272,8 @@ class TestResourceTags(cloudstackTestCase):
"Test creation of tag on stopped vm."
tag_key = 'scope21'
- tag_value = 'test_21_create_tag_stopped_vm'
-
+ tag_value = 'test_21_create_tag_stopped_vm'
+
try:
self.debug("Stopping the virtual machine: %s" % self.vm_1.name)
# Stop virtual machine
@@ -2326,7 +2326,7 @@ class TestResourceTags(cloudstackTestCase):
tag_key = 'scope22'
tag_value = 'test_22_create_tag_destroyed_vm'
-
+
self.debug("Destroying instance: %s" % self.vm_1.name)
self.vm_1.delete(self.apiclient, expunge=False)
@@ -2481,7 +2481,7 @@ class TestResourceTags(cloudstackTestCase):
tag_key = 'scope24'
tag_value = 'test_24_public_ip_tag'
-
+
self.debug("Creating a sub-domain under: %s" % self.domain.name)
self.child_domain = Domain.create(
self.apiclient,
@@ -2652,7 +2652,7 @@ class TestResourceTags(cloudstackTestCase):
received_tag_map = {}
for t in received_tags:
received_tag_map[t.key] = t.value
-
+
self.assertEqual(
set_tags,
received_tag_map,
@@ -2680,7 +2680,7 @@ class TestResourceTags(cloudstackTestCase):
"List tags should return empty list response when tags are removed."
)
return
-
+
@attr(tags=["advanced","basic"], required_hardware="false")
def test_25_admin_account_tags(self):
'''Test create, list, delete tag for admin account from admin account'''
@@ -2689,7 +2689,7 @@ class TestResourceTags(cloudstackTestCase):
self.__test_account_tags(self.apiclient, admin_account[0])
return
- @attr(tags=["advanced","basic"], required_hardware="false")
+ @attr(tags=["advanced","basic"], required_hardware="false")
def test_26_domain_admin_account_tags(self):
child_domain = Domain.create(
self.apiclient,
@@ -2725,7 +2725,7 @@ class TestResourceTags(cloudstackTestCase):
regular_account_api_client = self.testClient.getUserApiClient(UserName=regular_account.name, DomainName=self.domain.name)
self.__test_account_tags(regular_account_api_client, regular_account)
return
-
+
@attr(tags=["advanced","basic"], required_hardware="false")
def test_28_admin_access_domain_admin_account_tags(self):
'''Test create, list, delete tag for domain admin account from admin account'''
@@ -2783,7 +2783,7 @@ class TestResourceTags(cloudstackTestCase):
)
# Cleanup the resources created at end of test
self.cleanup.append(regular_account)
-
+
# Cleanup the resources created at end of test
self.cleanup.append(child_domain_admin)
self.cleanup.append(child_domain)
@@ -2804,14 +2804,14 @@ class TestResourceTags(cloudstackTestCase):
tag_key_admin = 'scope31_admin'
tag_value_admin = 'test_31_user_cant_remove_update_admin_tags'
-
+
regular_account = Account.create(
self.apiclient,
self.services["account"],
admin=False
)
self.cleanup.append(regular_account)
-
+
regular_account_api_client = self.testClient.getUserApiClient(UserName=regular_account.name, DomainName=self.domain.name)
def create_admin_tag():
@@ -2820,7 +2820,7 @@ class TestResourceTags(cloudstackTestCase):
resourceIds=regular_account.id,
resourceType='Account',
tags={ tag_key_admin: tag_value_admin})
-
+
def create_user_tag():
return Tag.create(
@@ -2828,7 +2828,7 @@ class TestResourceTags(cloudstackTestCase):
resourceIds=regular_account.id,
resourceType='Account',
tags={ tag_key_user: tag_value_user})
-
+
create_admin_tag()
create_user_tag()
@@ -2845,7 +2845,7 @@ class TestResourceTags(cloudstackTestCase):
def tags_to_map(tags):
m = {}
for t in tags:
- m[t.key] = t.value
+ m[t.key] = t.value
return m
# admin requests user account tags and gets None (without listall)
@@ -2870,7 +2870,7 @@ class TestResourceTags(cloudstackTestCase):
tags_to_map(received_tags_user),
{tag_key_admin: tag_value_admin, tag_key_user: tag_value_user},
"List (with listAll=false) tags should return information for user tags"
- )
+ )
# user requests own account tags and receives all (with listall)
received_tags_user_listall = list_tags(regular_account_api_client, True)
@@ -2879,11 +2879,11 @@ class TestResourceTags(cloudstackTestCase):
{tag_key_admin: tag_value_admin, tag_key_user: tag_value_user},
"List (with listAll=false) tags should return information for user tags"
)
-
+
#
# Delete test expressions
#
-
+
def delete_tags(apiclient, tags):
Tag.delete(
apiclient,
@@ -2891,12 +2891,12 @@ class TestResourceTags(cloudstackTestCase):
resourceType='Account',
tags=tags)
- # user tries to delete admin tag on own account and succeeds
+ # user tries to delete admin tag on own account and succeeds
try:
delete_tags(regular_account_api_client, {tag_key_admin: tag_value_admin})
except Exception as e:
self.fail("Regular user is not able to delete administrator tag on own account - %s" % e)
-
+
# user tries to delete user tag and succeeds
try:
delete_tags(regular_account_api_client, {tag_key_user: tag_value_user})
@@ -2906,15 +2906,15 @@ class TestResourceTags(cloudstackTestCase):
# recover tag to run admin tests
create_user_tag()
create_admin_tag()
-
+
# admin tries to delete tags and succeeds
try:
delete_tags(self.apiclient, {tag_key_admin: tag_value_admin, tag_key_user: tag_value_user})
except Exception as e:
- self.fail("Administrator is not able to delete a tag - %s" % e)
+ self.fail("Administrator is not able to delete a tag - %s" % e)
return
-
+
@attr(tags=["advanced","basic"], required_hardware="false")
def test_32_user_a_doesnt_have_access_to_user_b_tags(self):
'''Test resource security between regular accounts A and B'''
@@ -2924,7 +2924,7 @@ class TestResourceTags(cloudstackTestCase):
tag_key_user2 = 'scope32_user2'
tag_value_user2 = 'test_32_user_a_doesnt_have_access_to_user_b_tags-user2'
-
+
regular_account1 = Account.create(
self.apiclient,
self.services["account"],
@@ -2975,7 +2975,7 @@ class TestResourceTags(cloudstackTestCase):
except Exception as e:
pass
else:
- self.fail("User1 has access to delete tags of User2.")
+ self.fail("User1 has access to delete tags of User2.")
try:
Tag.create(
@@ -2987,7 +2987,7 @@ class TestResourceTags(cloudstackTestCase):
pass
else:
self.fail("User1 has access to create tags for User2.")
-
+
return
@attr(tags=["advanced", "basic"], required_hardware="false")
diff --git a/test/integration/component/test_updateResourceCount.py b/test/integration/component/test_updateResourceCount.py
index cc02468..8691583 100644
--- a/test/integration/component/test_updateResourceCount.py
+++ b/test/integration/component/test_updateResourceCount.py
@@ -143,7 +143,7 @@ class TestUpdateResourceCount(cloudstackTestCase):
)
self.debug("Created account: %s" % self.account.name)
self.cleanup.append(self.account)
-
+
return
def tearDown(self):
@@ -165,7 +165,7 @@ class TestUpdateResourceCount(cloudstackTestCase):
def test_01_updateResourceCount(self):
"""Test update resource count for an account using a custom service offering to deploy a VM.
"""
-
+
# This test will execute the following steps to assure resource count update is working properly
# 1. Create an account.
# 2. Start 2 VMs; one with normal service offering and other with a custom service offering
@@ -173,7 +173,7 @@ class TestUpdateResourceCount(cloudstackTestCase):
# The two VMs will add up to 3 CPUs and 1024Mb of RAM.
# 4. If the return of updateResourceCount method matches with the expected one, the test passes; otherwise, it fails.
# 5. Remove everything created by deleting the account
-
+
vm_1 = VirtualMachine.create(
self.apiclient,
self.services["virtual_machine"],
@@ -184,12 +184,12 @@ class TestUpdateResourceCount(cloudstackTestCase):
customcpuspeed = 1000,
custommemory = 512
)
-
+
self.debug("Deployed VM 1 in account: %s, ID: %s" % (
self.account.name,
vm_1.id
))
-
+
vm_2 = VirtualMachine.create(
self.apiclient,
self.services["virtual_machine"],
@@ -207,8 +207,8 @@ class TestUpdateResourceCount(cloudstackTestCase):
resourcetype=8,
account=self.account.name,
domainid=self.account.domainid
- )
-
+ )
+
self.debug("ResourceCount for CPU: %s" % (
resourceCountCpu[0].resourcecount
))
@@ -222,8 +222,8 @@ class TestUpdateResourceCount(cloudstackTestCase):
resourcetype=9,
account=self.account.name,
domainid=self.account.domainid
- )
-
+ )
+
self.debug("ResourceCount for memory: %s" % (
resourceCountMemory[0].resourcecount
))
diff --git a/test/integration/component/test_volume_destroy_recover.py b/test/integration/component/test_volume_destroy_recover.py
index 5c0a873..e90f55c 100644
--- a/test/integration/component/test_volume_destroy_recover.py
+++ b/test/integration/component/test_volume_destroy_recover.py
@@ -353,13 +353,13 @@ class TestVolumeDestroyRecover(cloudstackTestCase):
Steps:
# 1. create vm without data disk, resource count increases.
- # 2. restore vm. resource count no changes.
+ # 2. restore vm. resource count no changes.
# 3. check old root disk , should be Destroy state
# 4. recover old root disk. resource count increases.
# 5. delete old root disk . resource count decreases.
# 6. destroy vm (expunge=True). resource count decreased with size of root disk
"""
-
+
# Create vm
try:
virtual_machine_3 = VirtualMachine.create(
@@ -379,7 +379,7 @@ class TestVolumeDestroyRecover(cloudstackTestCase):
self.volumeTotal = self.volumeTotal + 1
self.verify_resource_count_primary_storage(self.expectedCount, self.volumeTotal);
- # Get id of root disk
+ # Get id of root disk
root_volumes_list = Volume.list(
self.apiclient,
virtualmachineid=virtual_machine_3.id,
@@ -440,7 +440,7 @@ class TestVolumeDestroyRecover(cloudstackTestCase):
# 5. destroy volume (expunge = false), Exception happened. resource count no changes
# 6. destroy volume (expunge = true). volume is not found. resource count no changes.
"""
-
+
# Create vm
try:
virtual_machine_4 = VirtualMachine.create(
diff --git a/test/integration/component/test_vpc_network_lbrules.py b/test/integration/component/test_vpc_network_lbrules.py
index ee7ecc4..8f137ad 100644
--- a/test/integration/component/test_vpc_network_lbrules.py
+++ b/test/integration/component/test_vpc_network_lbrules.py
@@ -511,7 +511,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
@attr(tags=["advanced", "intervlan"], required_hardware="true")
def test_03_VPC_CreateLBRuleInMultipleNetworksVRStoppedState(self):
- """ Test case no 222 : Create LB rules for a two/multiple virtual networks of a
+ """ Test case no 222 : Create LB rules for a two/multiple virtual networks of a
VPC using a new Public IP Address available with the VPC when the Virtual Router is in Stopped State
# Validate the following
@@ -544,7 +544,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
self.create_LB_Rule(public_ip_1, network_1, [vm_1, vm_2])
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
- return
+ return
@attr(tags=["advanced","advancedns", "intervlan"], required_hardware="true")
def test_04_VPC_CreateLBRuleInMultipleNetworksVRStoppedState(self):
@@ -643,7 +643,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
lb_rule_nat.delete(self.apiclient)
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
- return
+ return
@attr(tags=["advanced", "intervlan"], required_hardware="true")
def test_07_VPC_CreateAndDeleteAllLBRule(self):
diff --git a/test/integration/component/test_vpc_network_staticnatrule.py b/test/integration/component/test_vpc_network_staticnatrule.py
index bba7250..844e74b 100644
--- a/test/integration/component/test_vpc_network_staticnatrule.py
+++ b/test/integration/component/test_vpc_network_staticnatrule.py
@@ -378,7 +378,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
@attr(tags=["advanced", "intervlan"], required_hardware="true")
def test_01_VPC_StaticNatRuleCreateStoppedState(self):
- """ Test case no extra :
+ """ Test case no extra :
# Validate the following
# 1. Create a VPC with cidr - 10.1.1.1/16
@@ -406,7 +406,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
@attr(tags=["advanced", "intervlan"], required_hardware="true")
def test_02_VPC_CreateStaticNatRule(self):
- """ Test case no 229 : Create Static NAT Rule for a single virtual network of
+ """ Test case no 229 : Create Static NAT Rule for a single virtual network of
a VPC using a new Public IP Address available with the VPC when the Virtual Router is in Running State
# Validate the following
@@ -469,7 +469,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
@attr(tags=["advanced", "intervlan"], required_hardware="true")
def test_04_VPC_CreateMultipleStaticNatRule(self):
- """ Test case no 230 : Create Static NAT Rules for a two/multiple virtual networks of
+ """ Test case no 230 : Create Static NAT Rules for a two/multiple virtual networks of
a VPC using a new Public IP Address available with the VPC when the Virtual Router is in Running State
# Validate the following
@@ -503,7 +503,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
# was tags=["advanced", "intervlan"]
@attr(tags=["TODO"], required_hardware="true")
def test_05_network_services_VPC_DeleteAllPF(self):
- """ Test case no 232: Delete all Static NAT Rules for a single virtual network of
+ """ Test case no 232: Delete all Static NAT Rules for a single virtual network of
a VPC belonging to a single Public IP Address when the Virtual Router is in Running State
# Validate the following
@@ -536,7 +536,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
# was tags=["advanced", "intervlan"]
@attr(tags=["TODO"], required_hardware="true")
def test_06_network_services_VPC_DeleteAllMultiplePF(self):
- """ Test case no 233: Delete all Static NAT rules for two/multiple virtual networks of a VPC.
+ """ Test case no 233: Delete all Static NAT rules for two/multiple virtual networks of a VPC.
Observe the status of the Public IP Addresses of the rules when the Virtual Router is in Running State.
# Validate the following
diff --git a/test/integration/component/test_vpc_vm_life_cycle.py b/test/integration/component/test_vpc_vm_life_cycle.py
index ce3e28a..3d41dca 100644
--- a/test/integration/component/test_vpc_vm_life_cycle.py
+++ b/test/integration/component/test_vpc_vm_life_cycle.py
@@ -655,10 +655,10 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
'Destroyed',
"VM state should be destroyed"
)
-
+
except Exception as e:
self.fail("Failed to stop the virtual instances, %s" % e)
-
+
# Check if the network rules still exists after Vm stop
self.debug("Checking if NAT rules ")
nat_rules = NATRule.list(
@@ -703,7 +703,7 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
except Exception as e:
self.fail("Failed to recover the virtual instances, %s" % e)
-
+
try:
self.vm_2.delete(self.apiclient, expunge=False)
@@ -727,7 +727,7 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
self.fail("Failed to stop the virtual instances, %s" % e)
self.debug("Recovering the expunged virtual machine vm2 in account: %s" %
- self.account.name)
+ self.account.name)
try:
self.vm_2.recover(self.apiclient)
@@ -1779,10 +1779,10 @@ class TestVMLifeCycleStoppedVPCVR(cloudstackTestCase):
'Destroyed',
"VM state should be destroyed"
)
-
+
except Exception as e:
self.fail("Failed to stop the virtual instances, %s" % e)
-
+
# Check if the network rules still exists after Vm stop
self.debug("Checking if NAT rules ")
nat_rules = NATRule.list(
@@ -1827,7 +1827,7 @@ class TestVMLifeCycleStoppedVPCVR(cloudstackTestCase):
except Exception as e:
self.fail("Failed to recover the virtual instances, %s" % e)
-
+
try:
self.vm_2.delete(self.apiclient, expunge=False)
@@ -1848,7 +1848,7 @@ class TestVMLifeCycleStoppedVPCVR(cloudstackTestCase):
self.fail("Failed to stop the virtual instances, %s" % e)
self.debug("Recovering the expunged virtual machine vm2 in account: %s" %
- self.account.name)
+ self.account.name)
try:
self.vm_2.recover(self.apiclient)
@@ -2494,10 +2494,10 @@ class TestVMLifeCycleDiffHosts(cloudstackTestCase):
'Destroyed',
"VM state should be destroyed"
)
-
+
except Exception as e:
self.fail("Failed to stop the virtual instances, %s" % e)
-
+
# Check if the network rules still exists after Vm stop
self.debug("Checking if NAT rules ")
nat_rules = NATRule.list(
@@ -2542,7 +2542,7 @@ class TestVMLifeCycleDiffHosts(cloudstackTestCase):
except Exception as e:
self.fail("Failed to recover the virtual instances, %s" % e)
-
+
try:
self.vm_2.delete(self.apiclient, expunge=False)
@@ -2563,7 +2563,7 @@ class TestVMLifeCycleDiffHosts(cloudstackTestCase):
self.fail("Failed to stop the virtual instances, %s" % e)
self.debug("Recovering the expunged virtual machine vm2 in account: %s" %
- self.account.name)
+ self.account.name)
try:
self.vm_2.recover(self.apiclient)
diff --git a/test/integration/plugins/datera/TestVolumes.py b/test/integration/plugins/datera/TestVolumes.py
index 15c326b..68d9896 100644
--- a/test/integration/plugins/datera/TestVolumes.py
+++ b/test/integration/plugins/datera/TestVolumes.py
@@ -339,7 +339,7 @@ class TestVolumes(cloudstackTestCase):
2. Init Datera API connection
3. Create ACS Primary storage
4. Create ACS compute and disk offering.
- 5. Create ACS data disk without attaching to a VM
+ 5. Create ACS data disk without attaching to a VM
"""
logger.info("Setting up Class")
diff --git a/test/integration/plugins/test_quota.py b/test/integration/plugins/test_quota.py
index 420d4a9..5a8530c 100644
--- a/test/integration/plugins/test_quota.py
+++ b/test/integration/plugins/test_quota.py
@@ -79,7 +79,7 @@ class TestQuota(cloudstackTestCase):
name='quota.enable.service',
value='true'):
self.skipTest('quota.enable.service should be true. skipping')
-
+
cmd = quotaTariffList.quotaTariffListCmd()
response = self.apiclient.quotaTariffList(cmd)
@@ -105,7 +105,7 @@ class TestQuota(cloudstackTestCase):
name='quota.enable.service',
value='true'):
self.skipTest('quota.enable.service should be true. skipping')
-
+
cmd = quotaTariffList.quotaTariffListCmd()
cmd.startdate='2015-07-06'
response = self.apiclient.quotaTariffList(cmd)
@@ -125,7 +125,7 @@ class TestQuota(cloudstackTestCase):
name='quota.enable.service',
value='true'):
self.skipTest('quota.enable.service should be true. skipping')
-
+
cmd = quotaTariffList.quotaTariffListCmd()
cmd.startdate='2015-07-06'
cmd.usagetype='10'
@@ -149,7 +149,7 @@ class TestQuota(cloudstackTestCase):
name='quota.enable.service',
value='true'):
self.skipTest('quota.enable.service should be true. skipping')
-
+
cmd = quotaTariffList.quotaTariffListCmd()
cmd.startdate='2015-07-06'
cmd.usagetype='10'
@@ -205,7 +205,7 @@ class TestQuota(cloudstackTestCase):
name='quota.enable.service',
value='true'):
self.skipTest('quota.enable.service should be true. skipping')
-
+
cmd = quotaCredits.quotaCreditsCmd()
cmd.domainid = self.account.domainid
cmd.account = self.account.name
@@ -227,7 +227,7 @@ class TestQuota(cloudstackTestCase):
name='quota.enable.service',
value='true'):
self.skipTest('quota.enable.service should be true. skipping')
-
+
cmd = quotaBalance.quotaBalanceCmd()
today = datetime.date.today()
cmd.domainid = self.account.domainid
@@ -248,13 +248,13 @@ class TestQuota(cloudstackTestCase):
name='quota.enable.service',
value='true'):
self.skipTest('quota.enable.service should be true. skipping')
-
+
cmd = quotaBalance.quotaBalanceCmd()
today = datetime.date.today()
cmd.domainid = self.account.domainid
cmd.account = self.account.name
cmd.startdate = today - datetime.timedelta(days=2)
- cmd.enddate = today
+ cmd.enddate = today
response = self.apiclient.quotaBalance(cmd)
self.debug("Quota Balance: {response.balance}")
diff --git a/test/integration/smoke/__init__.py b/test/integration/smoke/__init__.py
index 978b68a..13a8339 100644
--- a/test/integration/smoke/__init__.py
+++ b/test/integration/smoke/__init__.py
@@ -5,9 +5,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
diff --git a/test/integration/smoke/test_affinity_groups.py b/test/integration/smoke/test_affinity_groups.py
index f58f3d9..26271f6 100644
--- a/test/integration/smoke/test_affinity_groups.py
+++ b/test/integration/smoke/test_affinity_groups.py
@@ -38,7 +38,7 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
cls.testClient = super(TestDeployVmWithAffinityGroup, cls).getClsTestClient()
zone_name = cls.testClient.getZoneForTests()
cls.apiclient = cls.testClient.getApiClient()
- cls.domain = get_domain(cls.apiclient)
+ cls.domain = get_domain(cls.apiclient)
cls.services = cls.testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
@@ -49,10 +49,10 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
cls.zone.id,
cls.hypervisor
)
-
+
if cls.template == FAILED:
assert False, "get_template() failed to return template"
-
+
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["template"] = cls.template.id
diff --git a/test/integration/smoke/test_affinity_groups_projects.py b/test/integration/smoke/test_affinity_groups_projects.py
index d502952..851fee2 100644
--- a/test/integration/smoke/test_affinity_groups_projects.py
+++ b/test/integration/smoke/test_affinity_groups_projects.py
@@ -36,7 +36,7 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
cls.testClient = super(TestDeployVmWithAffinityGroup, cls).getClsTestClient()
zone_name = cls.testClient.getZoneForTests()
cls.apiclient = cls.testClient.getApiClient()
- cls.domain = get_domain(cls.apiclient)
+ cls.domain = get_domain(cls.apiclient)
cls.services = cls.testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
@@ -47,7 +47,7 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
cls.zone.id,
cls.hypervisor
)
-
+
if cls.template == FAILED:
assert False, "get_test_template() failed to return template"
diff --git a/test/integration/smoke/test_backup_recovery_dummy.py b/test/integration/smoke/test_backup_recovery_dummy.py
index 0c7ae64..b4789bd 100644
--- a/test/integration/smoke/test_backup_recovery_dummy.py
+++ b/test/integration/smoke/test_backup_recovery_dummy.py
@@ -53,17 +53,17 @@ class TestDummyBackupAndRecovery(cloudstackTestCase):
Configurations.update(cls.api_client, 'backup.framework.enabled', value='true', zoneid=cls.zone.id)
if cls.backup_provider != "dummy":
Configurations.update(cls.api_client, 'backup.framework.provider.plugin', value='dummy', zoneid=cls.zone.id)
-
+
if cls.hypervisor.lower() != 'simulator':
return
-
+
cls.account = Account.create(cls.api_client, cls.services["account"], domainid=cls.domain.id)
cls.offering = ServiceOffering.create(cls.api_client,cls.services["service_offerings"]["small"])
cls.vm = VirtualMachine.create(cls.api_client, cls.services["small"], accountid=cls.account.name,
domainid=cls.account.domainid, serviceofferingid=cls.offering.id,
mode=cls.services["mode"])
cls._cleanup = [cls.offering, cls.account]
-
+
# Import a dummy backup offering to use on tests
cls.provider_offerings = BackupOffering.listExternal(cls.api_client, cls.zone.id)
diff --git a/test/integration/smoke/test_create_list_domain_account_project.py b/test/integration/smoke/test_create_list_domain_account_project.py
index 5f0f945..3e14812 100644
--- a/test/integration/smoke/test_create_list_domain_account_project.py
+++ b/test/integration/smoke/test_create_list_domain_account_project.py
@@ -133,7 +133,7 @@ class TestDomainAccountProject(cloudstackTestCase):
self.assertIsNone(list_domain_response[0].cpulimit, "'cpulimit' should not be included in response")
- # Create account
+ # Create account
self.account = Account.create(
self.apiclient,
self.services["account"],
diff --git a/test/integration/smoke/test_deploy_vgpu_enabled_vm.py b/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
index 6df6408..7ed4c8a 100644
--- a/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
+++ b/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
@@ -86,7 +86,7 @@ class TestDeployvGPUenabledVM(cloudstackTestCase):
# No XenServer available with GPU Drivers installed
self.noSuitableHost = True
return
-
+
def setUp(self):
self.testdata = self.testClient.getParsedTestDataConfig()["vgpu"]
self.apiclient = self.testClient.getApiClient()
@@ -97,7 +97,7 @@ class TestDeployvGPUenabledVM(cloudstackTestCase):
self.skipTest("Skipping test because suitable hypervisor/host not\
present")
self.testdata = self.testClient.getParsedTestDataConfig()
-
+
self.cleanup = []
# Get Zone, Domain and Default Built-in template
@@ -111,7 +111,7 @@ class TestDeployvGPUenabledVM(cloudstackTestCase):
)
if self.hypervisor.lower() in ["xenserver"]:
-
+
# Before running this test for Xen Server, register a windows template with ostype as
# 'Windows 7 (32-bit)'
self.template = get_template(
@@ -119,7 +119,7 @@ class TestDeployvGPUenabledVM(cloudstackTestCase):
self.zone.id,
self.testdata["ostype"])
self.cleanup.append(self.template)
-
+
self.testdata["mode"] = self.zone.networktype
if self.template == FAILED:
@@ -139,10 +139,10 @@ class TestDeployvGPUenabledVM(cloudstackTestCase):
self.testdata["service_offerings"]["vgpu260qwin"],
)
self.cleanup.append(self.service_offering)
-
+
elif self.hypervisor.lower() in ["vmware"]:
self.testdata["isolated_network"]["zoneid"] = self.zone.id
-
+
self.userapiclient = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain
@@ -157,7 +157,7 @@ class TestDeployvGPUenabledVM(cloudstackTestCase):
self.testdata["isolated_network_offering"])
# Enable Isolated Network offering
self.isolated_network_offering.update(self.apiclient, state='Enabled')
-
+
# Register a private template in the account with nic adapter vmxnet3
# Also add required 3D GPU details for enabling it
self.template = Template.register(
@@ -169,7 +169,7 @@ class TestDeployvGPUenabledVM(cloudstackTestCase):
details=[{"mks.enable3d" : "true", "mks.use3dRenderer" : "automatic",
"svga.autodetect" : "false", "svga.vramSize" : "131072"}]
)
-
+
@attr(tags=['advanced', 'basic', 'vgpu'], required_hardware="true")
def test_deploy_vgpu_enabled_vm(self):
@@ -184,7 +184,7 @@ class TestDeployvGPUenabledVM(cloudstackTestCase):
self.cleanup.append(self.account)
self.skipTest("This test case is written specifically\
for XenServer hypervisor")
-
+
self.virtual_machine = VirtualMachine.create(
self.apiclient,
self.testdata["small"],
@@ -243,11 +243,11 @@ class TestDeployvGPUenabledVM(cloudstackTestCase):
user=self.testdata['configurableData']['host']["username"],
passwd=self.testdata['configurableData']['host']["password"])
res = sshClient.execute(
- "xe vgpu-list vm-name-label=%s params=type-uuid %s" %
+ "xe vgpu-list vm-name-label=%s params=type-uuid %s" %
(vm.instancename))
self.debug("SSH result: %s" % res)
except Exception as e:
- self.fail("SSH Access failed for %s: %s" %
+ self.fail("SSH Access failed for %s: %s" %
(hostip, e)
)
result = str(res)
@@ -314,7 +314,7 @@ class TestDeployvGPUenabledVM(cloudstackTestCase):
networkofferingid=self.isolated_network_offering.id)
self.virtual_machine.add_nic(self.apiclient, self.isolated_network.id)
-
+
self.cleanup = [self.virtual_machine, self.isolated_network, self.isolated_network_offering, self.service_offering, self.account, self.template]
qresultset = self.dbclient.execute("select id from vm_instance where uuid = '%s';" % self.virtual_machine.id)
diff --git a/test/integration/smoke/test_deploy_vm_with_userdata.py b/test/integration/smoke/test_deploy_vm_with_userdata.py
index ced0d3c..b395bf9 100644
--- a/test/integration/smoke/test_deploy_vm_with_userdata.py
+++ b/test/integration/smoke/test_deploy_vm_with_userdata.py
@@ -33,7 +33,7 @@ class TestDeployVmWithUserData(cloudstackTestCase):
@classmethod
def setUpClass(cls):
testClient = super(TestDeployVmWithUserData, cls).getClsTestClient()
- cls.apiClient = testClient.getApiClient()
+ cls.apiClient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
cls.zone = get_zone(cls.apiClient, testClient.getZoneForTests())
diff --git a/test/integration/smoke/test_guest_vlan_range.py b/test/integration/smoke/test_guest_vlan_range.py
index 12ea52e..f1f8fe1 100644
--- a/test/integration/smoke/test_guest_vlan_range.py
+++ b/test/integration/smoke/test_guest_vlan_range.py
@@ -130,4 +130,4 @@ class TestDedicateGuestVlanRange(cloudstackTestCase):
None,
"Check vlan range is not available in listDedicatedGuestVlanRanges"
- )
+ )
diff --git a/test/integration/smoke/test_list_ids_parameter.py b/test/integration/smoke/test_list_ids_parameter.py
index e5053cb..b0554f3 100644
--- a/test/integration/smoke/test_list_ids_parameter.py
+++ b/test/integration/smoke/test_list_ids_parameter.py
@@ -37,7 +37,7 @@ import time
_multiprocess_shared_ = True
class TestListIdsParams(cloudstackTestCase):
-
+
@classmethod
def setUpClass(cls):
testClient = super(TestListIdsParams, cls).getClsTestClient()
@@ -125,7 +125,7 @@ class TestListIdsParams(cloudstackTestCase):
cls.virtual_machine_2.stop(cls.apiclient)
cls.virtual_machine_3.stop(cls.apiclient)
- #Get ROOT volumes of 3 VMs
+ #Get ROOT volumes of 3 VMs
vm1RootVolumeResponse = Volume.list(
cls.apiclient,
virtualmachineid=cls.virtual_machine_1.id,
@@ -190,7 +190,7 @@ class TestListIdsParams(cloudstackTestCase):
account=cls.account.name,
domainid=cls.account.domainid
)
-
+
cls._cleanup = [
cls.snapshot_1,
cls.snapshot_2,
diff --git a/test/integration/smoke/test_loadbalance.py b/test/integration/smoke/test_loadbalance.py
index 53047f9..4d0e31b 100644
--- a/test/integration/smoke/test_loadbalance.py
+++ b/test/integration/smoke/test_loadbalance.py
@@ -34,7 +34,7 @@ class TestLoadBalance(cloudstackTestCase):
def setUpClass(cls):
testClient = super(TestLoadBalance, cls).getClsTestClient()
- cls.apiclient = testClient.getApiClient()
+ cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
diff --git a/test/integration/smoke/test_nested_virtualization.py b/test/integration/smoke/test_nested_virtualization.py
index 547c05d..c1f96f6 100644
--- a/test/integration/smoke/test_nested_virtualization.py
+++ b/test/integration/smoke/test_nested_virtualization.py
@@ -42,7 +42,7 @@ class TestNestedVirtualization(cloudstackTestCase):
testClient = super(TestNestedVirtualization, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
-
+
cls.logger = logging.getLogger('TestNestedVirtualization')
cls.stream_handler = logging.StreamHandler()
cls.logger.setLevel(logging.DEBUG)
@@ -69,7 +69,7 @@ class TestNestedVirtualization(cloudstackTestCase):
cls.services["isolated_network_offering"])
# Enable Isolated Network offering
cls.isolated_network_offering.update(cls.apiclient, state='Enabled')
-
+
if cls.template == FAILED:
assert False, "get_test_template() failed to return template"
@@ -83,7 +83,7 @@ class TestNestedVirtualization(cloudstackTestCase):
"""Test nested virtualization on Vmware hypervisor"""
if self.hypervisor.lower() not in ["vmware"]:
self.skipTest("Skipping test because suitable hypervisor/host not present")
-
+
# 1) Update nested virtualization configurations, if needed
configs = Configurations.list(self.apiclient, name="vmware.nested.virtualization")
rollback_nv = False
diff --git a/test/integration/smoke/test_password_server.py b/test/integration/smoke/test_password_server.py
index 231f8ba..ebc3c48 100644
--- a/test/integration/smoke/test_password_server.py
+++ b/test/integration/smoke/test_password_server.py
@@ -334,7 +334,7 @@ class TestIsolatedNetworksPasswdServer(cloudstackTestCase):
'Active',
"Check list port forwarding rules"
)
-
+
nat_rules = list_nat_rules(
self.apiclient,
id=nat_rule2.id
@@ -349,7 +349,7 @@ class TestIsolatedNetworksPasswdServer(cloudstackTestCase):
'Active',
"Check list port forwarding rules"
)
-
+
self.test_ssh_command(self.vm_1, nat_rule1, "natrule1")
self.test_ssh_command(self.vm_2, nat_rule2, "natrule2")
diff --git a/test/integration/smoke/test_public_ip_range.py b/test/integration/smoke/test_public_ip_range.py
index f0ed939..69baf5f 100644
--- a/test/integration/smoke/test_public_ip_range.py
+++ b/test/integration/smoke/test_public_ip_range.py
@@ -144,7 +144,7 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
# 1. Create a Public IP range for system vms
# 2. Created IP range should be present and marked as forsystemvms=true, verify with listVlanIpRanges
# 7. Delete the Public IP range
-
+
services = {
"gateway":"192.168.99.1",
"netmask":"255.255.255.0",
@@ -179,7 +179,7 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
"""
packed_ip = inet_aton(ip_string)
return unpack(">L", packed_ip)[0]
-
+
def is_ip_in_range(self, start_ip, end_ip, ip_to_test):
""" Check whether ip_to_test belongs to IP range between start_ip and end_ip
"""
@@ -187,7 +187,7 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
end = self.get_ip_as_number(end_ip)
ip = self.get_ip_as_number(ip_to_test)
return start <= ip and ip <= end
-
+
def wait_for_system_vm_start(self, domain_id, systemvmtype):
""" Wait until system vm is Running
"""
diff --git a/test/integration/smoke/test_reset_vm_on_reboot.py b/test/integration/smoke/test_reset_vm_on_reboot.py
index 5c1e93d..01faf37 100644
--- a/test/integration/smoke/test_reset_vm_on_reboot.py
+++ b/test/integration/smoke/test_reset_vm_on_reboot.py
@@ -33,7 +33,7 @@ class TestResetVmOnReboot(cloudstackTestCase):
def setUpClass(cls):
testClient = super(TestResetVmOnReboot, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
- cls.services = testClient.getParsedTestDataConfig()
+ cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
domain = get_domain(cls.apiclient)
diff --git a/test/integration/smoke/test_resource_detail.py b/test/integration/smoke/test_resource_detail.py
index 7103c65..8346af1 100644
--- a/test/integration/smoke/test_resource_detail.py
+++ b/test/integration/smoke/test_resource_detail.py
@@ -5,9 +5,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
@@ -52,7 +52,7 @@ class TestResourceDetail(cloudstackTestCase):
domainid=domain.id
)
-
+
cls.disk_offering = DiskOffering.create(
cls.apiclient,
cls.services["disk_offering"]
@@ -91,11 +91,11 @@ class TestResourceDetail(cloudstackTestCase):
@attr(tags = ["advanced", "xenserver"], required_hardware="false")
def test_01_updatevolumedetail(self):
- """Test volume detail
+ """Test volume detail
"""
# Validate the following
-
-
+
+
#remove detail
self.debug("Testing REMOVE volume detail Volume-ID: %s " % (
self.volume.id
@@ -103,8 +103,8 @@ class TestResourceDetail(cloudstackTestCase):
cmd = removeResourceDetail.removeResourceDetailCmd()
cmd.resourcetype = "Volume"
cmd.resourceid = self.volume.id
- self.apiclient.removeResourceDetail(cmd)
-
+ self.apiclient.removeResourceDetail(cmd)
+
listResourceDetailCmd = listResourceDetails.listResourceDetailsCmd()
listResourceDetailCmd.resourceid = self.volume.id
listResourceDetailCmd.resourcetype = "Volume"
@@ -112,7 +112,7 @@ class TestResourceDetail(cloudstackTestCase):
self.assertEqual(listResourceDetailResponse, None, "Check if the list API \
returns an empty response")
-
+
#TODO - add detail. Map as input
return
diff --git a/test/integration/smoke/test_router_dnsservice.py b/test/integration/smoke/test_router_dnsservice.py
index d0c5a67..07929bc 100644
--- a/test/integration/smoke/test_router_dnsservice.py
+++ b/test/integration/smoke/test_router_dnsservice.py
@@ -272,5 +272,5 @@ class TestRouterDnsService(cloudstackTestCase):
"VR DNS should serve requests from guest network, ping for %s successful." % VM1_NAME)
self.assertTrue(VM2_NAME in result2 and "10.1.1.1" in result2,
"VR DNS should serve requests from guest network, ping for %s successful." % VM2_NAME)
-
+
return
diff --git a/test/integration/smoke/test_routers_iptables_default_policy.py b/test/integration/smoke/test_routers_iptables_default_policy.py
index a4eda35..c2b3769 100644
--- a/test/integration/smoke/test_routers_iptables_default_policy.py
+++ b/test/integration/smoke/test_routers_iptables_default_policy.py
@@ -230,11 +230,11 @@ class TestVPCIpTablesPolicies(cloudstackTestCase):
cls.services["account"],
admin=True,
domainid=cls.domain.id)
-
+
cls.service_offering = ServiceOffering.create(
cls.apiclient,
cls.services["service_offering"])
-
+
cls.logger = logging.getLogger('TestVPCIpTablesPolicies')
cls.stream_handler = logging.StreamHandler()
@@ -290,7 +290,7 @@ class TestVPCIpTablesPolicies(cloudstackTestCase):
def test_01_single_VPC_iptables_policies(self):
""" Test iptables default INPUT/FORWARD policies on VPC router """
self.logger.debug("Starting test_01_single_VPC_iptables_policies")
-
+
routers = self.entity_manager.query_routers()
self.assertEqual(
@@ -312,13 +312,13 @@ class TestVPCIpTablesPolicies(cloudstackTestCase):
isinstance(hosts, list),
True,
"Check for list hosts response return valid data")
-
+
host = hosts[0]
host.user = self.hostConfig['username']
host.passwd = self.hostConfig['password']
host.port = self.services["configurableData"]["host"]["port"]
tables = [self.services["configurableData"]["input"], self.services["configurableData"]["forward"]]
-
+
for table in tables:
result = None
if self.hypervisor.lower() in ('vmware', 'hyperv'):
@@ -344,10 +344,10 @@ class TestVPCIpTablesPolicies(cloudstackTestCase):
"Provide a marvin config file with host\
credentials to run %s" %
self._testMethodName)
-
+
self.logger.debug("iptables -L %s: %s" % (table, result))
res = str(result)
-
+
self.assertEqual(
res.count("DROP"),
1,
@@ -383,11 +383,11 @@ class TestRouterIpTablesPolicies(cloudstackTestCase):
cls.services["account"],
admin=True,
domainid=cls.domain.id)
-
+
cls.service_offering = ServiceOffering.create(
cls.apiclient,
cls.services["service_offering"])
-
+
cls.logger = logging.getLogger('TestRouterIpTablesPolicies')
cls.stream_handler = logging.StreamHandler()
cls.logger.setLevel(logging.DEBUG)
@@ -498,7 +498,7 @@ class EntityManager(object):
self.networks = []
self.routers = []
self.ips = []
-
+
def set_cleanup(self, cleanup):
self.cleanup = cleanup
@@ -541,7 +541,7 @@ class EntityManager(object):
return nat_rule
def check_ssh_into_vm(self, vm, public_ip):
- self.logger.debug("Checking if we can SSH into VM=%s on public_ip=%s" %
+ self.logger.debug("Checking if we can SSH into VM=%s on public_ip=%s" %
(vm.name, public_ip.ipaddress.ipaddress))
vm.ssh_client = None
try:
diff --git a/test/integration/smoke/test_routers_network_ops.py b/test/integration/smoke/test_routers_network_ops.py
index cc1774c..a133e9a 100644
--- a/test/integration/smoke/test_routers_network_ops.py
+++ b/test/integration/smoke/test_routers_network_ops.py
@@ -628,7 +628,7 @@ class TestRedundantIsolateNetworks(cloudstackTestCase):
self.skipTest(
"Marvin configuration has no host credentials to\
check router services")
-
+
if result.count(vals[0]) == 1:
cnts[vals.index(vals[0])] += 1
@@ -647,7 +647,7 @@ class TestIsolatedNetworks(cloudstackTestCase):
cls.stream_handler = logging.StreamHandler()
cls.logger.setLevel(logging.DEBUG)
cls.logger.addHandler(cls.stream_handler)
-
+
cls.testClient = super(TestIsolatedNetworks, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
diff --git a/test/integration/smoke/test_snapshots.py b/test/integration/smoke/test_snapshots.py
index 4144f11..f495342 100644
--- a/test/integration/smoke/test_snapshots.py
+++ b/test/integration/smoke/test_snapshots.py
@@ -225,7 +225,7 @@ class TestSnapshotRootDisk(cloudstackTestCase):
# 4 - Migrate volume V to PS
# 5 - Take volume V snapshot -> S
# 6 - List snapshot and verify it gets properly listed although Primary Storage was removed
-
+
# Create new volume
vol = Volume.create(
self.apiclient,
diff --git a/test/integration/smoke/test_ssvm.py b/test/integration/smoke/test_ssvm.py
index d98c090..cdbc7d2 100644
--- a/test/integration/smoke/test_ssvm.py
+++ b/test/integration/smoke/test_ssvm.py
@@ -1244,7 +1244,7 @@ class TestSSVMs(cloudstackTestCase):
# 2) Get id and url from mounted nfs store
# 3) Update NFS version for previous image store
# 4) Stop SSVM
- # 5) Check NFS version of mounted nfs store after SSVM starts
+ # 5) Check NFS version of mounted nfs store after SSVM starts
nfs_version = self.config.nfsVersion
if nfs_version == None:
diff --git a/test/integration/smoke/test_vpc_redundant.py b/test/integration/smoke/test_vpc_redundant.py
index 3bf60a5..37dd87a 100644
--- a/test/integration/smoke/test_vpc_redundant.py
+++ b/test/integration/smoke/test_vpc_redundant.py
@@ -271,7 +271,7 @@ class TestVPCRedundancy(cloudstackTestCase):
zoneid=self.zone.id,
account=self.account.name,
domainid=self.account.domainid)
-
+
self.cleanup = [self.vpc, self.vpc_off, self.account]
return
@@ -354,7 +354,7 @@ class TestVPCRedundancy(cloudstackTestCase):
self.skipTest(
"Marvin configuration has no host credentials to\
check router services")
-
+
if result.count(status_to_check) == 1:
cnts[vals.index(status_to_check)] += 1
@@ -508,7 +508,7 @@ class TestVPCRedundancy(cloudstackTestCase):
traffictype='Ingress'
)
self.logger.debug('nwacl_nat=%s' % nwacl_nat.__dict__)
-
+
return nat_rule
def check_ssh_into_vm(self, vm, public_ip, expectFail=False, retries=5):
@@ -542,7 +542,7 @@ class TestVPCRedundancy(cloudstackTestCase):
self.check_routers_state()
self.add_nat_rules()
self.do_vpc_test(False)
-
+
self.stop_router_by_type("PRIMARY")
self.check_routers_state(1)
self.do_vpc_test(False)
@@ -567,7 +567,7 @@ class TestVPCRedundancy(cloudstackTestCase):
self.check_routers_state()
self.add_nat_rules()
self.do_default_routes_test()
-
+
@attr(tags=["advanced", "intervlan"], required_hardware="true")
def test_03_create_redundant_VPC_1tier_2VMs_2IPs_2PF_ACL_reboot_routers(self):
""" Create a redundant VPC with two networks with two VMs in each network """
@@ -577,7 +577,7 @@ class TestVPCRedundancy(cloudstackTestCase):
self.check_routers_state()
self.add_nat_rules()
self.do_vpc_test(False)
-
+
self.reboot_router_by_type("PRIMARY")
self.check_routers_state()
self.do_vpc_test(False)
@@ -627,7 +627,7 @@ class TestVPCRedundancy(cloudstackTestCase):
self.networks.append(network)
self.networks.append(self.create_network(self.services["network_offering_no_lb"], "10.1.2.1", nr_vms=1))
self.networks.append(self.create_network(self.services["network_offering_no_lb"], "10.1.3.1", nr_vms=1))
-
+
self.check_routers_state()
self.add_nat_rules()
self.do_vpc_test(False)
@@ -635,7 +635,7 @@ class TestVPCRedundancy(cloudstackTestCase):
self.destroy_vm(network)
network.get_net().delete(self.apiclient)
self.networks.remove(network)
-
+
self.check_routers_state(status_to_check="PRIMARY")
self.do_vpc_test(False)
@@ -700,9 +700,9 @@ class TestVPCRedundancy(cloudstackTestCase):
vm = vmObj.get_vm()
public_ip = vmObj.get_ip()
self.logger.debug("SSH into VM: %s" % public_ip.ipaddress.ipaddress)
-
+
ssh = vm.get_ssh_client(ipaddress=public_ip.ipaddress.ipaddress)
-
+
self.logger.debug("Ping to google.com from VM")
result = ssh.execute(ssh_command)
diff --git a/test/integration/smoke/test_vpc_router_nics.py b/test/integration/smoke/test_vpc_router_nics.py
index 90323e0..942d078 100644
--- a/test/integration/smoke/test_vpc_router_nics.py
+++ b/test/integration/smoke/test_vpc_router_nics.py
@@ -242,7 +242,7 @@ class TestVPCNics(cloudstackTestCase):
zoneid=self.zone.id,
account=self.account.name,
domainid=self.account.domainid)
-
+
self.cleanup = [self.vpc, self.vpc_off, self.account]
return
@@ -309,7 +309,7 @@ class TestVPCNics(cloudstackTestCase):
except Exception as e:
self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
o = networkO(obj_network)
-
+
vm1 = self.deployvm_in_network(obj_network)
self.cleanup.insert(1, obj_network)
@@ -395,7 +395,7 @@ class TestVPCNics(cloudstackTestCase):
net1.add_vm(self.deployvm_in_network(net1.get_net()))
self.query_routers()
-
+
self.add_nat_rules()
self.check_ssh_into_vm()
@@ -459,9 +459,9 @@ class TestVPCNics(cloudstackTestCase):
vm = vmObj.get_vm()
public_ip = vmObj.get_ip()
self.logger.debug("SSH into VM: %s" % public_ip.ipaddress.ipaddress)
-
+
ssh = vm.get_ssh_client(ipaddress=public_ip.ipaddress.ipaddress)
-
+
self.logger.debug("Ping to google.com from VM")
result = ssh.execute(ssh_command)
diff --git a/test/integration/testpaths/__init__.py b/test/integration/testpaths/__init__.py
index 978b68a..13a8339 100644
--- a/test/integration/testpaths/__init__.py
+++ b/test/integration/testpaths/__init__.py
@@ -5,9 +5,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
diff --git a/test/integration/testpaths/testpath_attach_disk_zwps.py b/test/integration/testpaths/testpath_attach_disk_zwps.py
index 1f1e073..7d700b4 100644
--- a/test/integration/testpaths/testpath_attach_disk_zwps.py
+++ b/test/integration/testpaths/testpath_attach_disk_zwps.py
@@ -316,7 +316,7 @@ class TestAttachDataDiskOnCWPS(cloudstackTestCase):
@attr(tags=["basic", "advanced"], required_hardware="true")
def test_01_attach_datadisk_to_vm_on_zwps(self):
- """ Attach Data Disk on CWPS To VM
+ """ Attach Data Disk on CWPS To VM
1. Check if zwps storage pool exists.
2. Adding tag to zone wide primary storage
3. Launch a VM
diff --git a/test/integration/testpaths/testpath_netmask.py b/test/integration/testpaths/testpath_netmask.py
index 32610b8..4509ae4 100644
--- a/test/integration/testpaths/testpath_netmask.py
+++ b/test/integration/testpaths/testpath_netmask.py
@@ -184,7 +184,7 @@ class TestCheckNetmask(cloudstackTestCase):
self.assertNotEqual(len(netlist), 0,
"Check if list networks returned an empty list.")
-
+
cidr = netlist[0].cidr.split("/")[1]
# Get netmask from CIDR
netmask = ipv4_cidr_to_netmask(int(cidr))
diff --git a/test/integration/testpaths/testpath_revert_snap.py b/test/integration/testpaths/testpath_revert_snap.py
index 5934400..ab092e5 100644
--- a/test/integration/testpaths/testpath_revert_snap.py
+++ b/test/integration/testpaths/testpath_revert_snap.py
@@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-""" Test cases for Verifying revert snapshot
+""" Test cases for Verifying revert snapshot
"""
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase
@@ -59,7 +59,7 @@ class TestUnableToRevertSnapshot(cloudstackTestCase):
if cls.hypervisor.lower() not in ['xenserver']:
cls.skiptest = True
- return
+ return
# Create an account
cls.account = Account.create(
cls.apiclient,
@@ -114,7 +114,7 @@ class TestUnableToRevertSnapshot(cloudstackTestCase):
# 1. Deploy a VM.
# 2. Take VM snapshot.
- # 3. Verify that volume snapshot fails with error
+ # 3. Verify that volume snapshot fails with error
can not create volume snapshot for VM with VM-snapshot
"""
@@ -143,9 +143,9 @@ class TestUnableToRevertSnapshot(cloudstackTestCase):
"Event list validation failed due to %s" %
volume_list_validation[2]
)
-
+
root_volume = volumes_cluster_list[0]
-
+
#Step 2
vm_snap = VmSnapshot.create(self.apiclient,
vm.id)
diff --git a/test/integration/testpaths/testpath_volume_recurring_snap.py b/test/integration/testpaths/testpath_volume_recurring_snap.py
index 828d4cf..06eed7d 100644
--- a/test/integration/testpaths/testpath_volume_recurring_snap.py
+++ b/test/integration/testpaths/testpath_volume_recurring_snap.py
@@ -151,18 +151,18 @@ class TestVolumeRecurringSnapshot(cloudstackTestCase):
@attr(tags=["advanced", "basic"],required_hardware="true")
def test_01_volume_snapshot(self):
""" Test Volume (root) Snapshot
- # 1. Create Hourly, Daily,Weekly recurring snapshot policy for ROOT disk and
+ # 1. Create Hourly, Daily,Weekly recurring snapshot policy for ROOT disk and
Verify the presence of the corresponding snapshots on the Secondary Storage
# 2. Delete the snapshot policy and verify the entry as Destroyed in snapshot_schedule
# 3. Verify that maxsnaps should not consider manual snapshots for deletion
# 4. Snapshot policy should reflect the correct timezone
# 5. Verify that listSnapshotPolicies() should return all snapshot policies
that belong to the account (both manual and recurring snapshots)
- # 6. Verify that listSnapshotPolicies() should not return snapshot
+ # 6. Verify that listSnapshotPolicies() should not return snapshot
policies that have been deleted
# 7. Verify that snapshot should not be created for VM in Destroyed state
# 8. Verify that snapshot should get created after resuming the VM
- # 9. Verify that All the recurring policies associated with the VM should be
+ # 9. Verify that All the recurring policies associated with the VM should be
deleted after VM get destroyed.
"""
# Step 1
@@ -280,7 +280,7 @@ class TestVolumeRecurringSnapshot(cloudstackTestCase):
recurring_snapshot_daily.id),
[]
)
-
+
self.testdata["recurring_snapshot"]["intervaltype"] = 'WEEKLY'
self.testdata["recurring_snapshot"]["schedule"] = '00:00:1'
recurring_snapshot_weekly = SnapshotPolicy.create(
@@ -743,7 +743,7 @@ class TestVolumeRecurringSnapshot(cloudstackTestCase):
@attr(tags=["advanced", "basic"], required_hardware="true")
def test_02_volume_max_snapshot(self):
""" Test Volume Snapshot
- # 1. Create Hourly reccuring snapshot policy with maxsnaps=2
+ # 1. Create Hourly reccuring snapshot policy with maxsnaps=2
verify that when 3rd snapshot is taken first snapshot gets deleted
"""
@@ -794,7 +794,7 @@ class TestVolumeRecurringSnapshot(cloudstackTestCase):
time.sleep(
(self.testdata["recurring_snapshot"]["maxsnaps"]) * 3600
)
-
+
snapshots_1 = list_snapshots(
self.apiclient,
volumeid=self.volume[0].id,
@@ -896,9 +896,9 @@ class TestVolumeRecurringSnapshot(cloudstackTestCase):
@attr(tags=["advanced", "basic"],required_hardware="true")
def test_03_volume_rec_snapshot(self):
""" Test Volume (root) Snapshot
- # 1. For snapshot.delta.max > maxsnaps verify that when number of snapshot exceeds
- maxsnaps value previous snapshot should get deleted from database but remain
- on secondary storage and when the value exceeds snapshot.delta.max the
+ # 1. For snapshot.delta.max > maxsnaps verify that when number of snapshot exceeds
+ maxsnaps value previous snapshot should get deleted from database but remain
+ on secondary storage and when the value exceeds snapshot.delta.max the
snapshot should get deleted from secondary storage
"""
diff --git a/test/integration/testpaths/testpath_volume_snapshot.py b/test/integration/testpaths/testpath_volume_snapshot.py
index a9b0ae3..922618e 100644
--- a/test/integration/testpaths/testpath_volume_snapshot.py
+++ b/test/integration/testpaths/testpath_volume_snapshot.py
@@ -97,7 +97,7 @@ class TestVolumeSnapshot(cloudstackTestCase):
cls.testdata["disk_offering"],
)
cls._cleanup.append(cls.disk_offering)
- #Create VM_1 and VM_2
+ #Create VM_1 and VM_2
cls.vm_1 = VirtualMachine.create(
cls.userapiclient,
cls.testdata["small"],
@@ -156,7 +156,7 @@ class TestVolumeSnapshot(cloudstackTestCase):
self.apiclient,
root_volume[0].id)
-
+
self.assertEqual(
root_vol_snap.state,
"BackedUp",
@@ -182,7 +182,7 @@ class TestVolumeSnapshot(cloudstackTestCase):
self.config,
self.zone.id,
snap.id))
-
+
self.account.delete(self.apiclient)
for snap in snaps:
@@ -212,34 +212,34 @@ class TestVolumeSnapshot(cloudstackTestCase):
""" Test Volume (root) Snapshot
# 1. Deploy a VM on primary storage and .
# 2. Take snapshot on root disk
- # 3. Verify the snapshot's entry in the "snapshots" table
- and presence of the corresponding
+ # 3. Verify the snapshot's entry in the "snapshots" table
+ and presence of the corresponding
snapshot on the Secondary Storage
- # 4. Create Template from the Snapshot and Deploy a
+ # 4. Create Template from the Snapshot and Deploy a
VM using the Template
- # 5. Log in to the VM from template and make verify
+ # 5. Log in to the VM from template and make verify
the contents of the ROOT disk matches with the snapshot.
- # 6. Delete Snapshot and Deploy a Linux VM from the
+ # 6. Delete Snapshot and Deploy a Linux VM from the
Template and verify the successful deployment of the VM.
- # 7. Create multiple snapshots on the same volume and
- Check the integrity of all the snapshots by creating
- a template from the snapshot and deploying a Vm from it
+ # 7. Create multiple snapshots on the same volume and
+ Check the integrity of all the snapshots by creating
+ a template from the snapshot and deploying a Vm from it
and delete one of the snapshots
- # 8. Verify that the original checksum matches with the checksum
+ # 8. Verify that the original checksum matches with the checksum
of VM's created from remaning snapshots
- # 9. Make verify the contents of the ROOT disk
+ # 9. Make verify the contents of the ROOT disk
matches with the snapshot
- # 10.Verify that Snapshot of both DATA and ROOT volume should
- succeed when snapshot of Data disk of a VM is taken
+ # 10.Verify that Snapshot of both DATA and ROOT volume should
+ succeed when snapshot of Data disk of a VM is taken
when snapshot of ROOT volume of VM is in progress
- # 11.Create snapshot of data disk and verify the original checksum
+ # 11.Create snapshot of data disk and verify the original checksum
matches with the volume created from snapshot
- # 12.Verify that volume's state should not change when snapshot of
+ # 12.Verify that volume's state should not change when snapshot of
a DATA volume is taken that is attached to a VM
- # 13.Verify that volume's state should not change when snapshot of
+ # 13.Verify that volume's state should not change when snapshot of
a DATA volume is taken that is not attached to a VM
# 14.Verify that create Snapshot with quiescevm=True should succeed
- # 15.revertSnapshot() to revert VM to a specified
+ # 15.revertSnapshot() to revert VM to a specified
Volume snapshot for root volume
"""
@@ -711,7 +711,7 @@ class TestVolumeSnapshot(cloudstackTestCase):
vm_from_temp_2.delete(self.apiclient)
# Step 10
- # Take snapshot of Data disk of a VM , when snapshot of ROOT volume of
+ # Take snapshot of Data disk of a VM , when snapshot of ROOT volume of
# VM is in progress
try:
self.vm_1.stop(self.apiclient)
@@ -865,7 +865,7 @@ class TestVolumeSnapshot(cloudstackTestCase):
data_volume_2
)
- self.vm_1.reboot(self.apiclient)
+ self.vm_1.reboot(self.apiclient)
self.vm_1.stop(self.apiclient)
data_vol_snap_1 = Snapshot.create(
diff --git a/test/selenium/common/shared.py b/test/selenium/common/shared.py
index 7016871..e87b0da 100644
--- a/test/selenium/common/shared.py
+++ b/test/selenium/common/shared.py
@@ -133,7 +133,7 @@ class Shared(object):
from threading import Timer
t = Timer(20,self.wait_for_invisible)
t.start()
-
+
@staticmethod
#wait until something disappears
def wait_for_invisible(browser, element_type, name, waittime=30):
diff --git a/test/selenium/lib/Global_Locators.py b/test/selenium/lib/Global_Locators.py
index b2d93cd..1bd3958 100644
--- a/test/selenium/lib/Global_Locators.py
+++ b/test/selenium/lib/Global_Locators.py
@@ -73,7 +73,7 @@ serviceOfferings_xpath = "//div[@id='navigation']/ul/li[12]/span[2]"
################################################################################################################################################################################################
## Instances Page
-## Instances Main page
+## Instances Main page
# Add Instance Button on top right corner of Instances page
@@ -166,7 +166,7 @@ Offering_edit_css = "a[alt=\"Edit\"] > span.icon"
Offering_editname_name = "name"
# Edit description box
-Offering_editdescription_name = "displaytext"
+Offering_editdescription_name = "displaytext"
# Edit finished click ok
Offering_editdone_css="div.button.done"
diff --git a/test/selenium/lib/initialize.py b/test/selenium/lib/initialize.py
index 55e5d9a..284d896 100644
--- a/test/selenium/lib/initialize.py
+++ b/test/selenium/lib/initialize.py
@@ -32,7 +32,7 @@ def getOrCreateWebdriver():
DRIVER = DRIVER or webdriver.PhantomJS('phantomjs') # phantomjs executable must be in PATH.
return DRIVER
-
+
def getMSip():
global MS_ip
if len(sys.argv) >= 3:
diff --git a/test/selenium/smoke/Login_and_Accounts.py b/test/selenium/smoke/Login_and_Accounts.py
index 44b1e83..2b3aee4 100644
--- a/test/selenium/smoke/Login_and_Accounts.py
+++ b/test/selenium/smoke/Login_and_Accounts.py
@@ -31,7 +31,7 @@ import initialize
class login(unittest.TestCase):
-
+
def setUp(self):
MS_URL = initialize.getMSip()
@@ -41,32 +41,32 @@ class login(unittest.TestCase):
def test_login(self):
-
+
# Here we will clear the test box for Username and Password and fill them with actual login data.
# After that we will click Login (Submit button)
driver = self.driver
driver.maximize_window()
driver.get(self.base_url + "client/")
- driver.find_element_by_css_selector(Global_Locators.login_username_css).clear()
+ driver.find_element_by_css_selector(Global_Locators.login_username_css).clear()
driver.find_element_by_css_selector(Global_Locators.login_username_css).send_keys("admin")
- driver.find_element_by_css_selector(Global_Locators.login_password_css).clear()
+ driver.find_element_by_css_selector(Global_Locators.login_password_css).clear()
driver.find_element_by_css_selector(Global_Locators.login_password_css).send_keys("password")
driver.find_element_by_css_selector(Global_Locators.login_submit_css).click()
time.sleep(5)
-
+
def is_element_present(self, how, what):
-
+
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
-
-
+
+
def tearDown(self):
-
+
self.assertEqual([], self.verificationErrors)
@@ -77,18 +77,18 @@ class login(unittest.TestCase):
class logout(unittest.TestCase):
-
-
+
+
def setUp(self):
-
+
self.driver = initialize.getOrCreateWebdriver()
self.driver.implicitly_wait(100)
self.verificationErrors = []
-
-
+
+
def test_logout(self):
-
+
# Here we will clear the test box for Username and Password and fill them with actual login data.
# After that we will click Login (Submit button)
driver = self.driver
@@ -98,17 +98,17 @@ class logout(unittest.TestCase):
-
+
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
-
-
+
+
def tearDown(self):
-
+
self.assertEqual([], self.verificationErrors)
@@ -120,40 +120,40 @@ class logout(unittest.TestCase):
class login_test(unittest.TestCase):
-
+
def setUp(self):
-
+
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
-
+
def test_logintest(self):
-
+
# Here we will clear the test box for Username and Password and fill them with actual login data.
# After that we will click Login (Submit button)
driver = self.driver
- driver.find_element_by_css_selector(Global_Locators.login_username_css).clear()
+ driver.find_element_by_css_selector(Global_Locators.login_username_css).clear()
driver.find_element_by_css_selector(Global_Locators.login_username_css).send_keys("test")
- driver.find_element_by_css_selector(Global_Locators.login_password_css).clear()
+ driver.find_element_by_css_selector(Global_Locators.login_password_css).clear()
driver.find_element_by_css_selector(Global_Locators.login_password_css).send_keys("password")
driver.find_element_by_css_selector(Global_Locators.login_submit_css).click()
time.sleep(5)
-
-
-
+
+
+
def is_element_present(self, how, what):
-
+
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
-
-
-
+
+
+
def tearDown(self):
-
+
self.assertEqual([], self.verificationErrors)
-
-
+
+
################################################################################################################################################
@@ -161,14 +161,14 @@ class createAcc(unittest.TestCase):
def setUp(self):
-
+
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
-
-
-
+
+
+
def test_createacc(self):
-
+
driver = self.driver
self.driver.implicitly_wait(100)
driver.find_element_by_xpath("//div[@id='navigation']/ul/li[8]/span[2]").click()
@@ -189,27 +189,27 @@ class createAcc(unittest.TestCase):
Select(driver.find_element_by_id("label_type")).select_by_visible_text("Admin")
Select(driver.find_element_by_id("label_timezone")).select_by_visible_text("[UTC-08:00] Pacific Standard Time")
driver.find_element_by_xpath("//button[@type='button']").click()
-
+
# Go to Dashboard
- driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
+ driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(30)
-
-
-
+
+
+
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
-
-
-
+
+
+
def tearDown(self):
-
+
self.assertEqual([], self.verificationErrors)
-
-
-
+
+
+
################################################################################################################################################
@@ -217,38 +217,38 @@ class tearAcc(unittest.TestCase):
def setUp(self):
-
+
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
-
-
-
+
+
+
def test_tearacc(self):
-
+
driver = self.driver
driver.find_element_by_css_selector("li.navigation-item.accounts").click()
driver.find_element_by_css_selector("tr.odd > td.name.first").click()
driver.find_element_by_css_selector("a[alt=\"Delete account\"] > span.icon").click()
driver.find_element_by_xpath("(//button[@type='button'])[2]").click()
-
+
# Go to Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(30)
-
-
-
+
+
+
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
-
-
+
+
def tearDown(self):
-
+
self.driver.quit()
self.assertEqual([], self.verificationErrors)
-
-
-
+
+
+
################################################################################################################################################
diff --git a/test/selenium/smoke/Service_Offering.py b/test/selenium/smoke/Service_Offering.py
index 66478e6..5c8a447 100644
--- a/test/selenium/smoke/Service_Offering.py
+++ b/test/selenium/smoke/Service_Offering.py
@@ -32,30 +32,30 @@ import Global_Locators
class Disk_offering_Add(unittest.TestCase):
def setUp(self):
-
+
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
-
+
def test_diskadd(self):
-
+
driver = self.driver
self.driver.implicitly_wait(200)
-
+
#Make sure you are on Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(2)
-
+
# Go to Service Offerings
driver.find_element_by_xpath(Global_Locators.serviceOfferings_xpath).click()
-
+
#Select Disk offering
driver.find_element_by_xpath(Global_Locators.Offering_disk_xpath).click()
-
+
# Add offering
driver.find_element_by_xpath(Global_Locators.Offering_add_xpath).click()
-
+
# Following have names.. so they do not have their global entries.
driver.find_element_by_name("name").clear()
driver.find_element_by_name("name").send_keys("Test Disk Name")
@@ -65,20 +65,20 @@ class Disk_offering_Add(unittest.TestCase):
driver.find_element_by_name("disksize").send_keys("1")
driver.find_element_by_xpath("//button[@type='button']").click()
time.sleep(20)
-
+
##Verification will be if this offering shows up into table and we can actually edit it.
-
-
+
+
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
-
-
+
+
def tearDown(self):
self.assertEqual([], self.verificationErrors)
-
+
@@ -88,94 +88,94 @@ class Disk_offering_Edit(unittest.TestCase):
def setUp(self):
-
+
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
-
+
def test_diskedit(self):
-
+
driver = self.driver
self.driver.implicitly_wait(200)
-
+
#Make sure you are on Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(2)
-
+
# Go to Service Offerings
driver.find_element_by_xpath(Global_Locators.serviceOfferings_xpath).click()
-
+
#Select Disk offering
driver.find_element_by_xpath(Global_Locators.Offering_disk_xpath).click()
-
+
# We will be searching for our disk offering into the table
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.Offering_table_xpath) # This returns a list of all Offerings in table
-
+
for link in linkclass:
-
+
if link.text == "Test Disk Name":
link.click()
-
+
time.sleep(2)
-
+
# Click Edit
driver.find_element_by_css_selector(Global_Locators.Offering_edit_css).click()
-
+
#Change name
driver.find_element_by_name(Global_Locators.Offering_editname_name).clear()
driver.find_element_by_name(Global_Locators.Offering_editname_name).send_keys("Test Name")
-
+
# Change Description
driver.find_element_by_name(Global_Locators.Offering_editdescription_name).clear()
driver.find_element_by_name(Global_Locators.Offering_editdescription_name).send_keys("Test Description")
-
+
#Click Done
driver.find_element_by_css_selector(Global_Locators.Offering_editdone_css).click()
time.sleep(10)
-
-
-
+
+
+
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
-
-
+
+
def tearDown(self):
self.assertEqual([], self.verificationErrors)
-
+
# Now we will find this offering and delete it!!
-
-
-
-
-
-
+
+
+
+
+
+
class Disk_offering_Delete(unittest.TestCase):
def setUp(self):
-
+
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
-
+
def test_diskdelete(self):
-
+
driver = self.driver
self.driver.implicitly_wait(200)
-
+
#Make sure you are on Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(2)
-
+
# Go to Service Offerings
driver.find_element_by_xpath(Global_Locators.serviceOfferings_xpath).click()
-
+
#Select Disk offering
driver.find_element_by_xpath(Global_Locators.Offering_disk_xpath).click()
@@ -183,63 +183,63 @@ class Disk_offering_Delete(unittest.TestCase):
# We will be searching for our disk offering into the table
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.Offering_table_xpath) # This returns a list of all Offerings in table
-
+
for link in linkclass:
-
+
if link.text == "Test Name":
link.click()
-
+
time.sleep(2)
-
+
# Click Delete
driver.find_element_by_css_selector(Global_Locators.Offering_delete_css).click()
time.sleep(2)
driver.find_element_by_xpath(Global_Locators.yesconfirmation_xapth).click()
time.sleep(20)
-
-
+
+
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
-
-
+
+
def tearDown(self):
self.assertEqual([], self.verificationErrors)
-
-
-
-
-
-
-
+
+
+
+
+
+
+
class Compute_offering_Add(unittest.TestCase):
def setUp(self):
-
+
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
-
+
def test_computeadd(self):
-
+
driver = self.driver
self.driver.implicitly_wait(200)
-
+
#Make sure you are on Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(2)
-
+
# Go to Service Offerings
driver.find_element_by_xpath(Global_Locators.serviceOfferings_xpath).click()
-
+
#Select Compute offering
driver.find_element_by_xpath(Global_Locators.Offering_compute_xpath).click()
@@ -247,7 +247,7 @@ class Compute_offering_Add(unittest.TestCase):
# Add offering
driver.find_element_by_xpath(Global_Locators.Offering_add_xpath).click()
-
+
# Following do not have Global locators
driver.find_element_by_id("label_name").clear()
driver.find_element_by_id("label_name").send_keys("Test Compute Name")
@@ -265,10 +265,10 @@ class Compute_offering_Add(unittest.TestCase):
driver.find_element_by_xpath("//button[@type='button']").click()
time.sleep(2)
-
+
#Make sure you are on Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
-
+
time.sleep(30)
@@ -278,13 +278,13 @@ class Compute_offering_Add(unittest.TestCase):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
-
-
+
+
def tearDown(self):
self.assertEqual([], self.verificationErrors)
-
+
@@ -296,56 +296,56 @@ class Compute_offering_Edit(unittest.TestCase):
def setUp(self):
-
+
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
-
+
def test_computeedit(self):
-
-
+
+
driver = self.driver
self.driver.implicitly_wait(200)
-
+
#Make sure you are on Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(2)
-
+
## Action part
# Go to Service Offerings
driver.find_element_by_xpath(Global_Locators.serviceOfferings_xpath).click()
-
+
#Select Compute offering
driver.find_element_by_xpath(Global_Locators.Offering_compute_xpath).click()
# We will be searching for our disk offering into the table
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.Offering_table_xpath) # This returns a list of all Offerings in table
-
+
for link in linkclass:
-
+
if link.text == "Test Compute Name":
link.click()
-
+
time.sleep(2)
-
+
# Click Edit
driver.find_element_by_css_selector(Global_Locators.Offering_edit_css).click()
-
+
#Change name
driver.find_element_by_name(Global_Locators.Offering_editname_name).clear()
driver.find_element_by_name(Global_Locators.Offering_editname_name).send_keys("Test Name")
-
+
# Change Description
driver.find_element_by_name(Global_Locators.Offering_editdescription_name).clear()
driver.find_element_by_name(Global_Locators.Offering_editdescription_name).send_keys("Test Description")
-
+
#Click Done
driver.find_element_by_css_selector(Global_Locators.Offering_editdone_css).click()
time.sleep(10)
-
+
@@ -354,41 +354,41 @@ class Compute_offering_Edit(unittest.TestCase):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
-
+
def tearDown(self):
self.assertEqual([], self.verificationErrors)
-
-
+
+
class Compute_offering_Delete(unittest.TestCase):
def setUp(self):
-
+
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
-
+
def test_computedelete(self):
-
-
+
+
driver = self.driver
self.driver.implicitly_wait(200)
-
+
#Make sure you are on Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(2)
-
+
# Go to Service Offerings
driver.find_element_by_xpath(Global_Locators.serviceOfferings_xpath).click()
-
+
#Select Compute offering
driver.find_element_by_xpath(Global_Locators.Offering_compute_xpath).click()
@@ -396,21 +396,21 @@ class Compute_offering_Delete(unittest.TestCase):
# We will be searching for our disk offering into the table
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.Offering_table_xpath) # This returns a list of all Offerings in table
-
+
for link in linkclass:
-
- if link.text == "Test Name":
+
+ if link.text == "Test Name":
link.click()
-
+
time.sleep(2)
-
+
# Click Delete
-
+
driver.find_element_by_css_selector(Global_Locators.Offering_deletecompute_css).click()
driver.find_element_by_xpath(Global_Locators.yesconfirmation_xapth).click()
time.sleep(20)
-
+
def is_element_present(self, how, what):
@@ -418,9 +418,9 @@ class Compute_offering_Delete(unittest.TestCase):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
-
-
+
+
def tearDown(self):
-
+
self.assertEqual([], self.verificationErrors)
diff --git a/test/selenium/smoke/TemplatesAndISO.py b/test/selenium/smoke/TemplatesAndISO.py
index 120c8d1..c69b446 100644
--- a/test/selenium/smoke/TemplatesAndISO.py
+++ b/test/selenium/smoke/TemplatesAndISO.py
@@ -41,28 +41,28 @@ class Template_Add(unittest.TestCase):
def setUp(self):
-
+
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
-
+
def test_templateadd(self):
-
-
+
+
driver = self.driver
## Action part
#Make sure you are on Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(2)
-
+
# Go to Templates
driver.find_element_by_xpath(Global_Locators.templates_xpath).click()
#Select Template from drop down list
driver.find_element_by_xpath(Global_Locators.template_xpath).click()
-
+
# Add Template
driver.find_element_by_xpath(Global_Locators.AddTemplate_xpath).click()
@@ -82,26 +82,26 @@ class Template_Add(unittest.TestCase):
# Go to Dash Board
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
-
-
+
+
time.sleep(600)
-
+
##Verification will be if this offering shows up into table and we can actually edit it.
-
-
+
+
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
-
+
def tearDown(self):
-
+
self.assertEqual([], self.verificationErrors)
-
+
@@ -113,39 +113,39 @@ class Template_Edit(unittest.TestCase):
def setUp(self):
-
+
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
-
-
-
+
+
+
def test_templateedit(self):
-
+
driver = self.driver
## Action part
-
+
#Make sure you are on Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(2)
-
+
# Go to Templates
driver.find_element_by_xpath(Global_Locators.templates_xpath).click()
#Select Template from drop down list
driver.find_element_by_xpath(Global_Locators.template_xpath).click()
-
-
+
+
linkclass = None
- linkclass = driver.find_elements_by_xpath(Global_Locators.template_table_xpath) # This returns a list
-
+ linkclass = driver.find_elements_by_xpath(Global_Locators.template_table_xpath) # This returns a list
+
for link in linkclass:
-
+
if link.text == "Test Template Ubuntu": # We will search for our VM in this table
link.click()
-
+
time.sleep(2)
-
+
# Change name
driver.find_element_by_name("name").clear()
driver.find_element_by_name("name").send_keys("Test template")
@@ -154,10 +154,10 @@ class Template_Edit(unittest.TestCase):
# Change Description
driver.find_element_by_name("displaytext").clear()
driver.find_element_by_name("displaytext").send_keys("ubuntu")
-
+
driver.find_element_by_css_selector(Global_Locators.template_editdone_css).click()
time.sleep(2)
-
+
#Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(10)
@@ -170,30 +170,30 @@ class Template_Edit(unittest.TestCase):
except NoSuchElementException, e: return False
return True
-
-
+
+
def tearDown(self):
self.assertEqual([], self.verificationErrors)
-
+
# Now we will find this offering and delete it!!
-
-
-
-
-
-
+
+
+
+
+
+
class Template_Delete(unittest.TestCase):
-
+
def setUp(self):
-
+
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
-
+
def test_templatedelete(self):
driver = self.driver
@@ -202,41 +202,41 @@ class Template_Delete(unittest.TestCase):
#Make sure you are on Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(2)
-
+
# Go to Templates
driver.find_element_by_xpath(Global_Locators.templates_xpath).click()
#Select Template from drop down list
driver.find_element_by_xpath(Global_Locators.template_xpath).click()
-
+
linkclass = None
- linkclass = driver.find_elements_by_xpath(Global_Locators.template_table_xpath) # This returns a list
-
+ linkclass = driver.find_elements_by_xpath(Global_Locators.template_table_xpath) # This returns a list
+
for link in linkclass:
-
+
if link.text == "Test Template": # We will search for our VM in this table
link.click()
-
+
time.sleep(2)
-
+
driver.find_element_by_css_selector(Gloabl_Locators.template_delete_css).click()
driver.find_element_by_xpath(Global_Locators.yesconfirmation_xapth).click()
-
+
time.sleep(2)
-
+
#Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(20)
-
-
+
+
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
-
+
def tearDown(self):
diff --git a/test/selenium/smoke/VM_lifeCycle.py b/test/selenium/smoke/VM_lifeCycle.py
index 845a5cb..480c45c 100644
--- a/test/selenium/smoke/VM_lifeCycle.py
+++ b/test/selenium/smoke/VM_lifeCycle.py
@@ -34,110 +34,110 @@ class deployVM(unittest.TestCase):
def setUp(self):
-
+
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
-
+
def test_deployvm(self):
-
-
+
+
## Action Part
- # VM will be named Auto-VM and this VM will be used in all subsequent tests.
+ # VM will be named Auto-VM and this VM will be used in all subsequent tests.
# Deploy an Instance named Auto-VM Default CentOS no GUI Template
-
+
driver = self.driver
self.driver.implicitly_wait(30)
- driver.refresh() ## Most Important step. Failure to do this will change XPATH location and Scripts will fail.
-
-
+ driver.refresh() ## Most Important step. Failure to do this will change XPATH location and Scripts will fail.
+
+
# Click on Instances link
driver.find_element_by_xpath(Global_Locators.instances_xpath).click()
-
+
# Click on add Instance on Instances page
driver.find_element_by_xpath(Global_Locators.add_instance_xpath).click()
-
+
# Following select template action will fire automatically... ignore it. And leave following commented.
# driver.find_element_by_xpath("(//input[@name='select-template'])[3]").click()
#Click on Next button on Instances Wizard.
driver.find_element_by_xpath(Global_Locators.add_instance_next_xpath).click()
-
+
# Nothing to do here as we will be using all default settings. (Default CentOS no GUI template should be highlighted here. Click Next
driver.find_element_by_xpath(Global_Locators.add_instance_next_xpath).click()
-
+
# Nothing to do here. Medium Instance compute offering should be selected here. Click Next
driver.find_element_by_xpath(Global_Locators.add_instance_next_xpath).click()
-
+
# Nothing to do here. Data Disk Offering : No Thanks!!. Click Next
driver.find_element_by_xpath(Global_Locators.add_instance_next_xpath).click()
-
+
# Since this is our first instance; we must provide a network name. We will use Test-Network as out network name.
driver.find_element_by_xpath("(//input[@name='new-network-name'])[2]").click()
driver.find_element_by_xpath("(//input[@name='new-network-name'])[2]").clear()
driver.find_element_by_xpath("(//input[@name='new-network-name'])[2]").send_keys("Test-Network")
-
+
#Click next
driver.find_element_by_xpath(Global_Locators.add_instance_next_xpath).click()
-
- # Give our VM a name here. Use Auto-VM as name
+
+ # Give our VM a name here. Use Auto-VM as name
driver.find_element_by_xpath("(//input[@name='displayname'])[2]").click()
-
+
driver.find_element_by_xpath("(//input[@name='displayname'])[2]").clear()
-
+
driver.find_element_by_xpath("(//input[@name='displayname'])[2]").send_keys("Auto-VM")
-
+
# All data filled. Click Launch VM. (It has the same xpath as Next button. So we will use Next Variable here.
driver.find_element_by_xpath(Global_Locators.add_instance_next_xpath).click()
print '\n' + '\n' + "VM Deployment is complete... wait for 5 mins to check deployment status" + '\n' + '\n'
-
-
-
+
+
+
## Verification Part
-
-
+
+
## Now we must wait for some random time (Educated guess based on experience) and check if VM has been deployed and if it is in running state.
## Should take about 4 min to deploy VM.. but we will wait 5 mins and check the status , we will do this twice. So total 2 check within 10 mins with first check occuring at 5th min.
-
-
+
+
driver.refresh() # Refresh UI Page; This polls latest status.
-
+
# Click on Instances link
driver.find_element_by_xpath(Global_Locators.instances_xpath).click()
-
+
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.instances_table_xpath) # This returns a list of all VM names in tables
count = 1
-
+
while (count > 0):
-
+
time.sleep(300)
for link in linkclass:
-
+
if link.text == "Auto-VM": # We will search for our VM in this table
print "found VM in table .. checking status..." + '\n' + '\n'
link.click()
-
+
status = driver.find_element_by_xpath(Global_Locators.state_xpath).text ## get the status of our VM
-
+
if status == "Running" :
print "VM is in running state... continuing with other tests."+ '\n' + '\n'
break
else:
print "Need to check one more time after 5 mins"
continue
- count = count - 1
-
-
+ count = count - 1
+
+
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
-
-
-
-
+
+
+
+
def tearDown(self):
self.assertEqual([], self.verificationErrors)
@@ -154,13 +154,13 @@ class destroyVM(unittest.TestCase):
def setUp(self):
-
+
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
-
+
def test_destroyvm(self):
-
+
driver = self.driver
self.driver.implicitly_wait(100)
@@ -168,66 +168,66 @@ class destroyVM(unittest.TestCase):
# Click on Instances link and find our instance
driver.find_element_by_xpath(Global_Locators.instances_xpath).click()
time.sleep(2)
-
+
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.instances_table_xpath) # This returns a list of all VM names in tables
-
+
for link in linkclass:
-
+
if link.text == "Auto-VM": # We will search for our VM in this table
link.click()
-
+
# Click on Destroy Instance button and confirm
time.sleep(2)
driver.find_element_by_css_selector(Global_Locators.destroyinstance_css).click()
time.sleep(2)
-
+
# Click ok on confirmation
driver.find_element_by_xpath(Global_Locators.yesconfirmation_xapth).click()
time.sleep(2)
-
+
# Go to Dashboard
# driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
driver.refresh()
-
+
## Verification part
time.sleep(60)
-
+
# Click on Instances link and find our instance
driver.find_element_by_xpath(Global_Locators.instances_xpath).click()
time.sleep(2)
-
+
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.instances_table_xpath) # This returns a list of all VM names in tables
-
+
for link in linkclass:
-
+
if link.text == "Auto-VM": # We will search for our VM in this table
link.click()
-
-
+
+
status = driver.find_element_by_xpath(Global_Locators.state_xpath).text ## get the status of our VM
if status == "Destroyed" :
print "VM is Destroyed...."+ '\n' + '\n'
else:
print "Something went wrong"
-
-
-
+
+
+
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
-
-
+
+
def tearDown(self):
self.assertEqual([], self.verificationErrors)
-
-
-
+
+
+
... 2518 lines suppressed ...