mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-4780: Changes related to checking snapshot path
on NFS server, also made marvin import paths specific
This commit is contained in:
parent
5d03fa83a2
commit
a160b46cd4
@ -42,17 +42,17 @@ from marvin.integration.lib.base import (
|
|||||||
from marvin.integration.lib.common import (get_domain,
|
from marvin.integration.lib.common import (get_domain,
|
||||||
get_zone,
|
get_zone,
|
||||||
get_template,
|
get_template,
|
||||||
cleanup_resources,
|
|
||||||
list_virtual_machines,
|
list_virtual_machines,
|
||||||
list_events,
|
list_events,
|
||||||
list_zones,
|
list_zones,
|
||||||
get_free_vlan,
|
get_free_vlan,
|
||||||
get_hypervisor_type,
|
|
||||||
update_resource_limit
|
update_resource_limit
|
||||||
)
|
)
|
||||||
|
|
||||||
from marvin.integration.lib.utils import (validateList,
|
from marvin.integration.lib.utils import (validateList,
|
||||||
random_gen)
|
random_gen,
|
||||||
|
get_hypervisor_type,
|
||||||
|
cleanup_resources)
|
||||||
|
|
||||||
from marvin.cloudstackAPI import (addNicToVirtualMachine,
|
from marvin.cloudstackAPI import (addNicToVirtualMachine,
|
||||||
removeNicFromVirtualMachine,
|
removeNicFromVirtualMachine,
|
||||||
|
|||||||
@ -32,12 +32,12 @@ from marvin.integration.lib.base import (Account,
|
|||||||
from marvin.integration.lib.common import (get_domain,
|
from marvin.integration.lib.common import (get_domain,
|
||||||
get_zone,
|
get_zone,
|
||||||
get_template,
|
get_template,
|
||||||
cleanup_resources,
|
|
||||||
list_volumes,
|
list_volumes,
|
||||||
update_resource_limit,
|
update_resource_limit,
|
||||||
list_networks,
|
list_networks,
|
||||||
list_snapshots,
|
list_snapshots,
|
||||||
list_virtual_machines)
|
list_virtual_machines)
|
||||||
|
from marvin.integration.lib.utils import cleanup_resources
|
||||||
|
|
||||||
def log_test_exceptions(func):
|
def log_test_exceptions(func):
|
||||||
def test_wrap_exception_log(self, *args, **kwargs):
|
def test_wrap_exception_log(self, *args, **kwargs):
|
||||||
|
|||||||
@ -30,10 +30,10 @@ from marvin.integration.lib.base import (
|
|||||||
from marvin.integration.lib.common import (get_domain,
|
from marvin.integration.lib.common import (get_domain,
|
||||||
get_zone,
|
get_zone,
|
||||||
get_template,
|
get_template,
|
||||||
cleanup_resources,
|
|
||||||
find_suitable_host,
|
find_suitable_host,
|
||||||
get_resource_type
|
get_resource_type
|
||||||
)
|
)
|
||||||
|
from marvin.integration.lib.utils import cleanup_resources
|
||||||
|
|
||||||
class Services:
|
class Services:
|
||||||
"""Test resource limit services
|
"""Test resource limit services
|
||||||
|
|||||||
@ -30,10 +30,10 @@ from marvin.integration.lib.base import (
|
|||||||
from marvin.integration.lib.common import (get_domain,
|
from marvin.integration.lib.common import (get_domain,
|
||||||
get_zone,
|
get_zone,
|
||||||
get_template,
|
get_template,
|
||||||
cleanup_resources,
|
|
||||||
find_suitable_host,
|
find_suitable_host,
|
||||||
get_resource_type
|
get_resource_type
|
||||||
)
|
)
|
||||||
|
from marvin.integration.lib.utils import cleanup_resources
|
||||||
|
|
||||||
|
|
||||||
class Services:
|
class Services:
|
||||||
|
|||||||
@ -30,9 +30,9 @@ from marvin.integration.lib.base import (
|
|||||||
)
|
)
|
||||||
from marvin.integration.lib.common import (get_domain,
|
from marvin.integration.lib.common import (get_domain,
|
||||||
get_zone,
|
get_zone,
|
||||||
get_template,
|
get_template
|
||||||
cleanup_resources
|
|
||||||
)
|
)
|
||||||
|
from marvin.integration.lib.utils import cleanup_resources
|
||||||
|
|
||||||
class Services:
|
class Services:
|
||||||
"""Test resource limit services
|
"""Test resource limit services
|
||||||
|
|||||||
@ -30,10 +30,10 @@ from marvin.integration.lib.base import (
|
|||||||
from marvin.integration.lib.common import (get_domain,
|
from marvin.integration.lib.common import (get_domain,
|
||||||
get_zone,
|
get_zone,
|
||||||
get_template,
|
get_template,
|
||||||
cleanup_resources,
|
|
||||||
find_suitable_host,
|
find_suitable_host,
|
||||||
get_resource_type
|
get_resource_type
|
||||||
)
|
)
|
||||||
|
from marvin.integration.lib.utils import cleanup_resources
|
||||||
|
|
||||||
class Services:
|
class Services:
|
||||||
"""Test resource limit services
|
"""Test resource limit services
|
||||||
|
|||||||
@ -35,8 +35,8 @@ from marvin.integration.lib.common import (get_domain,
|
|||||||
rebootRouter,
|
rebootRouter,
|
||||||
list_routers,
|
list_routers,
|
||||||
wait_for_cleanup,
|
wait_for_cleanup,
|
||||||
cleanup_resources,
|
|
||||||
list_virtual_machines)
|
list_virtual_machines)
|
||||||
|
from marvin.integration.lib.utils import cleanup_resources
|
||||||
from marvin.cloudstackAPI.createEgressFirewallRule import createEgressFirewallRuleCmd
|
from marvin.cloudstackAPI.createEgressFirewallRule import createEgressFirewallRuleCmd
|
||||||
from marvin.cloudstackAPI.deleteEgressFirewallRule import deleteEgressFirewallRuleCmd
|
from marvin.cloudstackAPI.deleteEgressFirewallRule import deleteEgressFirewallRuleCmd
|
||||||
|
|
||||||
|
|||||||
@ -34,9 +34,9 @@ from marvin.integration.lib.base import (
|
|||||||
from marvin.integration.lib.common import (get_domain,
|
from marvin.integration.lib.common import (get_domain,
|
||||||
get_zone,
|
get_zone,
|
||||||
get_template,
|
get_template,
|
||||||
cleanup_resources,
|
|
||||||
random_gen
|
random_gen
|
||||||
)
|
)
|
||||||
|
from marvin.integration.lib.utils import cleanup_resources
|
||||||
from marvin.cloudstackAPI import createLBStickinessPolicy
|
from marvin.cloudstackAPI import createLBStickinessPolicy
|
||||||
from marvin.sshClient import SshClient
|
from marvin.sshClient import SshClient
|
||||||
|
|
||||||
|
|||||||
@ -29,12 +29,12 @@ from marvin.integration.lib.base import (
|
|||||||
from marvin.integration.lib.common import (get_domain,
|
from marvin.integration.lib.common import (get_domain,
|
||||||
get_zone,
|
get_zone,
|
||||||
get_template,
|
get_template,
|
||||||
cleanup_resources,
|
|
||||||
wait_for_cleanup,
|
wait_for_cleanup,
|
||||||
find_suitable_host,
|
find_suitable_host,
|
||||||
get_resource_type,
|
get_resource_type,
|
||||||
update_resource_count
|
update_resource_count
|
||||||
)
|
)
|
||||||
|
from marvin.integration.lib.utils import cleanup_resources
|
||||||
|
|
||||||
class Services:
|
class Services:
|
||||||
"""Test memory resource limit services
|
"""Test memory resource limit services
|
||||||
|
|||||||
@ -29,9 +29,9 @@ from marvin.integration.lib.base import (
|
|||||||
)
|
)
|
||||||
from marvin.integration.lib.common import (get_domain,
|
from marvin.integration.lib.common import (get_domain,
|
||||||
get_zone,
|
get_zone,
|
||||||
get_template,
|
get_template
|
||||||
cleanup_resources
|
|
||||||
)
|
)
|
||||||
|
from marvin.integration.lib.utils import cleanup_resources
|
||||||
|
|
||||||
class Services:
|
class Services:
|
||||||
"""Test memory resource limit services
|
"""Test memory resource limit services
|
||||||
|
|||||||
@ -29,11 +29,11 @@ from marvin.integration.lib.base import (
|
|||||||
from marvin.integration.lib.common import (get_domain,
|
from marvin.integration.lib.common import (get_domain,
|
||||||
get_zone,
|
get_zone,
|
||||||
get_template,
|
get_template,
|
||||||
cleanup_resources,
|
|
||||||
wait_for_cleanup,
|
wait_for_cleanup,
|
||||||
find_suitable_host,
|
find_suitable_host,
|
||||||
get_resource_type
|
get_resource_type
|
||||||
)
|
)
|
||||||
|
from marvin.integration.lib.utils import cleanup_resources
|
||||||
|
|
||||||
class Services:
|
class Services:
|
||||||
"""Test memory resource limit services
|
"""Test memory resource limit services
|
||||||
|
|||||||
@ -36,12 +36,13 @@ from marvin.integration.lib.common import (get_domain,
|
|||||||
list_snapshots,
|
list_snapshots,
|
||||||
list_templates,
|
list_templates,
|
||||||
list_virtual_machines,
|
list_virtual_machines,
|
||||||
get_hypervisor_type)
|
)
|
||||||
|
|
||||||
from marvin.integration.lib.utils import (cleanup_resources,
|
from marvin.integration.lib.utils import (cleanup_resources,
|
||||||
format_volume_to_ext3,
|
format_volume_to_ext3,
|
||||||
random_gen,
|
random_gen,
|
||||||
is_snapshot_on_nfs)
|
is_snapshot_on_nfs,
|
||||||
|
get_hypervisor_type)
|
||||||
|
|
||||||
from marvin.cloudstackAPI import detachVolume
|
from marvin.cloudstackAPI import detachVolume
|
||||||
import time
|
import time
|
||||||
|
|||||||
@ -18,11 +18,8 @@
|
|||||||
""" Component tests for VPC network functionality - Load Balancing Rules
|
""" Component tests for VPC network functionality - Load Balancing Rules
|
||||||
"""
|
"""
|
||||||
#Import Local Modules
|
#Import Local Modules
|
||||||
#import marvin
|
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||||
#from marvin.cloudstackAPI import
|
|
||||||
#from marvin.integration.lib.utils import
|
|
||||||
from marvin.integration.lib.base import (stopRouter,
|
from marvin.integration.lib.base import (stopRouter,
|
||||||
startRouter,
|
startRouter,
|
||||||
Account,
|
Account,
|
||||||
@ -40,8 +37,8 @@ from marvin.integration.lib.base import (stopRouter,
|
|||||||
from marvin.integration.lib.common import (get_domain,
|
from marvin.integration.lib.common import (get_domain,
|
||||||
get_zone,
|
get_zone,
|
||||||
get_template,
|
get_template,
|
||||||
cleanup_resources,
|
|
||||||
list_routers)
|
list_routers)
|
||||||
|
from marvin.integration.lib.utils import cleanup_resources
|
||||||
import socket
|
import socket
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|||||||
@ -31,13 +31,12 @@ from marvin.integration.lib.base import (stopRouter,
|
|||||||
NetworkOffering,
|
NetworkOffering,
|
||||||
Network,
|
Network,
|
||||||
VirtualMachine,
|
VirtualMachine,
|
||||||
LoadBalancerRule,
|
LoadBalancerRule)
|
||||||
StaticNATRule)
|
|
||||||
from marvin.integration.lib.common import (get_domain,
|
from marvin.integration.lib.common import (get_domain,
|
||||||
get_zone,
|
get_zone,
|
||||||
get_template,
|
get_template,
|
||||||
cleanup_resources,
|
|
||||||
list_routers)
|
list_routers)
|
||||||
|
from marvin.integration.lib.utils import cleanup_resources
|
||||||
import socket
|
import socket
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|||||||
@ -19,13 +19,10 @@
|
|||||||
"""
|
"""
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||||
from marvin.integration.lib.base import (stopRouter,
|
from marvin.integration.lib.base import (Account,
|
||||||
startRouter,
|
|
||||||
Account,
|
|
||||||
VpcOffering,
|
VpcOffering,
|
||||||
VPC,
|
VPC,
|
||||||
ServiceOffering,
|
ServiceOffering,
|
||||||
NATRule,
|
|
||||||
NetworkACL,
|
NetworkACL,
|
||||||
PublicIPAddress,
|
PublicIPAddress,
|
||||||
NetworkOffering,
|
NetworkOffering,
|
||||||
@ -33,11 +30,13 @@ from marvin.integration.lib.base import (stopRouter,
|
|||||||
VirtualMachine,
|
VirtualMachine,
|
||||||
LoadBalancerRule,
|
LoadBalancerRule,
|
||||||
StaticNATRule)
|
StaticNATRule)
|
||||||
|
from marvin.cloudstackAPI import (stopRouter,
|
||||||
|
startRouter)
|
||||||
from marvin.integration.lib.common import (get_domain,
|
from marvin.integration.lib.common import (get_domain,
|
||||||
get_zone,
|
get_zone,
|
||||||
get_template,
|
get_template,
|
||||||
cleanup_resources,
|
|
||||||
list_routers)
|
list_routers)
|
||||||
|
from marvin.integration.lib.utils import cleanup_resources
|
||||||
import socket
|
import socket
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|||||||
@ -33,9 +33,9 @@ from marvin.integration.lib.base import (
|
|||||||
)
|
)
|
||||||
from marvin.integration.lib.common import (get_domain,
|
from marvin.integration.lib.common import (get_domain,
|
||||||
get_zone,
|
get_zone,
|
||||||
get_template,
|
get_template
|
||||||
cleanup_resources,
|
|
||||||
)
|
)
|
||||||
|
from marvin.integration.lib.utils import cleanup_resources
|
||||||
|
|
||||||
|
|
||||||
class Services:
|
class Services:
|
||||||
|
|||||||
@ -18,11 +18,56 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
#Import Local Modules
|
#Import Local Modules
|
||||||
from marvin.cloudstackAPI import *
|
from marvin.cloudstackAPI import (listConfigurations,
|
||||||
|
listPhysicalNetworks,
|
||||||
|
listRegions,
|
||||||
|
addNetworkServiceProvider,
|
||||||
|
updateNetworkServiceProvider,
|
||||||
|
listDomains,
|
||||||
|
listZones,
|
||||||
|
listPods,
|
||||||
|
listOsTypes,
|
||||||
|
listTemplates,
|
||||||
|
updateResourceLimit,
|
||||||
|
listRouters,
|
||||||
|
listNetworks,
|
||||||
|
listClusters,
|
||||||
|
listSystemVms,
|
||||||
|
listStoragePools,
|
||||||
|
listVirtualMachines,
|
||||||
|
listLoadBalancerRuleInstances,
|
||||||
|
listFirewallRules,
|
||||||
|
listVolumes,
|
||||||
|
listIsos,
|
||||||
|
listAccounts,
|
||||||
|
listSnapshotPolicies,
|
||||||
|
listDiskOfferings,
|
||||||
|
listVlanIpRanges,
|
||||||
|
listUsageRecords,
|
||||||
|
listNetworkServiceProviders,
|
||||||
|
listHosts,
|
||||||
|
listPublicIpAddresses,
|
||||||
|
listPortForwardingRules,
|
||||||
|
listLoadBalancerRules,
|
||||||
|
listSnapshots,
|
||||||
|
listUsers,
|
||||||
|
listEvents,
|
||||||
|
listServiceOfferings,
|
||||||
|
listVirtualRouterElements,
|
||||||
|
listNetworkOfferings,
|
||||||
|
listResourceLimits,
|
||||||
|
listVPCOfferings)
|
||||||
|
from marvin.integration.lib.base import (Configurations,
|
||||||
|
NetScaler,
|
||||||
|
Template,
|
||||||
|
Resources,
|
||||||
|
PhysicalNetwork,
|
||||||
|
Host)
|
||||||
|
from marvin.integration.lib.utils import (get_process_status,
|
||||||
|
xsplit)
|
||||||
|
|
||||||
from marvin.sshClient import SshClient
|
from marvin.sshClient import SshClient
|
||||||
from utils import *
|
import random
|
||||||
from base import *
|
|
||||||
from marvin.codes import PASS
|
|
||||||
|
|
||||||
#Import System modules
|
#Import System modules
|
||||||
import time
|
import time
|
||||||
@ -91,7 +136,7 @@ def add_netscaler(apiclient, zoneid, NSservice):
|
|||||||
cmd = updateNetworkServiceProvider.updateNetworkServiceProviderCmd()
|
cmd = updateNetworkServiceProvider.updateNetworkServiceProviderCmd()
|
||||||
cmd.id = netscaler_provider.id
|
cmd.id = netscaler_provider.id
|
||||||
cmd.state = 'Enabled'
|
cmd.state = 'Enabled'
|
||||||
response = apiclient.updateNetworkServiceProvider(cmd)
|
apiclient.updateNetworkServiceProvider(cmd)
|
||||||
|
|
||||||
return netscaler
|
return netscaler
|
||||||
|
|
||||||
@ -199,19 +244,6 @@ def get_template(apiclient, zoneid, ostype, services=None):
|
|||||||
ostypeid)
|
ostypeid)
|
||||||
return
|
return
|
||||||
|
|
||||||
def get_hypervisor_type(apiclient):
|
|
||||||
|
|
||||||
"""Return the hypervisor type of the hosts in setup"""
|
|
||||||
|
|
||||||
hosts = list_hosts(apiclient, type='Routing', listall=True)
|
|
||||||
|
|
||||||
hosts_list_validation_result = validateList(hosts)
|
|
||||||
|
|
||||||
assert hosts_list_validation_result[0] == PASS, "host list validation failed"
|
|
||||||
|
|
||||||
return hosts_list_validation_result[1].hypervisor
|
|
||||||
|
|
||||||
|
|
||||||
def download_systemplates_sec_storage(server, services):
|
def download_systemplates_sec_storage(server, services):
|
||||||
"""Download System templates on sec storage"""
|
"""Download System templates on sec storage"""
|
||||||
|
|
||||||
|
|||||||
@ -28,10 +28,13 @@ import email
|
|||||||
import socket
|
import socket
|
||||||
import urlparse
|
import urlparse
|
||||||
import datetime
|
import datetime
|
||||||
from marvin.cloudstackAPI import *
|
from marvin.cloudstackAPI import cloudstackAPIClient, listHosts
|
||||||
from marvin.sshClient import SshClient
|
from marvin.sshClient import SshClient
|
||||||
from marvin.codes import *
|
from marvin.codes import (FAIL,
|
||||||
|
PASS,
|
||||||
|
MATCH_NOT_FOUND,
|
||||||
|
INVALID_INPUT,
|
||||||
|
EMPTY_LIST)
|
||||||
|
|
||||||
def restart_mgmt_server(server):
|
def restart_mgmt_server(server):
|
||||||
"""Restarts the management server"""
|
"""Restarts the management server"""
|
||||||
@ -237,6 +240,18 @@ def xsplit(txt, seps):
|
|||||||
txt = txt.replace(sep, default_sep)
|
txt = txt.replace(sep, default_sep)
|
||||||
return [i.strip() for i in txt.split(default_sep)]
|
return [i.strip() for i in txt.split(default_sep)]
|
||||||
|
|
||||||
|
def get_hypervisor_type(apiclient):
|
||||||
|
|
||||||
|
"""Return the hypervisor type of the hosts in setup"""
|
||||||
|
|
||||||
|
cmd = listHosts.listHostsCmd()
|
||||||
|
cmd.type = 'Routing'
|
||||||
|
cmd.listall = True
|
||||||
|
hosts = apiclient.listHosts(cmd)
|
||||||
|
hosts_list_validation_result = validateList(hosts)
|
||||||
|
assert hosts_list_validation_result[0] == PASS, "host list validation failed"
|
||||||
|
return hosts_list_validation_result[1].hypervisor
|
||||||
|
|
||||||
def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid):
|
def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid):
|
||||||
"""
|
"""
|
||||||
Checks whether a snapshot with id (not UUID) `snapshotid` is present on the nfs storage
|
Checks whether a snapshot with id (not UUID) `snapshotid` is present on the nfs storage
|
||||||
@ -248,8 +263,12 @@ def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid):
|
|||||||
@param snapshotid: uuid of the snapshot
|
@param snapshotid: uuid of the snapshot
|
||||||
@return: True if snapshot is found, False otherwise
|
@return: True if snapshot is found, False otherwise
|
||||||
"""
|
"""
|
||||||
|
# snapshot extension to be appended to the snapshot path obtained from db
|
||||||
|
snapshot_extensions = {"vmware": ".ovf",
|
||||||
|
"kvm": "",
|
||||||
|
"xenserver": ".vhd"}
|
||||||
|
|
||||||
from base import ImageStore, Snapshot
|
from base import ImageStore
|
||||||
secondaryStores = ImageStore.list(apiclient, zoneid=zoneid)
|
secondaryStores = ImageStore.list(apiclient, zoneid=zoneid)
|
||||||
|
|
||||||
assert isinstance(secondaryStores, list), "Not a valid response for listImageStores"
|
assert isinstance(secondaryStores, list), "Not a valid response for listImageStores"
|
||||||
@ -281,7 +300,9 @@ def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid):
|
|||||||
#Snapshot does not exist
|
#Snapshot does not exist
|
||||||
return False
|
return False
|
||||||
|
|
||||||
snapshotPath = qresultset[0][0]
|
hypervisor = get_hypervisor_type(apiclient)
|
||||||
|
# append snapshot extension based on hypervisor, to the snapshot path
|
||||||
|
snapshotPath = str(qresultset[0][0]) + snapshot_extensions[str(hypervisor).lower()]
|
||||||
|
|
||||||
nfsurl = secondaryStore.url
|
nfsurl = secondaryStore.url
|
||||||
from urllib2 import urlparse
|
from urllib2 import urlparse
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user