Skip to content

Commit 2fb346a

Browse files
committed
Merge branch 'master' into javelin
2 parents a4c778e + 7d40a7e commit 2fb346a

12 files changed

Lines changed: 347 additions & 211 deletions

File tree

console-proxy/pom.xml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
<artifactId>cloudstack</artifactId>
2626
<version>4.1.0-SNAPSHOT</version>
2727
</parent>
28+
<properties>
29+
<mkisofs>mkisofs</mkisofs>
30+
</properties>
2831
<dependencies>
2932
<dependency>
3033
<groupId>log4j</groupId>
@@ -167,6 +170,19 @@
167170
</plugins>
168171
</build>
169172
<profiles>
173+
<!-- Debian will never distribute mkisofs due to licensing issues.
174+
Fortunately genisoimage is a work-alike -->
175+
<profile>
176+
<id>genisoimage</id>
177+
<activation>
178+
<file>
179+
<exists>/usr/bin/genisoimage</exists>
180+
</file>
181+
</activation>
182+
<properties>
183+
<mkisofs>genisoimage</mkisofs>
184+
</properties>
185+
</profile>
170186
<profile>
171187
<id>vmware</id>
172188
<activation>
@@ -209,7 +225,7 @@
209225
</execution>
210226
</executions>
211227
<configuration>
212-
<executable>mkisofs</executable>
228+
<executable>${mkisofs}</executable>
213229
<workingDirectory>dist</workingDirectory>
214230
<arguments>
215231
<argument>-quiet</argument>

docs/en-US/offerings.xml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
<?xml version='1.0' encoding='utf-8' ?>
2-
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
2+
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
33
<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
44
%BOOK_ENTITIES;
55
]>
6-
76
<!-- Licensed to the Apache Software Foundation (ASF) under one
8-
or more contributor license agreements. See the NOTICE file
9-
distributed with this work for additional information
10-
regarding copyright ownership. The ASF licenses this file
11-
to you under the Apache License, Version 2.0 (the
12-
"License"); you may not use this file except in compliance
13-
with the License. You may obtain a copy of the License at
14-
15-
http://www.apache.org/licenses/LICENSE-2.0
16-
17-
Unless required by applicable law or agreed to in writing,
18-
software distributed under the License is distributed on an
19-
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20-
KIND, either express or implied. See the License for the
21-
specific language governing permissions and limitations
22-
under the License.
7+
or more contributor license agreements. See the NOTICE file
8+
distributed with this work for additional information
9+
regarding copyright ownership. The ASF licenses this file
10+
to you under the Apache License, Version 2.0 (the
11+
"License"); you may not use this file except in compliance
12+
with the License. You may obtain a copy of the License at
13+
http://www.apache.org/licenses/LICENSE-2.0
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
2320
-->
2421

2522
<chapter id="offerings">
@@ -28,4 +25,5 @@
2825
are discussed in the section on setting up networking for users.</para>
2926
<xi:include href="compute-disk-service-offerings.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
3027
<xi:include href="system-service-offerings.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
28+
<xi:include href="sys-offering-sysvm.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
3129
</chapter>

