|
29 | 29 |
|
30 | 30 | try: |
31 | 31 | if normalRepo: |
32 | | - print "normal repo" |
| 32 | + print("normal repo") |
33 | 33 | # this literally throws EVERYTHING away on the repo |
34 | 34 | repoDom = parseString(server.discover_repository_db()) |
35 | 35 | for node in repoDom.getElementsByTagName('Repository'): |
|
43 | 43 | # in which repo it lives.... |
44 | 44 | for dirname, dirnames, filenames in os.walk('%s/VirtualMachines/' % localMount): |
45 | 45 | for vm in dirnames: |
46 | | - print "Destroying vm: %s on repo %s" % (vm, repoUuid.value) |
| 46 | + print("Destroying vm: %s on repo %s" % (vm, repoUuid.value)) |
47 | 47 | try: |
48 | 48 | mVm = server.list_vm(repoUuid.value, vm) |
49 | | - if mVm != None: |
50 | | - print server.stop_vm(repoUuid.value, vm) |
51 | | - print server.delete_vm(repoUuid.value, vm) |
| 49 | + if mVm is not None: |
| 50 | + print(server.stop_vm(repoUuid.value, vm)) |
| 51 | + print(server.delete_vm(repoUuid.value, vm)) |
52 | 52 | else: |
53 | | - print "%s already not in repo %s" % (repoUuid.value, vm) |
54 | | - except Error, v: |
55 | | - print "Unable to destroy: %s" % (v) |
| 53 | + print("%s already not in repo %s" % (repoUuid.value, vm)) |
| 54 | + except Error as v: |
| 55 | + print("Unable to destroy: %s" % v) |
56 | 56 | continue |
57 | 57 |
|
58 | 58 | # VMs = server.list_vms() |
|
63 | 63 |
|
64 | 64 | rc = server.delete_repository(repoUuid.value, True) |
65 | 65 | # Set to false if you want to keep data: ^^^^ |
66 | | - print "Repository: %s" % repoUuid.value |
67 | | - if (rc == None): |
68 | | - print "Ok repo: %s destroyed!" % repoUuid.value |
| 66 | + print("Repository: %s" % repoUuid.value) |
| 67 | + if rc is None: |
| 68 | + print("Ok repo: %s destroyed!" % repoUuid.value) |
69 | 69 | # now unmount the FS |
70 | 70 | # print server.unmount_repository_fs(localMount) |
71 | 71 | else: |
72 | | - print "Failed repo: %s not destroyed!" % repoUuid.value |
| 72 | + print("Failed repo: %s not destroyed!" % repoUuid.value) |
73 | 73 |
|
74 | | - # for now only treat NFS stuff as we're testing with that.. |
| 74 | + # for now only treat NFS stuff as we're testing with that. |
75 | 75 | nfsHost = 'cs-mgmt' |
76 | 76 | nfsDom = server.storage_plugin_listMountPoints( |
77 | 77 | 'oracle.generic.NFSPlugin.GenericNFSPlugin', |
|
111 | 111 | nfsDom = parseString(server.discover_mounted_file_systems('nfs')) |
112 | 112 | for node in nfsDom.getElementsByTagName('Mount'): |
113 | 113 | nfsMnt = node.attributes['Dir'].value |
114 | | - print 'Mountpoint: %s' % (nfsMnt) |
| 114 | + print('Mountpoint: %s' % nfsMnt) |
115 | 115 | fsStamp = '%s/.generic_fs_stamp' % nfsMnt |
116 | 116 | # remove this so we don't cock up next run |
117 | 117 | if os.path.isfile(fsStamp): |
118 | | - print "Stamp found: %s" % fsStamp |
| 118 | + print("Stamp found: %s" % fsStamp) |
119 | 119 | os.unlink(fsStamp) |
120 | 120 |
|
121 | 121 | rc = server.storage_plugin_unmount('oracle.generic.NFSPlugin.GenericNFSPlugin', props, extprops, nfsMnt, True) |
122 | | - print rc |
123 | | - |
| 122 | + print(rc) |
124 | 123 |
|
125 | 124 | if pooledFs: |
126 | | - print "pooling" |
| 125 | + print("pooling") |
127 | 126 | # pool stuff |
128 | 127 | poolalias = "ItsMyPool" |
129 | 128 | poolmvip = "192.168.1.161" |
|
153 | 152 | # eventually cluster cleanup can be done by removing |
154 | 153 | # stuff from /etc/ovs-agent/db |
155 | 154 | # also clean /etc/ocfs2/cluster.conf |
156 | | - print server.create_pool_filesystem( |
| 155 | + print(server.create_pool_filesystem( |
157 | 156 | fstype, |
158 | 157 | fstarget, |
159 | 158 | clusterid, |
160 | 159 | poolfsuuid, |
161 | 160 | poolfsnfsbaseuuid, |
162 | 161 | manageruuid, |
163 | 162 | pooluuid |
164 | | - ) |
| 163 | + )) |
165 | 164 |
|
166 | 165 | # poolDom = server.discover_server_pool() |
167 | 166 | # print poolDom |
168 | 167 | # poolDom = parseString(server.discover_server_pool()) |
169 | 168 | # if poolDom.getElementsByTagName('Server_Pool'): |
170 | 169 | # get unique id |
171 | 170 | cluster = server.is_cluster_online() |
172 | | - if cluster == True: |
173 | | - print "clean up pool" |
| 171 | + if cluster: |
| 172 | + print("clean up pool") |
174 | 173 | # print server.destroy_cluster(poolfsuuid) |
175 | 174 | # deconfigure cluster |
176 | 175 | # print server.destroy_server_pool(poolid) |
177 | 176 |
|
178 | | - if cluster == False: |
179 | | - print "create_server_pool" |
| 177 | + if not cluster: |
| 178 | + print("create_server_pool") |
180 | 179 | # first take ownership. without an owner nothing happens |
181 | | - print server.take_ownership(manageruuid, "") |
| 180 | + print(server.take_ownership(manageruuid, "")) |
182 | 181 | # we need to add the first host first to the pool.... |
183 | 182 | poolDom = server.discover_server_pool() |
184 | | - print poolDom |
| 183 | + print(poolDom) |
185 | 184 | poolDom = parseString(server.discover_server_pool()) |
186 | 185 | if poolDom.getElementsByTagName('Server_Pool'): |
187 | | - print server.destroy_server_pool(pooluuid) |
| 186 | + print(server.destroy_server_pool(pooluuid)) |
188 | 187 |
|
189 | | - print server.create_pool_filesystem( |
| 188 | + print(server.create_pool_filesystem( |
190 | 189 | fstype, |
191 | 190 | fstarget, |
192 | 191 | clusterid, |
193 | 192 | poolfsuuid, |
194 | 193 | poolfsnfsbaseuuid, |
195 | 194 | manageruuid, |
196 | 195 | pooluuid |
197 | | - ) |
198 | | - print server.create_server_pool(poolalias, |
| 196 | + )) |
| 197 | + print(server.create_server_pool(poolalias, |
199 | 198 | pooluuid, |
200 | 199 | poolmvip, |
201 | 200 | poolfirsthost['id'], |
202 | 201 | poolfirsthost['hn'], |
203 | 202 | poolfirsthost['ip'], |
204 | | - poolfirsthost['role']) |
| 203 | + poolfirsthost['role'])) |
205 | 204 |
|
206 | | - print "configure_virtual_ip" |
| 205 | + print("configure_virtual_ip") |
207 | 206 | server.configure_virtual_ip(poolmvip, poolfirsthost['ip']) |
208 | 207 | server.set_pool_member_ip_list(['192.168.1.64', '192.168.1.65'],) |
209 | | - print "configure for cluster" |
| 208 | + print("configure for cluster") |
210 | 209 | server.configure_server_for_cluster( |
211 | 210 | { |
212 | 211 | 'O2CB_HEARTBEAT_THRESHOLD': '61', |
|
247 | 246 | poolfsuuid, |
248 | 247 | poolfsnfsbaseuuid |
249 | 248 | ) |
250 | | - print "create cluster" |
| 249 | + print("create cluster") |
251 | 250 | server.create_cluster(poolfsuuid,) |
252 | 251 |
|
253 | 252 | poolDom = parseString(server.discover_server_pool()) |
254 | 253 | for node in poolDom.getElementsByTagName('Server_Pool'): |
255 | 254 | id = node.getElementsByTagName('Unique_Id')[0].firstChild.nodeValue |
256 | 255 | alias = node.getElementsByTagName('Pool_Alias')[0].firstChild.nodeValue |
257 | 256 | mvip = node.getElementsByTagName('Primary_Virtual_Ip')[0].firstChild.nodeValue |
258 | | - print "pool: %s, %s, %s" % (id, mvip, alias) |
| 257 | + print("pool: %s, %s, %s" % (id, mvip, alias)) |
259 | 258 | members = node.getElementsByTagName('Member') |
260 | 259 | for member in members: |
261 | 260 | mip = member.getElementsByTagName('Registered_IP')[0].firstChild.nodeValue |
262 | | - print "member: %s" % (mip) |
| 261 | + print("member: %s" % mip) |
263 | 262 |
|
264 | | - print server.is_cluster_online() |
265 | | - print server.discover_cluster() |
266 | | - print server.discover_pool_filesystem() |
267 | | - print server.discover_server_pool() |
| 263 | + print(server.is_cluster_online()) |
| 264 | + print(server.discover_cluster()) |
| 265 | + print(server.discover_pool_filesystem()) |
| 266 | + print(server.discover_server_pool()) |
268 | 267 | # server.destroy_server_pool(pooluuid) |
269 | 268 |
|
270 | | -except Error, v: |
271 | | - print "ERROR", v |
| 269 | +except Error as v: |
| 270 | + print("ERROR", v) |
0 commit comments