You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2015/01/20 06:57:57 UTC
[01/12] git commit: updated refs/heads/4.5 to 30598e9
Repository: cloudstack
Updated Branches:
refs/heads/4.5 f702097b3 -> 30598e958
CLOUDSTACK-8152: Adding delay before creating snapshot/template from root disk after writing data to disk - test_vm_passwordenabled.py
Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>
(cherry picked from commit d79837b67a481e618c8291152a9ecec299ff02dd)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Conflicts:
test/integration/component/test_vm_passwdenabled.py
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/fc502a97
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/fc502a97
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/fc502a97
Branch: refs/heads/4.5
Commit: fc502a97c2a80c57bcee9084a4247d20b439f295
Parents: f702097
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Tue Jan 13 13:56:41 2015 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Jan 20 10:16:26 2015 +0530
----------------------------------------------------------------------
.../component/test_vm_passwdenabled.py | 98 ++++++++++++--------
1 file changed, 60 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fc502a97/test/integration/component/test_vm_passwdenabled.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vm_passwdenabled.py b/test/integration/component/test_vm_passwdenabled.py
index 1b556da..64e549b 100644
--- a/test/integration/component/test_vm_passwdenabled.py
+++ b/test/integration/component/test_vm_passwdenabled.py
@@ -14,24 +14,33 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-import marvin
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
-from marvin.sshClient import SshClient
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.utils import cleanup_resources
+from marvin.lib.base import (Account,
+ ServiceOffering,
+ VirtualMachine,
+ EgressFireWallRule,
+ Template)
+from marvin.lib.common import (get_domain,
+ get_zone,
+ get_template,
+ list_virtual_machines,
+ list_volumes)
from nose.plugins.attrib import attr
+import time
_multiprocess_shared_ = True
+
+
class Services:
+
"""Test VM Life Cycle Services
"""
def __init__(self):
self.services = {
- "disk_offering":{
+ "disk_offering": {
"displaytext": "Small",
"name": "Small",
"disksize": 1
@@ -44,26 +53,26 @@ class Services:
# Random characters are appended in create account to
# ensure unique username generated each time
"password": "password",
- },
+ },
"small":
# Create a small virtual machine instance with disk offering
{
"displayname": "testserver",
- "username": "root", # VM creds for SSH
+ "username": "root", # VM creds for SSH
"password": "password",
"ssh_port": 22,
"hypervisor": 'XenServer',
"privateport": 22,
"publicport": 22,
"protocol": 'TCP',
- },
+ },
"egress": {
"name": 'web',
"protocol": 'TCP',
"startport": 80,
"endport": 80,
"cidrlist": '0.0.0.0/0',
- },
+ },
"service_offerings":
{
"small":
@@ -75,19 +84,20 @@ class Services:
"cpunumber": 1,
"cpuspeed": 100,
"memory": 256,
- },
- },
+ },
+ },
"template": {
"displaytext": "Cent OS Template",
"name": "Cent OS Template",
"passwordenabled": True,
- },
+ },
"sleep": 60,
"timeout": 10,
"ostype": 'CentOS 5.3 (64-bit)',
# CentOS 5.3 (64-bit)
}
+
class TestVMPasswordEnabled(cloudstackTestCase):
@classmethod
@@ -132,33 +142,39 @@ class TestVMPasswordEnabled(cloudstackTestCase):
networkid = cls.virtual_machine.nic[0].networkid
- # create egress rule to allow wget of my cloud-set-guest-password script
+ # create egress rule to allow wget of my cloud-set-guest-password
+ # script
if zone.networktype.lower() == 'advanced':
- EgressFireWallRule.create(cls.api_client,
- networkid=networkid,
- protocol=cls.services["egress"]["protocol"],
- startport=cls.services["egress"]["startport"],
- endport=cls.services["egress"]["endport"],
- cidrlist=cls.services["egress"]["cidrlist"])
+ EgressFireWallRule.create(
+ cls.api_client,
+ networkid=networkid,
+ protocol=cls.services["egress"]["protocol"],
+ startport=cls.services["egress"]["startport"],
+ endport=cls.services["egress"]["endport"],
+ cidrlist=cls.services["egress"]["cidrlist"])
cls.virtual_machine.password = cls.services["small"]["password"]
ssh = cls.virtual_machine.get_ssh_client()
- #below steps are required to get the new password from VR(reset password)
- #http://cloudstack.org/dl/cloud-set-guest-password
- #Copy this file to /etc/init.d
- #chmod +x /etc/init.d/cloud-set-guest-password
- #chkconfig --add cloud-set-guest-password
+ # below steps are required to get the new password from VR
+ # (reset password)
+ # http://cloudstack.org/dl/cloud-set-guest-password
+ # Copy this file to /etc/init.d
+ # chmod +x /etc/init.d/cloud-set-guest-password
+ # chkconfig --add cloud-set-guest-password
cmds = [
"cd /etc/init.d;wget http://people.apache.org/~tsp/cloud-set-guest-password",
"chmod +x /etc/init.d/cloud-set-guest-password",
"chkconfig --add cloud-set-guest-password",
- ]
+ ]
for c in cmds:
- result = ssh.execute(c)
+ ssh.execute(c)
+
+ # Adding delay of 120 sec to avoid data loss due to timing issue
+ time.sleep(120)
- #Stop virtual machine
+ # Stop virtual machine
cls.virtual_machine.stop(cls.api_client)
# Poll listVM to ensure VM is stopped properly
@@ -199,7 +215,8 @@ class TestVMPasswordEnabled(cloudstackTestCase):
cls.virtual_machine.id)
cls.services["template"]["ostype"] = cls.services["ostype"]
- #Create templates for Edit, Delete & update permissions testcases
+ cls.services["template"]["ispublic"] = True
+ # Create templates for Edit, Delete & update permissions testcases
cls.pw_enabled_template = Template.create(
cls.api_client,
cls.services["template"],
@@ -237,11 +254,18 @@ class TestVMPasswordEnabled(cloudstackTestCase):
self.cleanup = []
def tearDown(self):
- #Clean up, terminate the created instances
+ # Clean up, terminate the created instances
cleanup_resources(self.apiclient, self.cleanup)
return
- @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
+ @attr(
+ tags=[
+ "advanced",
+ "advancedns",
+ "smoke",
+ "basic",
+ "sg"],
+ required_hardware="true")
def test_11_get_vm_password(self):
"""Test get VM password for password enabled template"""
@@ -255,9 +279,6 @@ class TestVMPasswordEnabled(cloudstackTestCase):
self.debug("Stopping VM: %s" % self.vm.name)
self.vm.stop(self.apiclient)
- # Sleep to ensure VM is stopped properly
- time.sleep(self.services["sleep"])
-
self.debug("Resetting VM password for VM: %s" % self.vm.name)
password = self.vm.resetPassword(self.apiclient)
self.debug("Password reset to: %s" % password)
@@ -282,7 +303,8 @@ class TestVMPasswordEnabled(cloudstackTestCase):
try:
self.debug("SSHing into VM: %s" % self.vm.ssh_ip)
self.vm.password = password
- ssh = self.vm.get_ssh_client()
+ self.vm.get_ssh_client()
except Exception as e:
- self.fail("SSH into VM: %s failed" % self.vm.ssh_ip)
+ self.fail("SSH into VM: %s failed: %s" %
+ (self.vm.ssh_ip, e))
return
[12/12] git commit: updated refs/heads/4.5 to 30598e9
Posted by bh...@apache.org.
setup/db: Fix database blunders
- Make schema-442to450.sql same as on master branch
- Make schema-430to440.sql same as on 4.4 branch
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/30598e95
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/30598e95
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/30598e95
Branch: refs/heads/4.5
Commit: 30598e958bf50b9c5d3742a6f36553b1f825c598
Parents: 57f5d51
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Tue Jan 20 11:21:10 2015 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Jan 20 11:24:20 2015 +0530
----------------------------------------------------------------------
setup/db/db/schema-430to440.sql | 7 -------
setup/db/db/schema-442to450.sql | 19 +++++++++++++++++--
2 files changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/30598e95/setup/db/db/schema-430to440.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-430to440.sql b/setup/db/db/schema-430to440.sql
index 0943518..ec10a3a 100644
--- a/setup/db/db/schema-430to440.sql
+++ b/setup/db/db/schema-430to440.sql
@@ -686,13 +686,6 @@ INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'CentOS 6.5 (64-bit)', 228);
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'CentOS 6.5 (64-bit)', 228);
-CREATE TABLE `cloud`.`baremetal_rct` (
- `id` bigint unsigned UNIQUE AUTO_INCREMENT,
- `uuid` varchar(40) UNIQUE NOT NULL,
- `url` varchar(2048) NOT NULL,
- `rct` text NOT NULL,
- PRIMARY KEY (`id`)
-) ENGINE = InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`op_router_monitoring_services` (
`vm_id` bigint unsigned UNIQUE NOT NULL COMMENT 'Primary Key',
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/30598e95/setup/db/db/schema-442to450.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-442to450.sql b/setup/db/db/schema-442to450.sql
index b268eca..9498481 100644
--- a/setup/db/db/schema-442to450.sql
+++ b/setup/db/db/schema-442to450.sql
@@ -770,6 +770,8 @@ INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, crea
INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (247, UUID(), 3, 'Oracle Linux 7', utc_timestamp());
INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (248, UUID(), 1, 'CentOS 6 (32-bit)', utc_timestamp());
INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (249, UUID(), 1, 'CentOS 6 (64-bit)', utc_timestamp());
+INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (250, UUID(), 3, 'Oracle Enterprise Linux 6.5 (32-bit)', utc_timestamp());
+INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (251, UUID(), 3, 'Oracle Enterprise Linux 6.5 (64-bit)', utc_timestamp());
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '6.5.0', 'CentOS 4.5 (32-bit)', 1, utc_timestamp(), 0);
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '6.5.0', 'CentOS 4.6 (32-bit)', 2, utc_timestamp(), 0);
@@ -852,6 +854,8 @@ INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervis
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '6.5.0', 'Oracle Enterprise Linux 6 (64-bit)', 220, utc_timestamp(), 0);
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '6.5.0', 'Oracle Enterprise Linux 6 (32-bit)', 235, utc_timestamp(), 0);
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '6.5.0', 'Oracle Enterprise Linux 6 (64-bit)', 236, utc_timestamp(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '6.5.0', 'Oracle Enterprise Linux 6 (32-bit)', 250, utc_timestamp(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '6.5.0', 'Oracle Enterprise Linux 6 (64-bit)', 251, utc_timestamp(), 0);
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '6.5.0', 'Oracle Linux 7', 247, utc_timestamp(), 0);
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '6.5.0', 'Red Hat Enterprise Linux 4.5 (32-bit)', 26, utc_timestamp(), 0);
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '6.5.0', 'Red Hat Enterprise Linux 4.6 (32-bit)', 27, utc_timestamp(), 0);
@@ -948,6 +952,16 @@ INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervis
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_data_volumes_limit, storage_motion_supported) VALUES (UUID(), 'XenServer', '6.5.0', 500, 1, 13, 1);
+update vlan set vlan_id=concat('vlan://', vlan_id) where vlan_type = "VirtualNetwork" and vlan_id not like "vlan://%";
+
+CREATE TABLE `cloud`.`baremetal_rct` (
+ `id` bigint unsigned UNIQUE AUTO_INCREMENT,
+ `uuid` varchar(40) UNIQUE NOT NULL,
+ `url` varchar(2048) NOT NULL,
+ `rct` text NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE = InnoDB DEFAULT CHARSET=utf8;
+
--Remove duplicates from guest_os_hypervisor table
DELETE t1 FROM guest_os_hypervisor t1, guest_os_hypervisor t2 WHERE (t1.hypervisor_type = t2.hypervisor_type AND t1.hypervisor_version = t2.hypervisor_version AND t1.guest_os_id = t2.guest_os_id AND t1.id > t2.id AND t1.is_user_defined=0);
@@ -961,6 +975,9 @@ ALTER TABLE `cloud`.`user_vm_details` MODIFY `value` VARCHAR(5120);
UPDATE `cloud`.`host` SET resource = REPLACE(resource, 'com.cloud.hypervisor.xen.resource', 'com.cloud.hypervisor.xenserver.resource') WHERE hypervisor_type='XenServer' AND REMOVED IS NULL;
+INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type, extractable, state)
+ VALUES (11, UUID(), 'centos7-x86_64-lxc', 'CentOS 7(64-bit) no GUI (LXC)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://download.cloud.com/templates/builtin/centos-7-x86_64.tar.gz', 'c2c4fa2d0978121c7977db571f132d6e', 0, 'CentOS 7(64-bit) no GUI (LXC)', 'TAR', 246, 1, 1, 'LXC', 1, 'Active');
+
--Support for RHEL 6.5 in relevant hypervisor versions
INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (252, UUID(), 4, 'Red Hat Enterprise Linux 6.5 (32-bit)', utc_timestamp());
INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (253, UUID(), 4, 'Red Hat Enterprise Linux 6.5 (64-bit)', utc_timestamp());
@@ -979,8 +996,6 @@ INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervis
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'VMware', '5.1', 'rhel6_64Guest', 253, utc_timestamp(), 0);
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'VMware', '5.5', 'rhel6Guest', 252, utc_timestamp(), 0);
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'VMware', '5,5', 'rhel6_64Guest', 253, utc_timestamp(), 0);
-INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type, extractable, state)
- VALUES (11, UUID(), 'centos7-x86_64-lxc', 'CentOS 7(64-bit) no GUI (LXC)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://download.cloud.com/templates/builtin/centos-7-x86_64.tar.gz', 'c2c4fa2d0978121c7977db571f132d6e', 0, 'CentOS 7(64-bit) no GUI (LXC)', 'TAR', 246, 1, 1, 'LXC', 1, 'Active');
--Support for Debian 7 on KVM/LXC
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'KVM', 'default', 'Debian GNU/Linux 7(32-bit)', 183, utc_timestamp(), 0);
[02/12] git commit: updated refs/heads/4.5 to 30598e9
Posted by bh...@apache.org.
CLOUDSTACK-8132: Fixed issue related to secondary storage count of template
Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>
(cherry picked from commit f938a5e1c352971aa61e75a60935c735c3d3920c)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9a75a0cd
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9a75a0cd
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9a75a0cd
Branch: refs/heads/4.5
Commit: 9a75a0cd221efc85a9d2b27fafdbf60995aa57eb
Parents: fc502a9
Author: Ashutosh K <as...@clogeny.com>
Authored: Mon Dec 29 03:34:37 2014 -0800
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Jan 20 10:18:24 2015 +0530
----------------------------------------------------------------------
test/integration/component/test_ss_limits.py | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a75a0cd/test/integration/component/test_ss_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ss_limits.py b/test/integration/component/test_ss_limits.py
index c498302..d5ee063 100644
--- a/test/integration/component/test_ss_limits.py
+++ b/test/integration/component/test_ss_limits.py
@@ -126,7 +126,7 @@ class TestSecondaryStorageLimits(cloudstackTestCase):
except Exception as e:
return [FAIL, e]
return [PASS, None]
-
+
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
@attr(tags = ["advanced"], required_hardware="true")
def test_01_register_template(self, value):
@@ -143,24 +143,28 @@ class TestSecondaryStorageLimits(cloudstackTestCase):
response = self.setupAccount(value)
self.assertEqual(response[0], PASS, response[1])
+ apiclient = self.testClient.getUserApiClient(
+ UserName=self.account.name,
+ DomainName=self.account.domain)
+
builtin_info = get_builtin_template_info(self.apiclient, self.zone.id)
self.services["template_2"]["url"] = builtin_info[0]
self.services["template_2"]["hypervisor"] = builtin_info[1]
self.services["template_2"]["format"] = builtin_info[2]
try:
- template = Template.register(self.apiclient,
+ template = Template.register(apiclient,
self.services["template_2"],
zoneid=self.zone.id,
account=self.account.name,
domainid=self.account.domainid,
hypervisor=self.hypervisor)
- template.download(self.apiclient)
+ template.download(apiclient)
except Exception as e:
self.fail("Failed to register template: %s" % e)
- templates = Template.list(self.apiclient,
+ templates = Template.list(apiclient,
templatefilter=\
self.services["template_2"]["templatefilter"],
id=template.id)
@@ -170,19 +174,19 @@ class TestSecondaryStorageLimits(cloudstackTestCase):
templateSize = (templates[0].size / (1024**3))
expectedCount = templateSize
response = matchResourceCount(
- self.apiclient, expectedCount,
+ apiclient, expectedCount,
RESOURCE_SECONDARY_STORAGE,
accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
try:
- template.delete(self.apiclient)
+ template.delete(apiclient)
except Exception as e:
self.fail("Failed to delete template: %s" % e)
expectedCount = 0
response = matchResourceCount(
- self.apiclient, expectedCount,
+ apiclient, expectedCount,
RESOURCE_SECONDARY_STORAGE,
accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
[10/12] git commit: updated refs/heads/4.5 to 30598e9
Posted by bh...@apache.org.
CLOUDSTACK-7977
Fix password generator, add guards for minimum length
(cherry picked from commit 960b7bbf742bbba62cd25bc62b700c6c829e35f2)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3cb43582
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3cb43582
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3cb43582
Branch: refs/heads/4.5
Commit: 3cb4358270497d4db22d19647a4c2820ed544f04
Parents: 1b7a100
Author: amoghvk <am...@citrix.com>
Authored: Wed Nov 26 15:08:48 2014 -0800
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Jan 20 10:31:05 2015 +0530
----------------------------------------------------------------------
server/src/com/cloud/configuration/Config.java | 8 +++++++
.../configuration/ConfigurationManagerImpl.java | 5 ++++
.../src/com/cloud/utils/PasswordGenerator.java | 24 ++++++++++++++------
.../com/cloud/utils/PasswordGeneratorTest.java | 7 +++---
4 files changed, 34 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cb43582/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index 091a3e9..dfb5f2a 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -907,6 +907,14 @@ public enum Config {
"0",
"Default disk I/O read rate in requests per second allowed in User vm's disk.",
null),
+ VmPasswordLength(
+ "Advanced",
+ ManagementServer.class,
+ Integer.class,
+ "vm.password.length",
+ "6",
+ "Specifies the length of a randomly generated password",
+ null),
VmDiskThrottlingIopsWriteRate(
"Advanced",
ManagementServer.class,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cb43582/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index ce63e84..cf94b95 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -366,6 +366,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
configValuesForValidation.add("xenserver.heartbeat.interval");
configValuesForValidation.add("xenserver.heartbeat.timeout");
configValuesForValidation.add("incorrect.login.attempts.allowed");
+ configValuesForValidation.add("vm.password.length");
}
private void weightBasedParametersForValidation() {
@@ -779,6 +780,10 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
if (val <= 0) {
throw new InvalidParameterValueException("Please enter a positive value for the configuration parameter:" + name);
}
+ //TODO - better validation for all password pamameters
+ if ("vm.password.length".equalsIgnoreCase(name) && val < 6) {
+ throw new InvalidParameterValueException("Please enter a value greater than 6 for the configuration parameter:" + name);
+ }
} catch (NumberFormatException e) {
s_logger.error("There was an error trying to parse the integer value for:" + name);
throw new InvalidParameterValueException("There was an error trying to parse the integer value for:" + name);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cb43582/utils/src/com/cloud/utils/PasswordGenerator.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/PasswordGenerator.java b/utils/src/com/cloud/utils/PasswordGenerator.java
index 2abf071..0d79143 100644
--- a/utils/src/com/cloud/utils/PasswordGenerator.java
+++ b/utils/src/com/cloud/utils/PasswordGenerator.java
@@ -35,18 +35,28 @@ public class PasswordGenerator {
static private char[] alphaNumeric = new char[] {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '2', '3', '4', '5', '6', '7', '8', '9'};
+ static private int minLength = 3;
+
public static String generateRandomPassword(int num) {
Random r = new SecureRandom();
StringBuilder password = new StringBuilder();
- // Generate random 3-character string with a lowercase character,
- // uppercase character, and a digit
- password.append(generateLowercaseChar(r)).append(generateUppercaseChar(r)).append(generateDigit(r));
+ //Guard for num < minLength
+ if (num < minLength) {
+ //Add alphanumeric chars at random
+ for (int i = 0; i < minLength; i++) {
+ password.append(generateAlphaNumeric(r));
+ }
+ } else {
+ // Generate random 3-character string with a lowercase character,
+ // uppercase character, and a digit
+ password.append(generateLowercaseChar(r)).append(generateUppercaseChar(r)).append(generateDigit(r));
- // Generate a random n-character string with only lowercase
- // characters
- for (int i = 0; i < num; i++) {
- password.append(generateLowercaseChar(r));
+ // Generate a random n-character string with only lowercase
+ // characters
+ for (int i = 0; i < num - 3; i++) {
+ password.append(generateLowercaseChar(r));
+ }
}
return password.toString();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cb43582/utils/test/com/cloud/utils/PasswordGeneratorTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/PasswordGeneratorTest.java b/utils/test/com/cloud/utils/PasswordGeneratorTest.java
index a4e2496..413b866 100644
--- a/utils/test/com/cloud/utils/PasswordGeneratorTest.java
+++ b/utils/test/com/cloud/utils/PasswordGeneratorTest.java
@@ -25,10 +25,11 @@ import org.junit.Test;
public class PasswordGeneratorTest {
@Test
public void generateRandomPassword() {
- // actual length is requested length + 3
+ // actual length is requested length, minimum length is 3
Assert.assertTrue(PasswordGenerator.generateRandomPassword(0).length() == 3);
- Assert.assertTrue(PasswordGenerator.generateRandomPassword(1).length() == 4);
- String password = PasswordGenerator.generateRandomPassword(0);
+ Assert.assertTrue(PasswordGenerator.generateRandomPassword(1).length() == 3);
+ Assert.assertTrue(PasswordGenerator.generateRandomPassword(5).length() == 5);
+ String password = PasswordGenerator.generateRandomPassword(8);
// TODO: this might give more help to bruteforcing than desired
// the actual behavior is that the first character is a random lowercase
// char
[05/12] git commit: updated refs/heads/4.5 to 30598e9
Posted by bh...@apache.org.
CLOUDSTACK-8056: EN: Miss SC and UK keyboard option for VMware hypervisor when register a template.
(cherry picked from commit 4d78703522d37980d7d3461b8bcaaa4dcdbaf4e0)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e6620b12
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e6620b12
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e6620b12
Branch: refs/heads/4.5
Commit: e6620b12e36a4dc95629435e77970d91727fd929
Parents: 899bb8b
Author: Sanjay Tripathi <sa...@citrix.com>
Authored: Wed Dec 10 14:16:48 2014 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Jan 20 10:22:42 2015 +0530
----------------------------------------------------------------------
ui/scripts/templates.js | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e6620b12/ui/scripts/templates.js
----------------------------------------------------------------------
diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js
index b95bb7d..1cb613b 100644
--- a/ui/scripts/templates.js
+++ b/ui/scripts/templates.js
@@ -325,11 +325,19 @@
});
items.push({
id: "us",
- description: "US"
+ description: "US Keboard"
+ });
+ items.push({
+ id: "uk",
+ description: "UK Keyboard"
});
items.push({
id: "jp",
- description: "Japanese"
+ description: "Japanese Keyboard"
+ });
+ items.push({
+ id: "sc",
+ description: "Simplified Chinese"
});
args.response.success({
data: items
[03/12] git commit: updated refs/heads/4.5 to 30598e9
Posted by bh...@apache.org.
CLOUDSTACK-8130: Fixed test_escalations_templates.py - Removed test case dependency on each other
Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>
(cherry picked from commit 17da2e9ce9894b67c32306fb36d02786d34ad0d0)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/345fd54f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/345fd54f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/345fd54f
Branch: refs/heads/4.5
Commit: 345fd54fc141e6dab48ba2d3c99ea38417d9087f
Parents: 9a75a0c
Author: Ashutosh K <as...@clogeny.com>
Authored: Fri Dec 26 12:24:29 2014 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Jan 20 10:18:39 2015 +0530
----------------------------------------------------------------------
.../component/test_escalations_templates.py | 1001 +++++++++---------
1 file changed, 509 insertions(+), 492 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/345fd54f/test/integration/component/test_escalations_templates.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_templates.py b/test/integration/component/test_escalations_templates.py
index 3dc24c1..a7787c7 100644
--- a/test/integration/component/test_escalations_templates.py
+++ b/test/integration/component/test_escalations_templates.py
@@ -16,15 +16,23 @@
# under the License.
# Import Local Modules
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.lib.utils import (cleanup_resources,
+ validateList)
+from marvin.lib.base import (Account,
+ Zone,
+ Template,
+ Hypervisor)
+from marvin.lib.common import (get_domain,
+ get_zone,
+ get_template,
+ list_os_types,
+ get_builtin_template_info)
from marvin.codes import PASS
from nose.plugins.attrib import attr
import time
+
class TestTemplates(cloudstackTestCase):
@classmethod
@@ -36,23 +44,21 @@ class TestTemplates(cloudstackTestCase):
cls.services = cls.testClient.getParsedTestDataConfig()
# Get Domain, Zone, Template
cls.domain = get_domain(cls.api_client)
- cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+ cls.zone = get_zone(
+ cls.api_client,
+ cls.testClient.getZoneForTests())
cls.template = get_template(
- cls.api_client,
- cls.zone.id,
- cls.services["ostype"]
- )
+ cls.api_client,
+ cls.zone.id,
+ cls.services["ostype"]
+ )
cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.services['mode'] = cls.zone.networktype
- cls.account = Account.create(
- cls.api_client,
- cls.services["account"],
- domainid=cls.domain.id
- )
- # Getting authentication for user in newly created Account
- cls.user = cls.account.user[0]
- cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
- cls._cleanup.append(cls.account)
+
+ builtin_info = get_builtin_template_info(cls.api_client, cls.zone.id)
+ cls.services["privatetemplate"]["url"] = builtin_info[0]
+ cls.services["privatetemplate"]["hypervisor"] = builtin_info[1]
+ cls.services["privatetemplate"]["format"] = builtin_info[2]
except Exception as e:
cls.tearDownClass()
raise Exception("Warning: Exception in setup : %s" % e)
@@ -62,6 +68,17 @@ class TestTemplates(cloudstackTestCase):
self.apiClient = self.testClient.getApiClient()
self.cleanup = []
+ self.account = Account.create(
+ self.apiClient,
+ self.services["account"],
+ domainid=self.domain.id
+ )
+ # Getting authentication for user in newly created Account
+ self.user = self.account.user[0]
+ self.userapiclient = self.testClient.getUserApiClient(
+ self.user.username,
+ self.domain.name)
+ self.cleanup.append(self.account)
def tearDown(self):
# Clean up, terminate the created resources
@@ -102,10 +119,9 @@ class TestTemplates(cloudstackTestCase):
return_flag = return_flag and True
else:
return_flag = return_flag and False
- self.debug("expected Value: %s, is not matching with actual value: %s" % (
- exp_val,
- act_val
- ))
+ self.debug(
+ "expected Value: %s, is not matching with actual value: %s" %
+ (exp_val, act_val))
return return_flag
@attr(tags=["advanced", "basic"], required_hardware="true")
@@ -132,105 +148,104 @@ class TestTemplates(cloudstackTestCase):
"""
# Listing all the Templates for a User
list_templates_before = Template.list(
- self.userapiclient,
- listall=self.services["listall"],
- templatefilter=self.services["templatefilter"]
- )
+ self.userapiclient,
+ listall=self.services["listall"],
+ templatefilter=self.services["templatefilter"]
+ )
# Verifying that no Templates are listed
self.assertIsNone(
- list_templates_before,
- "Templates listed for newly created User"
- )
- self.services["templateregister"]["ostype"] = self.services["ostype"]
+ list_templates_before,
+ "Templates listed for newly created User"
+ )
+ self.services["privatetemplate"]["ostype"] = self.services["ostype"]
# Creating pagesize + 1 number of Templates
for i in range(0, (self.services["pagesize"] + 1)):
template_created = Template.register(
- self.userapiclient,
- self.services["templateregister"],
- self.zone.id,
- hypervisor=self.hypervisor
- )
+ self.userapiclient,
+ self.services["privatetemplate"],
+ self.zone.id,
+ hypervisor=self.hypervisor
+ )
self.assertIsNotNone(
- template_created,
- "Template creation failed"
- )
- if(i < self.services["pagesize"]):
- self.cleanup.append(template_created)
+ template_created,
+ "Template creation failed"
+ )
# Listing all the Templates for a User
list_templates_after = Template.list(
- self.userapiclient,
- listall=self.services["listall"],
- templatefilter=self.services["templatefilter"]
- )
+ self.userapiclient,
+ listall=self.services["listall"],
+ templatefilter=self.services["templatefilter"]
+ )
status = validateList(list_templates_after)
self.assertEquals(
- PASS,
- status[0],
- "Templates creation failed"
- )
+ PASS,
+ status[0],
+ "Templates creation failed"
+ )
# Verifying that list size is pagesize + 1
self.assertEquals(
- self.services["pagesize"] + 1,
- len(list_templates_after),
- "Failed to create pagesize + 1 number of Templates"
- )
+ self.services["pagesize"] + 1,
+ len(list_templates_after),
+ "Failed to create pagesize + 1 number of Templates"
+ )
# Listing all the Templates in page 1
list_templates_page1 = Template.list(
- self.userapiclient,
- listall=self.services["listall"],
- templatefilter=self.services["templatefilter"],
- page=1,
- pagesize=self.services["pagesize"]
- )
+ self.userapiclient,
+ listall=self.services["listall"],
+ templatefilter=self.services["templatefilter"],
+ page=1,
+ pagesize=self.services["pagesize"]
+ )
status = validateList(list_templates_page1)
self.assertEquals(
- PASS,
- status[0],
- "Failed to list Templates in page 1"
- )
+ PASS,
+ status[0],
+ "Failed to list Templates in page 1"
+ )
# Verifying the list size to be equal to pagesize
self.assertEquals(
- self.services["pagesize"],
- len(list_templates_page1),
- "Size of Templates in page 1 is not matching"
- )
+ self.services["pagesize"],
+ len(list_templates_page1),
+ "Size of Templates in page 1 is not matching"
+ )
# Listing all the Templates in page 2
list_templates_page2 = Template.list(
- self.userapiclient,
- listall=self.services["listall"],
- templatefilter=self.services["templatefilter"],
- page=2,
- pagesize=self.services["pagesize"]
- )
+ self.userapiclient,
+ listall=self.services["listall"],
+ templatefilter=self.services["templatefilter"],
+ page=2,
+ pagesize=self.services["pagesize"]
+ )
status = validateList(list_templates_page2)
self.assertEquals(
- PASS,
- status[0],
- "Failed to list Templates in page 2"
- )
+ PASS,
+ status[0],
+ "Failed to list Templates in page 2"
+ )
# Verifying the list size to be equal to 1
self.assertEquals(
- 1,
- len(list_templates_page2),
- "Size of Templates in page 2 is not matching"
- )
- # Verifying the state of the template to be ready. If not waiting for state to become ready
+ 1,
+ len(list_templates_page2),
+ "Size of Templates in page 2 is not matching"
+ )
+ # Verifying the state of the template to be ready. If not waiting for
+ # state to become ready
template_ready = False
count = 0
while template_ready is False:
list_template = Template.list(
- self.userapiclient,
- id=template_created.id,
- listall=self.services["listall"],
- templatefilter=self.services["templatefilter"],
- )
+ self.userapiclient,
+ id=template_created.id,
+ listall=self.services["listall"],
+ templatefilter=self.services["templatefilter"],
+ )
status = validateList(list_template)
self.assertEquals(
- PASS,
- status[0],
- "Failed to list Templates by Id"
- )
+ PASS,
+ status[0],
+ "Failed to list Templates by Id"
+ )
if list_template[0].isready is True:
template_ready = True
elif (str(list_template[0].status) == "Error"):
@@ -245,23 +260,23 @@ class TestTemplates(cloudstackTestCase):
# Deleting the Template present in page 2
Template.delete(
- template_created,
- self.userapiclient
- )
+ template_created,
+ self.userapiclient
+ )
# Listing all the Templates in page 2 again
list_templates_page2 = Template.list(
- self.userapiclient,
- listall=self.services["listall"],
- templatefilter=self.services["templatefilter"],
- page=2,
- pagesize=self.services["pagesize"]
- )
+ self.userapiclient,
+ listall=self.services["listall"],
+ templatefilter=self.services["templatefilter"],
+ page=2,
+ pagesize=self.services["pagesize"]
+ )
# Verifying that there are no Templates listed
self.assertIsNone(
- list_templates_page2,
- "Templates not deleted from page 2"
- )
- del self.services["templateregister"]["ostype"]
+ list_templates_page2,
+ "Templates not deleted from page 2"
+ )
+ del self.services["privatetemplate"]["ostype"]
return
@attr(tags=["advanced", "basic"], required_hardware="true")
@@ -282,63 +297,63 @@ class TestTemplates(cloudstackTestCase):
"""
# Listing all the Templates for a User
list_templates_before = Template.list(
- self.userapiclient,
- listall=self.services["listall"],
- templatefilter=self.services["templatefilter"]
- )
+ self.userapiclient,
+ listall=self.services["listall"],
+ templatefilter=self.services["templatefilter"]
+ )
# Verifying that no Templates are listed
self.assertIsNone(
- list_templates_before,
- "Templates listed for newly created User"
- )
- self.services["templateregister"]["ostype"] = self.services["ostype"]
- self.services["templateregister"]["isextractable"] = True
+ list_templates_before,
+ "Templates listed for newly created User"
+ )
+ self.services["privatetemplate"]["ostype"] = self.services["ostype"]
+ self.services["privatetemplate"]["isextractable"] = True
# Creating aTemplate
template_created = Template.register(
- self.userapiclient,
- self.services["templateregister"],
- self.zone.id,
- hypervisor=self.hypervisor
- )
+ self.userapiclient,
+ self.services["privatetemplate"],
+ self.zone.id,
+ hypervisor=self.hypervisor
+ )
self.assertIsNotNone(
- template_created,
- "Template creation failed"
- )
- self.cleanup.append(template_created)
+ template_created,
+ "Template creation failed"
+ )
# Listing all the Templates for a User
list_templates_after = Template.list(
- self.userapiclient,
- listall=self.services["listall"],
- templatefilter=self.services["templatefilter"]
- )
+ self.userapiclient,
+ listall=self.services["listall"],
+ templatefilter=self.services["templatefilter"]
+ )
status = validateList(list_templates_after)
self.assertEquals(
- PASS,
- status[0],
- "Templates creation failed"
- )
+ PASS,
+ status[0],
+ "Templates creation failed"
+ )
# Verifying that list size is 1
self.assertEquals(
- 1,
- len(list_templates_after),
- "Failed to create a Template"
- )
- # Verifying the state of the template to be ready. If not waiting for state to become ready till time out
+ 1,
+ len(list_templates_after),
+ "Failed to create a Template"
+ )
+ # Verifying the state of the template to be ready. If not waiting for
+ # state to become ready till time out
template_ready = False
count = 0
while template_ready is False:
list_template = Template.list(
- self.userapiclient,
- id=template_created.id,
- listall=self.services["listall"],
- templatefilter=self.services["templatefilter"],
- )
+ self.userapiclient,
+ id=template_created.id,
+ listall=self.services["listall"],
+ templatefilter=self.services["templatefilter"],
+ )
status = validateList(list_template)
self.assertEquals(
- PASS,
- status[0],
- "Failed to list Templates by Id"
- )
+ PASS,
+ status[0],
+ "Failed to list Templates by Id"
+ )
if list_template[0].isready is True:
template_ready = True
elif (str(list_template[0].status) == "Error"):
@@ -353,32 +368,32 @@ class TestTemplates(cloudstackTestCase):
# Downloading the Template name
download_template = Template.extract(
- self.userapiclient,
- template_created.id,
- mode="HTTP_DOWNLOAD",
- zoneid=self.zone.id
- )
+ self.userapiclient,
+ template_created.id,
+ mode="HTTP_DOWNLOAD",
+ zoneid=self.zone.id
+ )
self.assertIsNotNone(
- download_template,
- "Download Template failed"
- )
- # Verifying the details of downloaded template
+ download_template,
+ "Download Template failed"
+ )
+ # Verifying the details of downloaded template
self.assertEquals(
- "DOWNLOAD_URL_CREATED",
- download_template.state,
- "Download URL not created for Template"
- )
+ "DOWNLOAD_URL_CREATED",
+ download_template.state,
+ "Download URL not created for Template"
+ )
self.assertIsNotNone(
- download_template.url,
- "Download URL not created for Template"
- )
+ download_template.url,
+ "Download URL not created for Template"
+ )
self.assertEquals(
- template_created.id,
- download_template.id,
- "Download Template details are not same as Template created"
- )
- del self.services["templateregister"]["ostype"]
- del self.services["templateregister"]["isextractable"]
+ template_created.id,
+ download_template.id,
+ "Download Template details are not same as Template created"
+ )
+ del self.services["privatetemplate"]["ostype"]
+ del self.services["privatetemplate"]["isextractable"]
return
@attr(tags=["advanced", "basic"], required_hardware="true")
@@ -407,62 +422,62 @@ class TestTemplates(cloudstackTestCase):
"""
# Listing all the Templates for a User
list_templates_before = Template.list(
- self.userapiclient,
- listall=self.services["listall"],
- templatefilter=self.services["templatefilter"]
- )
+ self.userapiclient,
+ listall=self.services["listall"],
+ templatefilter=self.services["templatefilter"]
+ )
# Verifying that no Templates are listed
self.assertIsNone(
- list_templates_before,
- "Templates listed for newly created User"
- )
- self.services["templateregister"]["ostype"] = self.services["ostype"]
+ list_templates_before,
+ "Templates listed for newly created User"
+ )
+ self.services["privatetemplate"]["ostype"] = self.services["ostype"]
# Creating aTemplate
template_created = Template.register(
- self.userapiclient,
- self.services["templateregister"],
- self.zone.id,
- hypervisor=self.hypervisor
- )
+ self.userapiclient,
+ self.services["privatetemplate"],
+ self.zone.id,
+ hypervisor=self.hypervisor
+ )
self.assertIsNotNone(
- template_created,
- "Template creation failed"
- )
- self.cleanup.append(template_created)
+ template_created,
+ "Template creation failed"
+ )
# Listing all the Templates for a User
list_templates_after = Template.list(
- self.userapiclient,
- listall=self.services["listall"],
- templatefilter=self.services["templatefilter"]
- )
+ self.userapiclient,
+ listall=self.services["listall"],
+ templatefilter=self.services["templatefilter"]
+ )
status = validateList(list_templates_after)
self.assertEquals(
- PASS,
- status[0],
- "Templates creation failed"
- )
+ PASS,
+ status[0],
+ "Templates creation failed"
+ )
# Verifying that list size is 1
self.assertEquals(
- 1,
- len(list_templates_after),
- "Failed to create a Template"
- )
- # Verifying the state of the template to be ready. If not waiting for state to become ready till time out
+ 1,
+ len(list_templates_after),
+ "Failed to create a Template"
+ )
+ # Verifying the state of the template to be ready. If not waiting for
+ # state to become ready till time out
template_ready = False
count = 0
while template_ready is False:
list_template = Template.list(
- self.userapiclient,
- id=template_created.id,
- listall=self.services["listall"],
- templatefilter=self.services["templatefilter"],
- )
+ self.userapiclient,
+ id=template_created.id,
+ listall=self.services["listall"],
+ templatefilter=self.services["templatefilter"],
+ )
status = validateList(list_template)
self.assertEquals(
- PASS,
- status[0],
- "Failed to list Templates by Id"
- )
+ PASS,
+ status[0],
+ "Failed to list Templates by Id"
+ )
if list_template[0].isready is True:
template_ready = True
elif (str(list_template[0].status) == "Error"):
@@ -477,220 +492,220 @@ class TestTemplates(cloudstackTestCase):
# Editing the Template name
edited_template = Template.update(
- template_created,
- self.userapiclient,
- name="NewTemplateName"
- )
+ template_created,
+ self.userapiclient,
+ name="NewTemplateName"
+ )
self.assertIsNotNone(
- edited_template,
- "Editing Template failed"
- )
- # Verifying the details of edited template
+ edited_template,
+ "Editing Template failed"
+ )
+ # Verifying the details of edited template
expected_dict = {
- "id":template_created.id,
- "name":"NewTemplateName",
- "displaytest":template_created.displaytext,
- "account":template_created.account,
- "domainid":template_created.domainid,
- "format":template_created.format,
- "ostypeid":template_created.ostypeid,
- "templatetype":template_created.templatetype,
- }
+ "id": template_created.id,
+ "name": "NewTemplateName",
+ "displaytest": template_created.displaytext,
+ "account": template_created.account,
+ "domainid": template_created.domainid,
+ "format": template_created.format,
+ "ostypeid": template_created.ostypeid,
+ "templatetype": template_created.templatetype,
+ }
actual_dict = {
- "id":edited_template.id,
- "name":edited_template.name,
- "displaytest":edited_template.displaytext,
- "account":edited_template.account,
- "domainid":edited_template.domainid,
- "format":edited_template.format,
- "ostypeid":edited_template.ostypeid,
- "templatetype":edited_template.templatetype,
- }
+ "id": edited_template.id,
+ "name": edited_template.name,
+ "displaytest": edited_template.displaytext,
+ "account": edited_template.account,
+ "domainid": edited_template.domainid,
+ "format": edited_template.format,
+ "ostypeid": edited_template.ostypeid,
+ "templatetype": edited_template.templatetype,
+ }
edit_template_status = self.__verify_values(
- expected_dict,
- actual_dict
- )
+ expected_dict,
+ actual_dict
+ )
self.assertEqual(
- True,
- edit_template_status,
- "Edited Template details are not as expected"
- )
+ True,
+ edit_template_status,
+ "Edited Template details are not as expected"
+ )
# Editing the Template displaytext
edited_template = Template.update(
- template_created,
- self.userapiclient,
- displaytext="TemplateDisplaytext"
- )
+ template_created,
+ self.userapiclient,
+ displaytext="TemplateDisplaytext"
+ )
self.assertIsNotNone(
- edited_template,
- "Editing Template failed"
- )
- # Verifying the details of edited template
+ edited_template,
+ "Editing Template failed"
+ )
+ # Verifying the details of edited template
expected_dict = {
- "id":template_created.id,
- "name":"NewTemplateName",
- "displaytest":"TemplateDisplaytext",
- "account":template_created.account,
- "domainid":template_created.domainid,
- "format":template_created.format,
- "ostypeid":template_created.ostypeid,
- "templatetype":template_created.templatetype,
- }
+ "id": template_created.id,
+ "name": "NewTemplateName",
+ "displaytest": "TemplateDisplaytext",
+ "account": template_created.account,
+ "domainid": template_created.domainid,
+ "format": template_created.format,
+ "ostypeid": template_created.ostypeid,
+ "templatetype": template_created.templatetype,
+ }
actual_dict = {
- "id":edited_template.id,
- "name":edited_template.name,
- "displaytest":edited_template.displaytext,
- "account":edited_template.account,
- "domainid":edited_template.domainid,
- "format":edited_template.format,
- "ostypeid":edited_template.ostypeid,
- "templatetype":edited_template.templatetype,
- }
+ "id": edited_template.id,
+ "name": edited_template.name,
+ "displaytest": edited_template.displaytext,
+ "account": edited_template.account,
+ "domainid": edited_template.domainid,
+ "format": edited_template.format,
+ "ostypeid": edited_template.ostypeid,
+ "templatetype": edited_template.templatetype,
+ }
edit_template_status = self.__verify_values(
- expected_dict,
- actual_dict
- )
+ expected_dict,
+ actual_dict
+ )
self.assertEqual(
- True,
- edit_template_status,
- "Edited Template details are not as expected"
- )
+ True,
+ edit_template_status,
+ "Edited Template details are not as expected"
+ )
# Editing the Template ostypeid
ostype_list = list_os_types(self.userapiclient)
status = validateList(ostype_list)
self.assertEquals(
- PASS,
- status[0],
- "Failed to list OS Types"
- )
+ PASS,
+ status[0],
+ "Failed to list OS Types"
+ )
for i in range(0, len(ostype_list)):
if ostype_list[i].id != template_created.ostypeid:
newostypeid = ostype_list[i].id
break
edited_template = Template.update(
- template_created,
- self.userapiclient,
- ostypeid=newostypeid
- )
+ template_created,
+ self.userapiclient,
+ ostypeid=newostypeid
+ )
self.assertIsNotNone(
- edited_template,
- "Editing Template failed"
- )
- # Verifying the details of edited template
+ edited_template,
+ "Editing Template failed"
+ )
+ # Verifying the details of edited template
expected_dict = {
- "id":template_created.id,
- "name":"NewTemplateName",
- "displaytest":"TemplateDisplaytext",
- "account":template_created.account,
- "domainid":template_created.domainid,
- "format":template_created.format,
- "ostypeid":newostypeid,
- "templatetype":template_created.templatetype,
- }
+ "id": template_created.id,
+ "name": "NewTemplateName",
+ "displaytest": "TemplateDisplaytext",
+ "account": template_created.account,
+ "domainid": template_created.domainid,
+ "format": template_created.format,
+ "ostypeid": newostypeid,
+ "templatetype": template_created.templatetype,
+ }
actual_dict = {
- "id":edited_template.id,
- "name":edited_template.name,
- "displaytest":edited_template.displaytext,
- "account":edited_template.account,
- "domainid":edited_template.domainid,
- "format":edited_template.format,
- "ostypeid":edited_template.ostypeid,
- "templatetype":edited_template.templatetype,
- }
+ "id": edited_template.id,
+ "name": edited_template.name,
+ "displaytest": edited_template.displaytext,
+ "account": edited_template.account,
+ "domainid": edited_template.domainid,
+ "format": edited_template.format,
+ "ostypeid": edited_template.ostypeid,
+ "templatetype": edited_template.templatetype,
+ }
edit_template_status = self.__verify_values(
- expected_dict,
- actual_dict
- )
+ expected_dict,
+ actual_dict
+ )
self.assertEqual(
- True,
- edit_template_status,
- "Edited Template details are not as expected"
- )
+ True,
+ edit_template_status,
+ "Edited Template details are not as expected"
+ )
# Editing the Template name, displaytext
edited_template = Template.update(
- template_created,
- self.userapiclient,
- name=template_created.name,
- displaytext=template_created.displaytext
- )
+ template_created,
+ self.userapiclient,
+ name=template_created.name,
+ displaytext=template_created.displaytext
+ )
self.assertIsNotNone(
- edited_template,
- "Editing Template failed"
- )
- # Verifying the details of edited template
+ edited_template,
+ "Editing Template failed"
+ )
+ # Verifying the details of edited template
expected_dict = {
- "id":template_created.id,
- "name":template_created.name,
- "displaytest":template_created.displaytext,
- "account":template_created.account,
- "domainid":template_created.domainid,
- "format":template_created.format,
- "ostypeid":newostypeid,
- "templatetype":template_created.templatetype,
- }
+ "id": template_created.id,
+ "name": template_created.name,
+ "displaytest": template_created.displaytext,
+ "account": template_created.account,
+ "domainid": template_created.domainid,
+ "format": template_created.format,
+ "ostypeid": newostypeid,
+ "templatetype": template_created.templatetype,
+ }
actual_dict = {
- "id":edited_template.id,
- "name":edited_template.name,
- "displaytest":edited_template.displaytext,
- "account":edited_template.account,
- "domainid":edited_template.domainid,
- "format":edited_template.format,
- "ostypeid":edited_template.ostypeid,
- "templatetype":edited_template.templatetype,
- }
+ "id": edited_template.id,
+ "name": edited_template.name,
+ "displaytest": edited_template.displaytext,
+ "account": edited_template.account,
+ "domainid": edited_template.domainid,
+ "format": edited_template.format,
+ "ostypeid": edited_template.ostypeid,
+ "templatetype": edited_template.templatetype,
+ }
edit_template_status = self.__verify_values(
- expected_dict,
- actual_dict
- )
+ expected_dict,
+ actual_dict
+ )
self.assertEqual(
- True,
- edit_template_status,
- "Edited Template details are not as expected"
- )
+ True,
+ edit_template_status,
+ "Edited Template details are not as expected"
+ )
# Editing the Template name, displaytext, ostypeid
edited_template = Template.update(
- template_created,
- self.userapiclient,
- name="NewTemplateName",
- displaytext="TemplateDisplaytext",
- ostypeid=template_created.ostypeid
- )
+ template_created,
+ self.userapiclient,
+ name="NewTemplateName",
+ displaytext="TemplateDisplaytext",
+ ostypeid=template_created.ostypeid
+ )
self.assertIsNotNone(
- edited_template,
- "Editing Template failed"
- )
- # Verifying the details of edited template
+ edited_template,
+ "Editing Template failed"
+ )
+ # Verifying the details of edited template
expected_dict = {
- "id":template_created.id,
- "name":"NewTemplateName",
- "displaytest":"TemplateDisplaytext",
- "account":template_created.account,
- "domainid":template_created.domainid,
- "format":template_created.format,
- "ostypeid":template_created.ostypeid,
- "templatetype":template_created.templatetype,
- }
+ "id": template_created.id,
+ "name": "NewTemplateName",
+ "displaytest": "TemplateDisplaytext",
+ "account": template_created.account,
+ "domainid": template_created.domainid,
+ "format": template_created.format,
+ "ostypeid": template_created.ostypeid,
+ "templatetype": template_created.templatetype,
+ }
actual_dict = {
- "id":edited_template.id,
- "name":edited_template.name,
- "displaytest":edited_template.displaytext,
- "account":edited_template.account,
- "domainid":edited_template.domainid,
- "format":edited_template.format,
- "ostypeid":edited_template.ostypeid,
- "templatetype":edited_template.templatetype,
- }
+ "id": edited_template.id,
+ "name": edited_template.name,
+ "displaytest": edited_template.displaytext,
+ "account": edited_template.account,
+ "domainid": edited_template.domainid,
+ "format": edited_template.format,
+ "ostypeid": edited_template.ostypeid,
+ "templatetype": edited_template.templatetype,
+ }
edit_template_status = self.__verify_values(
- expected_dict,
- actual_dict
- )
+ expected_dict,
+ actual_dict
+ )
self.assertEqual(
- True,
- edit_template_status,
- "Edited Template details are not as expected"
- )
- del self.services["templateregister"]["ostype"]
+ True,
+ edit_template_status,
+ "Edited Template details are not as expected"
+ )
+ del self.services["privatetemplate"]["ostype"]
return
@attr(tags=["advanced", "basic"], required_hardware="true")
@@ -719,120 +734,122 @@ class TestTemplates(cloudstackTestCase):
"""
# Listing Zones available for a user
zones_list = Zone.list(
- self.userapiclient,
- available=True
- )
+ self.userapiclient,
+ available=True
+ )
status = validateList(zones_list)
self.assertEquals(
- PASS,
- status[0],
- "Failed to list Zones"
- )
+ PASS,
+ status[0],
+ "Failed to list Zones"
+ )
if not len(zones_list) > 1:
raise unittest.SkipTest("Not enough zones exist to copy template")
else:
# Listing all the Templates for a User in Zone 1
list_templates_zone1 = Template.list(
- self.userapiclient,
- listall=self.services["listall"],
- templatefilter=self.services["templatefilter"],
- zoneid=zones_list[0].id
- )
+ self.userapiclient,
+ listall=self.services["listall"],
+ templatefilter=self.services["templatefilter"],
+ zoneid=zones_list[0].id
+ )
# Verifying that no Templates are listed
self.assertIsNone(
- list_templates_zone1,
- "Templates listed for newly created User in Zone1"
- )
+ list_templates_zone1,
+ "Templates listed for newly created User in Zone1"
+ )
# Listing all the Templates for a User in Zone 2
list_templates_zone2 = Template.list(
- self.userapiclient,
- listall=self.services["listall"],
- templatefilter=self.services["templatefilter"],
- zoneid=zones_list[1].id
- )
+ self.userapiclient,
+ listall=self.services["listall"],
+ templatefilter=self.services["templatefilter"],
+ zoneid=zones_list[1].id
+ )
# Verifying that no Templates are listed
self.assertIsNone(
- list_templates_zone2,
- "Templates listed for newly created User in Zone2"
- )
- self.services["templateregister"]["ostype"] = self.services["ostype"]
+ list_templates_zone2,
+ "Templates listed for newly created User in Zone2"
+ )
+ self.services["privatetemplate"][
+ "ostype"] = self.services["ostype"]
# Listing Hypervisors in Zone 1
hypervisor_list = Hypervisor.list(
- self.apiClient,
- zoneid=zones_list[0].id
- )
+ self.apiClient,
+ zoneid=zones_list[0].id
+ )
status = validateList(zones_list)
self.assertEquals(
- PASS,
- status[0],
- "Failed to list Hypervisors in Zone 1"
- )
+ PASS,
+ status[0],
+ "Failed to list Hypervisors in Zone 1"
+ )
# Creating aTemplate in Zone 1
template_created = Template.register(
- self.userapiclient,
- self.services["templateregister"],
- zones_list[0].id,
- hypervisor=hypervisor_list[0].name
- )
+ self.userapiclient,
+ self.services["privatetemplate"],
+ zones_list[0].id,
+ hypervisor=hypervisor_list[0].name
+ )
self.assertIsNotNone(
- template_created,
- "Template creation failed"
- )
- self.cleanup.append(template_created)
+ template_created,
+ "Template creation failed"
+ )
# Listing all the Templates for a User in Zone 1
list_templates_zone1 = Template.list(
- self.userapiclient,
- listall=self.services["listall"],
- templatefilter=self.services["templatefilter"],
- zoneid=zones_list[0].id
- )
+ self.userapiclient,
+ listall=self.services["listall"],
+ templatefilter=self.services["templatefilter"],
+ zoneid=zones_list[0].id
+ )
status = validateList(list_templates_zone1)
self.assertEquals(
- PASS,
- status[0],
- "Templates creation failed in Zone1"
- )
+ PASS,
+ status[0],
+ "Templates creation failed in Zone1"
+ )
# Verifying that list size is 1
self.assertEquals(
- 1,
- len(list_templates_zone1),
- "Failed to create a Template"
- )
+ 1,
+ len(list_templates_zone1),
+ "Failed to create a Template"
+ )
# Listing all the Templates for a User in Zone 2
list_templates_zone2 = Template.list(
- self.userapiclient,
- listall=self.services["listall"],
- templatefilter=self.services["templatefilter"],
- zoneid=zones_list[1].id
- )
+ self.userapiclient,
+ listall=self.services["listall"],
+ templatefilter=self.services["templatefilter"],
+ zoneid=zones_list[1].id
+ )
# Verifying that no Templates are listed
self.assertIsNone(
- list_templates_zone2,
- "Templates listed for newly created User in Zone2"
- )
- # Verifying the state of the template to be ready. If not waiting for state to become ready till time out
+ list_templates_zone2,
+ "Templates listed for newly created User in Zone2"
+ )
+ # Verifying the state of the template to be ready. If not waiting
+ # for state to become ready till time out
template_ready = False
count = 0
while template_ready is False:
list_template = Template.list(
- self.userapiclient,
- id=template_created.id,
- listall=self.services["listall"],
- templatefilter=self.services["templatefilter"],
- )
+ self.userapiclient,
+ id=template_created.id,
+ listall=self.services["listall"],
+ templatefilter=self.services["templatefilter"],
+ )
status = validateList(list_template)
self.assertEquals(
- PASS,
- status[0],
- "Failed to list Templates by Id"
- )
+ PASS,
+ status[0],
+ "Failed to list Templates by Id"
+ )
if list_template[0].isready is True:
template_ready = True
elif (str(list_template[0].status) == "Error"):
self.fail("Created Template is in Errored state")
break
elif count > 10:
- self.fail("Timed out before Template came into ready state")
+ self.fail(
+ "Timed out before Template came into ready state")
break
else:
time.sleep(self.services["sleep"])
@@ -840,61 +857,61 @@ class TestTemplates(cloudstackTestCase):
# Copying the Template from Zone1 to Zone2
copied_template = template_created.copy(
- self.userapiclient,
- sourcezoneid=template_created.zoneid,
- destzoneid=zones_list[1].id
- )
+ self.userapiclient,
+ sourcezoneid=template_created.zoneid,
+ destzoneid=zones_list[1].id
+ )
self.assertIsNotNone(
- copied_template,
- "Copying Template from Zone1 to Zone2 failed"
- )
+ copied_template,
+ "Copying Template from Zone1 to Zone2 failed"
+ )
# Listing all the Templates for a User in Zone 1
list_templates_zone1 = Template.list(
- self.userapiclient,
- listall=self.services["listall"],
- templatefilter=self.services["templatefilter"],
- zoneid=zones_list[0].id
- )
+ self.userapiclient,
+ listall=self.services["listall"],
+ templatefilter=self.services["templatefilter"],
+ zoneid=zones_list[0].id
+ )
status = validateList(list_templates_zone1)
self.assertEquals(
- PASS,
- status[0],
- "Templates creation failed in Zone1"
- )
+ PASS,
+ status[0],
+ "Templates creation failed in Zone1"
+ )
# Verifying that list size is 1
self.assertEquals(
- 1,
- len(list_templates_zone1),
- "Failed to create a Template"
- )
+ 1,
+ len(list_templates_zone1),
+ "Failed to create a Template"
+ )
# Listing all the Templates for a User in Zone 2
list_templates_zone2 = Template.list(
- self.userapiclient,
- listall=self.services["listall"],
- templatefilter=self.services["templatefilter"],
- zoneid=zones_list[1].id
- )
+ self.userapiclient,
+ listall=self.services["listall"],
+ templatefilter=self.services["templatefilter"],
+ zoneid=zones_list[1].id
+ )
status = validateList(list_templates_zone2)
self.assertEquals(
- PASS,
- status[0],
- "Template failed to copy into Zone2"
- )
+ PASS,
+ status[0],
+ "Template failed to copy into Zone2"
+ )
# Verifying that list size is 1
self.assertEquals(
- 1,
- len(list_templates_zone2),
- "Template failed to copy into Zone2"
- )
+ 1,
+ len(list_templates_zone2),
+ "Template failed to copy into Zone2"
+ )
self.assertNotEquals(
- "Connection refused",
- list_templates_zone2[0].status,
- "Failed to copy Template"
- )
+ "Connection refused",
+ list_templates_zone2[0].status,
+ "Failed to copy Template"
+ )
self.assertEquals(
- True,
- list_templates_zone2[0].isready,
- "Failed to copy Template"
- )
- del self.services["templateregister"]["ostype"]
+ True,
+ list_templates_zone2[0].isready,
+ "Failed to copy Template"
+ )
+ del self.services["privatetemplate"]["ostype"]
return
[11/12] git commit: updated refs/heads/4.5 to 30598e9
Posted by bh...@apache.org.
CLOUDSTACK-7976 : Param validation for global params involving domain name
(cherry picked from commit 95ea20390739a24dad92895b8db712282be31bbb)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Conflicts:
server/src/com/cloud/configuration/ConfigurationManagerImpl.java
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/57f5d51a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/57f5d51a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/57f5d51a
Branch: refs/heads/4.5
Commit: 57f5d51a11e3b147432f88bcd2ba144bb9e6cdf7
Parents: 3cb4358
Author: amoghvk <am...@citrix.com>
Authored: Wed Nov 26 14:54:42 2014 -0800
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Jan 20 10:36:11 2015 +0530
----------------------------------------------------------------------
.../com/cloud/configuration/ConfigurationManagerImpl.java | 10 ++++++++++
1 file changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57f5d51a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index cf94b95..d9ce3fd 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -327,6 +327,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
private int _maxVolumeSizeInGb = Integer.parseInt(Config.MaxVolumeSize.getDefaultValue());
private long _defaultPageSize = Long.parseLong(Config.DefaultPageSize.getDefaultValue());
+ private static final String DOMAIN_NAME_PATTERN = "^((?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{1,63}$";
protected Set<String> configValuesForValidation;
private Set<String> weightBasedParametersForValidation;
private Set<String> overprovisioningFactorsForValidation;
@@ -843,6 +844,15 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
if (!NetUtils.verifyInstanceName(value)) {
return "Instance name can not contain hyphen, space or plus sign";
}
+ } else if (range.equalsIgnoreCase("domainName")) {
+ String domainName = value;
+ if (value.startsWith("*")) {
+ domainName = value.substring(2); //skip the "*."
+ }
+ //max length for FQDN is 253 + 2, code adds xxx-xxx-xxx-xxx to domain name when creating URL
+ if (domainName.length() >= 238 || !domainName.matches(DOMAIN_NAME_PATTERN)) {
+ return "Please enter a valid string for domain name, prefixed with '*.' if applicable";
+ }
} else if (range.equals("routes")) {
String[] routes = value.split(",");
for (String route : routes) {
[07/12] git commit: updated refs/heads/4.5 to 30598e9
Posted by bh...@apache.org.
CLOUDSTACK-8054: No event generated on host maintenance mode is completed
Added events for host maintenance start and completion
(cherry picked from commit f6854bc9844ce94815b99032d508bda43ac1a0c1)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/37cdb4ec
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/37cdb4ec
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/37cdb4ec
Branch: refs/heads/4.5
Commit: 37cdb4eccacca005bc8a301921da96bec2f0838d
Parents: cc31571
Author: Koushik Das <ko...@apache.org>
Authored: Wed Dec 10 10:18:34 2014 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Jan 20 10:23:37 2015 +0530
----------------------------------------------------------------------
server/src/com/cloud/resource/ResourceManagerImpl.java | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/37cdb4ec/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
index 77f6041..5a1b8ce 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -31,6 +31,7 @@ import javax.inject.Inject;
import javax.naming.ConfigurationException;
import com.cloud.vm.VirtualMachine;
+
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd;
@@ -93,7 +94,9 @@ import com.cloud.dc.dao.HostPodDao;
import com.cloud.deploy.PlannerHostReservationVO;
import com.cloud.deploy.dao.PlannerHostReservationDao;
import com.cloud.event.ActionEvent;
+import com.cloud.event.ActionEventUtils;
import com.cloud.event.EventTypes;
+import com.cloud.event.EventVO;
import com.cloud.exception.AgentUnavailableException;
import com.cloud.exception.DiscoveryException;
import com.cloud.exception.InvalidParameterValueException;
@@ -1188,6 +1191,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
throw new CloudRuntimeException(err + e.getMessage());
}
+ ActionEventUtils.onStartedActionEvent(CallContext.current().getCallingUserId(), CallContext.current().getCallingAccountId(), EventTypes.EVENT_MAINTENANCE_PREPARE, "starting maintenance for host " + hostId, true, 0);
_agentMgr.pullAgentToMaintenance(hostId);
/* TODO: move below to listener */
@@ -1270,6 +1274,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
if (vos.isEmpty() && vosMigrating.isEmpty()) {
resourceStateTransitTo(host, ResourceState.Event.InternalEnterMaintenance, _nodeId);
hostInMaintenance = true;
+ ActionEventUtils.onCompletedActionEvent(CallContext.current().getCallingUserId(), CallContext.current().getCallingAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_MAINTENANCE_PREPARE, "completed maintenance for host " + hostId, 0);
}
}
} catch (NoTransitionException e) {
[09/12] git commit: updated refs/heads/4.5 to 30598e9
Posted by bh...@apache.org.
CLOUDSTACK-7996: Fixed the script test_tags.py - Tags and Template should belong to the User Account to test the case
(cherry picked from commit b0d74ad6fc68fd7022ec6cf378736430f0908a75)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1b7a1006
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1b7a1006
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1b7a1006
Branch: refs/heads/4.5
Commit: 1b7a10068877c7bcd997029c5ef3ba8884d49f18
Parents: 535c037
Author: Chandan Purushothama <Ch...@citrix.com>
Authored: Mon Dec 1 14:33:29 2014 -0800
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Jan 20 10:29:41 2015 +0530
----------------------------------------------------------------------
test/integration/component/test_tags.py | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1b7a1006/test/integration/component/test_tags.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_tags.py b/test/integration/component/test_tags.py
index 824cf01..2b05fbb 100644
--- a/test/integration/component/test_tags.py
+++ b/test/integration/component/test_tags.py
@@ -212,6 +212,12 @@ class TestResourceTags(cloudstackTestCase):
cls.services["account"],
admin=True,
)
+
+ cls.user_api_client = cls.testClient.getUserApiClient(
+ UserName=cls.account.name,
+ DomainName=cls.account.domain
+ )
+
# Create service offerings, disk offerings etc
cls.service_offering = ServiceOffering.create(
cls.api_client,
@@ -943,14 +949,14 @@ class TestResourceTags(cloudstackTestCase):
try:
self.debug("Stopping the virtual machine: %s" % self.vm_1.name)
#Stop virtual machine
- self.vm_1.stop(self.apiclient)
+ self.vm_1.stop(self.user_api_client)
except Exception as e:
self.fail("Failed to stop VM: %s" % e)
timeout = self.services["timeout"]
while True:
list_volume = Volume.list(
- self.apiclient,
+ self.user_api_client,
virtualmachineid=self.vm_1.id,
type='ROOT',
listall=True
@@ -969,18 +975,18 @@ class TestResourceTags(cloudstackTestCase):
self.vm_1.name)
#Create template from volume
template = Template.create(
- self.apiclient,
+ self.user_api_client,
self.services["template"],
self.volume.id
)
self.cleanup.append(template)
self.debug("Created the template(%s). Now restarting the userVm: %s" %
(template.name, self.vm_1.name))
- self.vm_1.start(self.apiclient)
+ self.vm_1.start(self.user_api_client)
self.debug("Creating a tag for the template")
tag = Tag.create(
- self.apiclient,
+ self.user_api_client,
resourceIds=template.id,
resourceType='Template',
tags={'OS': 'CentOS'}
@@ -988,11 +994,9 @@ class TestResourceTags(cloudstackTestCase):
self.debug("Tag created: %s" % tag.__dict__)
tags = Tag.list(
- self.apiclient,
+ self.user_api_client,
listall=True,
resourceType='Template',
- account=self.account.name,
- domainid=self.account.domainid,
key='OS',
value='CentOS'
)
@@ -1008,7 +1012,7 @@ class TestResourceTags(cloudstackTestCase):
)
Template.list(
- self.apiclient,
+ self.user_api_client,
templatefilter=\
self.services["template"]["templatefilter"],
listall=True,
@@ -1019,7 +1023,7 @@ class TestResourceTags(cloudstackTestCase):
self.debug("Deleting the created tag..")
try:
tag.delete(
- self.apiclient,
+ self.user_api_client,
resourceIds=template.id,
resourceType='Template',
tags={'OS': 'CentOS'}
@@ -1029,11 +1033,9 @@ class TestResourceTags(cloudstackTestCase):
self.debug("Verifying if tag is actually deleted!")
tags = Tag.list(
- self.apiclient,
+ self.user_api_client,
listall=True,
resourceType='Template',
- account=self.account.name,
- domainid=self.account.domainid,
key='OS',
value='CentOS'
)
[08/12] git commit: updated refs/heads/4.5 to 30598e9
Posted by bh...@apache.org.
CLOUDSTACK-8007: Fixed the script 'test_vm_passwdenabled.py' - Template created by Admin should have public access to be used for regular User VM Deployment
(cherry picked from commit 41b871b6bdfd48f673e1fdc011069dd3c7ca032b)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Conflicts:
test/integration/component/test_vm_passwdenabled.py
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/535c0374
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/535c0374
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/535c0374
Branch: refs/heads/4.5
Commit: 535c037428b038d0d4b5e80e4c4a0e1c5d24d6b7
Parents: 37cdb4e
Author: Chandan Purushothama <Ch...@citrix.com>
Authored: Tue Dec 2 14:37:11 2014 -0800
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Jan 20 10:28:57 2015 +0530
----------------------------------------------------------------------
test/integration/component/test_vm_passwdenabled.py | 2 --
1 file changed, 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/535c0374/test/integration/component/test_vm_passwdenabled.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vm_passwdenabled.py b/test/integration/component/test_vm_passwdenabled.py
index 64e549b..77d3013 100644
--- a/test/integration/component/test_vm_passwdenabled.py
+++ b/test/integration/component/test_vm_passwdenabled.py
@@ -221,8 +221,6 @@ class TestVMPasswordEnabled(cloudstackTestCase):
cls.api_client,
cls.services["template"],
cls.volume.id,
- account=cls.account.name,
- domainid=cls.account.domainid
)
# Delete the VM - No longer needed
cls.virtual_machine.delete(cls.api_client, expunge=True)
[06/12] git commit: updated refs/heads/4.5 to 30598e9
Posted by bh...@apache.org.
bug-id:CLOUDSTACK-8055cleaned up test tags, removed unecessary tags.
reviewed-by: SrikanteswaraRao Talluri <ta...@apache.org>
Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>
(cherry picked from commit b6bac7f67335454b6146ebf56b1c6a47842107c1)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cc315713
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cc315713
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cc315713
Branch: refs/heads/4.5
Commit: cc3157130759909487aad17e6467b309cdebf132
Parents: e6620b1
Author: SrikanteswaraRao Talluri <ta...@apache.org>
Authored: Wed Dec 17 18:50:39 2014 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Jan 20 10:23:15 2015 +0530
----------------------------------------------------------------------
test/integration/component/test_portable_ip.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc315713/test/integration/component/test_portable_ip.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_portable_ip.py b/test/integration/component/test_portable_ip.py
index 83ef6b5..32e7b75 100644
--- a/test/integration/component/test_portable_ip.py
+++ b/test/integration/component/test_portable_ip.py
@@ -407,7 +407,7 @@ class TestListPortablePublicIpRanges(cloudstackTestCase):
"Listed netmask not matching with the netmask of created public ip range")
return
- @attr(tags=["advanced","swamy"], required_hardware="false")
+ @attr(tags=["advanced"], required_hardware="false")
def test_list_portable_ip_range_non_root_admin(self):
"""Test list portable ip ranges with non admin root account
"""
@@ -1288,7 +1288,7 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e)
return
- @attr(tags=["advanced","swamy"], required_hardware="true")
+ @attr(tags=["advanced"], required_hardware="true")
def test_list_portable_ip_range_non_root_admin(self):
"""Test list portable ip ranges with non admin root account
"""
[04/12] git commit: updated refs/heads/4.5 to 30598e9
Posted by bh...@apache.org.
CLOUDSTACK-8115: Update default ordering of HA investigators
Moved HV specific investigators before PingInvestigator in default ordering
(cherry picked from commit ceae97868cb98b503324afb7743a25ce1f5c1516)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/899bb8b2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/899bb8b2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/899bb8b2
Branch: refs/heads/4.5
Commit: 899bb8b2e92598228a1432760b02e6dfd5a4c8f0
Parents: 345fd54
Author: Koushik Das <ko...@apache.org>
Authored: Tue Dec 23 16:12:39 2014 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Jan 20 10:19:05 2015 +0530
----------------------------------------------------------------------
.../META-INF/cloudstack/core/spring-core-registry-core-context.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/899bb8b2/core/resources/META-INF/cloudstack/core/spring-core-registry-core-context.xml
----------------------------------------------------------------------
diff --git a/core/resources/META-INF/cloudstack/core/spring-core-registry-core-context.xml b/core/resources/META-INF/cloudstack/core/spring-core-registry-core-context.xml
index 3263e92..939cffe 100644
--- a/core/resources/META-INF/cloudstack/core/spring-core-registry-core-context.xml
+++ b/core/resources/META-INF/cloudstack/core/spring-core-registry-core-context.xml
@@ -68,7 +68,7 @@
class="org.apache.cloudstack.spring.lifecycle.registry.ExtensionRegistry">
<property name="orderConfigKey" value="ha.investigators.order" />
<property name="orderConfigDefault"
- value="SimpleInvestigator,XenServerInvestigator,PingInvestigator,ManagementIPSysVMInvestigator,KVMInvestigator" />
+ value="SimpleInvestigator,XenServerInvestigator,KVMInvestigator,HypervInvestigator,VMwareInvestigator,PingInvestigator,ManagementIPSysVMInvestigator" />
<property name="excludeKey" value="ha.investigators.exclude" />
</bean>