cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
s022_add_storage_disk.py
Go to the documentation of this file.
1 # -*- coding: utf-8 -*-
2 # @COPYRIGHT_begin
3 #
4 # Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 # @COPYRIGHT_end
19 
20 from predefined.actions import *
21 from predefined.users import *
22 from predefined.macros import *
23 
24 actions = []
25 actions.append(list_clusters)
26 actions.append(list_filesystems)
27 
28 actions.append({'u': u_new,
29  'fname': 'image.user.create',
30  'args': [{'name': 'Test Storage1',
31  'description': '10MB Test Storage',
32  'access': 0,
33  'filesystem': MACRO_GET_FILESYSTEM_ID("ntfs"),
34  'type': 1,
35  'size': 10
36  }]})
37 
38 actions.append({'u': u_new,
39  'fname': 'image.user.create',
40  'args': [{'name': 'Test Storage2',
41  'description': '10MB Test Storage',
42  'access': 0,
43  'filesystem': MACRO_GET_FILESYSTEM_ID("ext4"),
44  'type': 1,
45  'size': 10
46  }]})
47 
48 # Add two images for second user
49 actions.append({'u': test_users[1],
50  'fname': 'image.user.create',
51  'args': [{'name': 'ForeignStorage1',
52  'description': '10MB Test Storage',
53  'access': 0,
54  'filesystem': MACRO_GET_FILESYSTEM_ID("ext4"),
55  'type': 1,
56  'size': 10
57  }]})
58 actions.append({'u': test_users[1],
59  'fname': 'image.user.create',
60  'args': [{'name': 'ForeignStorage2',
61  'description': '10MB Test Storage',
62  'access': 0,
63  'filesystem': MACRO_GET_FILESYSTEM_ID("ext4"),
64  'type': 1,
65  'size': 10
66  }]})
67 
68 # Add as public storage
69 actions.append({'u': u_new,
70  'fname': 'image.user.create',
71  'args': [{'name': 'PublicStorage',
72  'description': '10MB Test Storage',
73  'access': 1,
74  'filesystem': MACRO_GET_FILESYSTEM_ID("ext4"),
75  'type': 1,
76  'size': 10
77  }],
78  })
79 
80 
81 # Add 1TB storage (over quota)
82 actions.append({'u': u_new,
83  'fname': 'image.user.create',
84  'args': [{'name': 'Test Storage',
85  'description': '10MB Test Storage',
86  'access': 0,
87  'filesystem': 5,
88  'type': 1,
89  'size': 1000000
90  }],
91  'estatus': 'user_storage_limit'})
92 
93 
94 # Add with unsupported filesystem
95 actions.append({'u': u_new,
96  'fname': 'image.user.create',
97  'args': [{'name': 'Test Storage',
98  'description': '10MB Test Storage',
99  'access': 0,
100  'filesystem': 99999,
101  'type': 1,
102  'size': 10
103  }],
104  'estatus': 'image_unsupported_filesystem',})
105 
106 # Add strange type
107 actions.append({'u': u_new,
108  'fname': 'image.user.create',
109  'args': [{'name': 'Test Storage',
110  'description': '10MB Test Storage',
111  'access': 0,
112  'filesystem': 5,
113  'type': 99999,
114  'size': 10,
115  }],
116  'estatus': 'image_unsupported',})
117 
118 # Add strange access
119 actions.append({'u': u_new,
120  'fname': 'image.user.create',
121  'args': [{'name': 'Test Storage',
122  'description': '10MB Test Storage',
123  'access': 99999,
124  'filesystem': 5,
125  'type': 1,
126  'size': 10
127  }],
128  'estatus': 'unsupported_access',})
129 
130 # Add less than zero size
131 actions.append({'u': u_new,
132  'fname': 'image.user.create',
133  'args': [{'name': 'Test Storage',
134  'description': '10MB Test Storage',
135  'access': 0,
136  'filesystem': 5,
137  'type': 1,
138  'size': -10
139  }],
140  'estatus': 'wrong_size'})
141