docs/en-US/sys-offering-sysvm.xml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?xml version='1.0' encoding='utf-8' ?>
2+
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
3+
<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
4+
%BOOK_ENTITIES;
5+
]>
6+
<!-- Licensed to the Apache Software Foundation (ASF) under one
7+
or more contributor license agreements. See the NOTICE file
8+
distributed with this work for additional information
9+
regarding copyright ownership. The ASF licenses this file
10+
to you under the Apache License, Version 2.0 (the
11+
"License"); you may not use this file except in compliance
12+
with the License. You may obtain a copy of the License at
13+
http://www.apache.org/licenses/LICENSE-2.0
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
-->
21+
<section id="sys-offering-sysvm">
22+
<title>Changing the Default System Offering for System VMs</title>
23+
<para>You can manually change the system offering for a particular System VM. Additionally, as a
24+
&PRODUCT; administrator, you can also change the default system offering used for System
25+
VMs.</para>
26+
<orderedlist>
27+
<listitem>
28+
<para>Create a new system offering.</para>
29+
<para>For more information, see <phrase condition="install"><xref
30+
linkend="creating-system-service-offerings"/></phrase>
31+
<phrase condition="admin">Creating a New System Service Offering</phrase>. </para>
32+
</listitem>
33+
<listitem>
34+
<para>Back up the database:</para>
35+
<programlisting>mysqldump -u root -p cloud | bzip2 > cloud_backup.sql.bz2</programlisting>
36+
</listitem>
37+
<listitem>
38+
<para>Open an MySQL prompt:</para>
39+
<programlisting>mysql -u cloud -p cloud</programlisting>
40+
</listitem>
41+
<listitem>
42+
<para>Run the following queries on the cloud database.</para>
43+
<orderedlist numeration="loweralpha">
44+
<listitem>
45+
<para>In the disk_offering table, identify the original default offering and the new
46+
offering you want to use by default. </para>
47+
<para>Take a note of the ID of the new offering.</para>
48+
<programlisting>select id,name,unique_name,type from disk_offering;</programlisting>
49+
</listitem>
50+
<listitem>
51+
<para>For the original default offering, set the value of unique_name to NULL.</para>
52+
<programlisting># update disk_offering set unique_name = NULL where id = 10;</programlisting>
53+
<para>Ensure that you use the correct value for the ID.</para>
54+
</listitem>
55+
<listitem>
56+
<para>For the new offering that you want to use by default, set the value of unique_name
57+
as follows:</para>
58+
<para>For the default Console Proxy VM (CPVM) offering,set unique_name to
59+
'Cloud.com-ConsoleProxy'. For the default Secondary Storage VM (SSVM) offering, set
60+
unique_name to 'Cloud.com-SecondaryStorage'. For example:</para>
61+
<programlisting>update disk_offering set unique_name = 'Cloud.com-ConsoleProxy' where id = 16;</programlisting>
62+
</listitem>
63+
</orderedlist>
64+
</listitem>
65+
<listitem>
66+
<para>Restart &PRODUCT; Management Server. Restarting is required because the default
67+
offerings are loaded into the memory at startup.</para>
68+
<programlisting>service cloud-management restart</programlisting>
69+
</listitem>
70+
<listitem>
71+
<para>Destroy the existing CPVM or SSVM offerings and wait for them to be recreated. The new
72+
CPVM or SSVM are configured with the new offering. </para>
73+
</listitem>
74+
</orderedlist>
75+
</section>

setup/db/create-schema.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,6 +1371,7 @@ CREATE TABLE `cloud`.`alert` (
13711371
`last_sent` DATETIME NULL COMMENT 'Last time the alert was sent',
13721372
`resolved` DATETIME NULL COMMENT 'when the alert status was resolved (available memory no longer at critical level, etc.)',
13731373
PRIMARY KEY (`id`),
1374+
INDEX `last_sent` (`last_sent` DESC),
13741375
CONSTRAINT `uc_alert__uuid` UNIQUE (`uuid`)
13751376
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
13761377

setup/db/db/schema-40to410.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ ALTER TABLE `cloud`.`inline_load_balancer_nic_map` DROP COLUMN load_balancer_id;
7777
ALTER TABLE upload ADD uuid VARCHAR(40);
7878
ALTER TABLE async_job modify job_cmd VARCHAR(255);
7979

80+
ALTER TABLE `cloud`.`alert` ADD INDEX `last_sent` (`last_sent` DESC) ;
81+
8082
-- populate uuid column with db id if uuid is null
8183
UPDATE `cloud`.`account` set uuid=id WHERE uuid is NULL;
8284
UPDATE `cloud`.`alert` set uuid=id WHERE uuid is NULL;

tools/cli/cloudmonkey/cachegen.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
# under the License.
1717

1818
try:
19-
from common import grammar
19+
import re
2020
from marvin.cloudstackAPI import *
2121
from marvin import cloudstackAPI
2222
except ImportError, e:
23-
pass
23+
import sys
24+
print "ImportError", e
25+
sys.exit(1)
2426

2527
completions = cloudstackAPI.__all__
2628

@@ -43,9 +45,12 @@ def main():
4345
completing commands and help docs. This reduces the overall search and
4446
cache_miss (computation) complexity from O(n) to O(1) for any valid cmd.
4547
"""
48+
pattern = re.compile("[A-Z]")
49+
verbs = list(set([x[:pattern.search(x).start()] for x in completions
50+
if pattern.search(x) is not None]).difference(['cloudstack']))
4651
# datastructure {'verb': {cmd': ['api', [params], doc, required=[]]}}
4752
cache_verbs = {}
48-
for verb in grammar:
53+
for verb in verbs:
4954
completions_found = filter(lambda x: x.startswith(verb), completions)
5055
cache_verbs[verb] = {}
5156
for api_name in completions_found:

tools/cli/cloudmonkey/cloudmonkey.py

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import logging
2727
import os
2828
import pdb
29+
import re
2930
import shlex
3031
import sys
3132
import time
@@ -38,7 +39,7 @@
3839

3940
from prettytable import PrettyTable
4041
from common import __version__, config_file, config_fields
41-
from common import grammar, precached_verbs
42+
from common import precached_verbs
4243
from marvin.cloudstackConnection import cloudConnection
4344
from marvin.cloudstackException import cloudstackAPIException
4445
from marvin.cloudstackAPI import *
@@ -71,12 +72,12 @@ class CloudMonkeyShell(cmd.Cmd, object):
7172
ruler = "="
7273
config_file = config_file
7374
config_fields = config_fields
74-
grammar = grammar
7575
# datastructure {'verb': {cmd': ['api', [params], doc, required=[]]}}
7676
cache_verbs = precached_verbs
7777

78-
def __init__(self, pname):
78+
def __init__(self, pname, verbs):
7979
self.program_name = pname
80+
self.verbs = verbs
8081
if os.path.exists(self.config_file):
8182
config = self.read_config()
8283
else:
@@ -102,11 +103,9 @@ def __init__(self, pname):
102103
logger.debug("Loaded config fields:\n%s" % self.config_fields)
103104

104105
cmd.Cmd.__init__(self)
105-
# Update config if config_file does not exist
106106
if not os.path.exists(self.config_file):
107107
config = self.write_config()
108108

109-
# Enable history support
110109
try:
111110
if os.path.exists(self.history_file):
112111
readline.read_history_file(self.history_file)
@@ -381,13 +380,13 @@ def default(self, args):
381380

382381
def completedefault(self, text, line, begidx, endidx):
383382
partitions = line.partition(" ")
384-
verb = partitions[0]
385-
rline = partitions[2].partition(" ")
383+
verb = partitions[0].strip()
384+
rline = partitions[2].lstrip().partition(" ")
386385
subject = rline[0]
387386
separator = rline[1]
388-
params = rline[2]
387+
params = rline[2].lstrip()
389388

390-
if verb not in self.grammar:
389+
if verb not in self.verbs:
391390
return []
392391

393392
autocompletions = []
@@ -436,7 +435,7 @@ def do_set(self, args):
436435
args = args.strip().partition(" ")
437436
key, value = (args[0], args[2])
438437
setattr(self, key, value) # keys and attributes should have same names
439-
self.prompt = self.prompt.strip() + " " # prompt fix
438+
self.prompt = self.prompt.strip() + " " # prompt fix
440439
self.write_config()
441440

442441
def complete_set(self, text, line, begidx, endidx):
@@ -513,35 +512,35 @@ def do_EOF(self, args):
513512

514513

515514
def main():
516-
# Create handlers on the fly using closures
517-
self = CloudMonkeyShell
518-
global grammar
519-
for rule in grammar:
520-
def add_grammar(rule):
515+
pattern = re.compile("[A-Z]")
516+
verbs = list(set([x[:pattern.search(x).start()] for x in completions
517+
if pattern.search(x) is not None]).difference(['cloudstack']))
518+
for verb in verbs:
519+
def add_grammar(verb):
521520
def grammar_closure(self, args):
522-
if self.pipe_runner("%s %s" % (rule, args)):
521+
if self.pipe_runner("%s %s" % (verb, args)):
523522
return
524523
try:
525524
args_partition = args.partition(" ")
526-
res = self.cache_verbs[rule][args_partition[0]]
525+
res = self.cache_verbs[verb][args_partition[0]]
527526
cmd = res[0]
528527
helpdoc = res[2]
529528
args = args_partition[2]
530529
except KeyError, e:
531-
self.print_shell("Error: invalid %s api arg" % rule, e)
530+
self.print_shell("Error: invalid %s api arg" % verb, e)
532531
return
533532
if ' --help' in args or ' -h' in args:
534533
self.print_shell(helpdoc)
535534
return
536535
self.default("%s %s" % (cmd, args))
537536
return grammar_closure
538537

539-
grammar_handler = add_grammar(rule)
540-
grammar_handler.__doc__ = "%ss resources" % rule.capitalize()
541-
grammar_handler.__name__ = 'do_' + rule
542-
setattr(self, grammar_handler.__name__, grammar_handler)
538+
grammar_handler = add_grammar(verb)
539+
grammar_handler.__doc__ = "%ss resources" % verb.capitalize()
540+
grammar_handler.__name__ = 'do_' + verb
541+
setattr(CloudMonkeyShell, grammar_handler.__name__, grammar_handler)
543542

544-
shell = CloudMonkeyShell(sys.argv[0])
543+
shell = CloudMonkeyShell(sys.argv[0], verbs)
545544
if len(sys.argv) > 1:
546545
shell.onecmd(' '.join(sys.argv[1:]))
547546
else:

tools/cli/cloudmonkey/common.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,3 @@
3939
'history_file':
4040
os.path.expanduser('~/.cloudmonkey_history')}
4141

42-
# Add verbs in grammar
43-
grammar = ['create', 'list', 'delete', 'update', 'lock',
44-
'enable', 'activate', 'disable', 'add', 'remove',
45-
'attach', 'detach', 'associate', 'disassociate', 'generate', 'ldap',
46-
'assign', 'authorize', 'change', 'register', 'configure',
47-
'start', 'restart', 'reboot', 'stop', 'reconnect',
48-
'cancel', 'destroy', 'revoke', 'mark', 'reset',
49-
'copy', 'extract', 'migrate', 'restore', 'suspend',
50-
'get', 'query', 'prepare', 'deploy', 'upload']

ui/scripts/accounts.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,12 +642,16 @@
642642
},
643643
vmLimit: {
644644
label: 'label.instance.limits',
645-
isEditable: function(context) {
645+
isEditable: function(context) {
646+
647+
if(context.accounts == undefined)
648+
return false;
649+
else {
646650
if (context.accounts[0].accounttype == roleTypeUser || context.accounts[0].accounttype == roleTypeDomainAdmin) //updateResourceLimits is only allowed on account whose type is user or domain-admin
647651
return true;
648652
else
649653
return false;
650-
}
654+
} }
651655
},
652656
ipLimit: {
653657
label: 'label.ip.limits',

ui/scripts/system.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,13 @@
13221322
networkOfferingObjs = json.listnetworkofferingsresponse.networkoffering;
13231323
if (networkOfferingObjs != null && networkOfferingObjs.length > 0) {
13241324
for (var i = 0; i < networkOfferingObjs.length; i++) {
1325+
1326+
if(args.scope=="account-specific" && args.context.zones[0].securitygroupsenabled == true) { //BUG - CLOUDSTACK-1063
1327+
var serviceObjArray = networkOfferingObjs[i].name;
1328+
if(serviceObjArray == "DefaultSharedNetworkOfferingWithSGService"){
1329+
continue;
1330+
}
1331+
}
13251332

13261333
//comment out the following 12 lines because of CS-16718
13271334
/*

0 commit comments

Comments
 (0)