Skip to content

Commit 06d67eb

Browse files
authored
Merge branch 'main' into enable-markdownlint-rule-MD012
2 parents 4b440ae + 631bba2 commit 06d67eb

File tree

3 files changed

+77
-45
lines changed

3 files changed

+77
-45
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Apache CloudStack [![Build Status](https://github.com/apache/cloudstack/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/build.yml) [![UI Build](https://github.com/apache/cloudstack/actions/workflows/ui.yml/badge.svg)](https://github.com/apache/cloudstack/actions/workflows/ui.yml) [![License Check](https://github.com/apache/cloudstack/actions/workflows/rat.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/rat.yml) [![Simulator CI](https://github.com/apache/cloudstack/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/ci.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=apache_cloudstack&metric=alert_status)](https://sonarcloud.io/dashboard?id=apache_cloudstack) [![codecov](https://codecov.io/gh/apache/cloudstack/branch/main/graph/badge.svg)](https://codecov.io/gh/apache/cloudstack)
22

3-
[![Apache CloudStack](tools/logo/apache_cloudstack.png)](https://cloudstack.apache.org/)
3+
[![Apache CloudStack](tools/logo/acsxmas.jpg)](https://cloudstack.apache.org/)
44

55
Apache CloudStack is open source software designed to deploy and manage large
66
networks of virtual machines, as a highly available, highly scalable

plugins/hypervisors/ovm3/src/test/resources/scripts/create_pool_cluster.py

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
try:
3131
if normalRepo:
32-
print "normal repo"
32+
print("normal repo")
3333
# this literally throws EVERYTHING away on the repo
3434
repoDom = parseString(server.discover_repository_db())
3535
for node in repoDom.getElementsByTagName('Repository'):
@@ -43,16 +43,16 @@
4343
# in which repo it lives....
4444
for dirname, dirnames, filenames in os.walk('%s/VirtualMachines/' % localMount):
4545
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))
4747
try:
4848
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))
5252
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)
5656
continue
5757

5858
# VMs = server.list_vms()
@@ -63,15 +63,15 @@
6363

6464
rc = server.delete_repository(repoUuid.value, True)
6565
# 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)
6969
# now unmount the FS
7070
# print server.unmount_repository_fs(localMount)
7171
else:
72-
print "Failed repo: %s not destroyed!" % repoUuid.value
72+
print("Failed repo: %s not destroyed!" % repoUuid.value)
7373

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.
7575
nfsHost = 'cs-mgmt'
7676
nfsDom = server.storage_plugin_listMountPoints(
7777
'oracle.generic.NFSPlugin.GenericNFSPlugin',
@@ -111,19 +111,18 @@
111111
nfsDom = parseString(server.discover_mounted_file_systems('nfs'))
112112
for node in nfsDom.getElementsByTagName('Mount'):
113113
nfsMnt = node.attributes['Dir'].value
114-
print 'Mountpoint: %s' % (nfsMnt)
114+
print('Mountpoint: %s' % nfsMnt)
115115
fsStamp = '%s/.generic_fs_stamp' % nfsMnt
116116
# remove this so we don't cock up next run
117117
if os.path.isfile(fsStamp):
118-
print "Stamp found: %s" % fsStamp
118+
print("Stamp found: %s" % fsStamp)
119119
os.unlink(fsStamp)
120120

121121
rc = server.storage_plugin_unmount('oracle.generic.NFSPlugin.GenericNFSPlugin', props, extprops, nfsMnt, True)
122-
print rc
123-
122+
print(rc)
124123

125124
if pooledFs:
126-
print "pooling"
125+
print("pooling")
127126
# pool stuff
128127
poolalias = "ItsMyPool"
129128
poolmvip = "192.168.1.161"
@@ -153,60 +152,60 @@
153152
# eventually cluster cleanup can be done by removing
154153
# stuff from /etc/ovs-agent/db
155154
# also clean /etc/ocfs2/cluster.conf
156-
print server.create_pool_filesystem(
155+
print(server.create_pool_filesystem(
157156
fstype,
158157
fstarget,
159158
clusterid,
160159
poolfsuuid,
161160
poolfsnfsbaseuuid,
162161
manageruuid,
163162
pooluuid
164-
)
163+
))
165164

166165
# poolDom = server.discover_server_pool()
167166
# print poolDom
168167
# poolDom = parseString(server.discover_server_pool())
169168
# if poolDom.getElementsByTagName('Server_Pool'):
170169
# get unique id
171170
cluster = server.is_cluster_online()
172-
if cluster == True:
173-
print "clean up pool"
171+
if cluster:
172+
print("clean up pool")
174173
# print server.destroy_cluster(poolfsuuid)
175174
# deconfigure cluster
176175
# print server.destroy_server_pool(poolid)
177176

178-
if cluster == False:
179-
print "create_server_pool"
177+
if not cluster:
178+
print("create_server_pool")
180179
# first take ownership. without an owner nothing happens
181-
print server.take_ownership(manageruuid, "")
180+
print(server.take_ownership(manageruuid, ""))
182181
# we need to add the first host first to the pool....
183182
poolDom = server.discover_server_pool()
184-
print poolDom
183+
print(poolDom)
185184
poolDom = parseString(server.discover_server_pool())
186185
if poolDom.getElementsByTagName('Server_Pool'):
187-
print server.destroy_server_pool(pooluuid)
186+
print(server.destroy_server_pool(pooluuid))
188187

189-
print server.create_pool_filesystem(
188+
print(server.create_pool_filesystem(
190189
fstype,
191190
fstarget,
192191
clusterid,
193192
poolfsuuid,
194193
poolfsnfsbaseuuid,
195194
manageruuid,
196195
pooluuid
197-
)
198-
print server.create_server_pool(poolalias,
196+
))
197+
print(server.create_server_pool(poolalias,
199198
pooluuid,
200199
poolmvip,
201200
poolfirsthost['id'],
202201
poolfirsthost['hn'],
203202
poolfirsthost['ip'],
204-
poolfirsthost['role'])
203+
poolfirsthost['role']))
205204

206-
print "configure_virtual_ip"
205+
print("configure_virtual_ip")
207206
server.configure_virtual_ip(poolmvip, poolfirsthost['ip'])
208207
server.set_pool_member_ip_list(['192.168.1.64', '192.168.1.65'],)
209-
print "configure for cluster"
208+
print("configure for cluster")
210209
server.configure_server_for_cluster(
211210
{
212211
'O2CB_HEARTBEAT_THRESHOLD': '61',
@@ -247,25 +246,25 @@
247246
poolfsuuid,
248247
poolfsnfsbaseuuid
249248
)
250-
print "create cluster"
249+
print("create cluster")
251250
server.create_cluster(poolfsuuid,)
252251

253252
poolDom = parseString(server.discover_server_pool())
254253
for node in poolDom.getElementsByTagName('Server_Pool'):
255254
id = node.getElementsByTagName('Unique_Id')[0].firstChild.nodeValue
256255
alias = node.getElementsByTagName('Pool_Alias')[0].firstChild.nodeValue
257256
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))
259258
members = node.getElementsByTagName('Member')
260259
for member in members:
261260
mip = member.getElementsByTagName('Registered_IP')[0].firstChild.nodeValue
262-
print "member: %s" % (mip)
261+
print("member: %s" % mip)
263262

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())
268267
# server.destroy_server_pool(pooluuid)
269268

270-
except Error, v:
271-
print "ERROR", v
269+
except Error as v:
270+
print("ERROR", v)

ui/src/views/network/CreateVpc.vue

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
</a-select-option>
6363
</a-select>
6464
</a-form-item>
65+
<ownership-selection v-if="isAdminOrDomainAdmin()" @fetch-owner="fetchOwnerOptions"/>
6566
<a-form-item name="cidr" ref="cidr" v-if="selectedVpcOffering && (selectedVpcOffering.networkmode !== 'ROUTED' || isAdmin())">
6667
<template #label>
6768
<tooltip-label :title="$t('label.cidr')" :tooltip="apiParams.cidr.description"/>
@@ -210,13 +211,15 @@
210211
<script>
211212
import { ref, reactive, toRaw } from 'vue'
212213
import { api } from '@/api'
213-
import { isAdmin } from '@/role'
214+
import { isAdmin, isAdminOrDomainAdmin } from '@/role'
214215
import ResourceIcon from '@/components/view/ResourceIcon'
215216
import TooltipLabel from '@/components/widgets/TooltipLabel'
217+
import OwnershipSelection from '@/views/compute/wizard/OwnershipSelection.vue'
216218
217219
export default {
218220
name: 'CreateVpc',
219221
components: {
222+
OwnershipSelection,
220223
ResourceIcon,
221224
TooltipLabel
222225
},
@@ -267,6 +270,7 @@ export default {
267270
}
268271
},
269272
methods: {
273+
isAdminOrDomainAdmin,
270274
initForm () {
271275
this.formRef = ref()
272276
this.form = reactive({
@@ -359,6 +363,28 @@ export default {
359363
}
360364
})
361365
},
366+
fetchOwnerOptions (OwnerOptions) {
367+
this.owner = {
368+
projectid: null,
369+
domainid: this.$store.getters.userInfo.domainid,
370+
account: this.$store.getters.userInfo.account
371+
}
372+
if (OwnerOptions.selectedAccountType === 'Account') {
373+
if (!OwnerOptions.selectedAccount) {
374+
return
375+
}
376+
this.owner.account = OwnerOptions.selectedAccount
377+
this.owner.domainid = OwnerOptions.selectedDomain
378+
this.owner.projectid = null
379+
} else if (OwnerOptions.selectedAccountType === 'Project') {
380+
if (!OwnerOptions.selectedProject) {
381+
return
382+
}
383+
this.owner.account = null
384+
this.owner.domainid = null
385+
this.owner.projectid = OwnerOptions.selectedProject
386+
}
387+
},
362388
handleVpcOfferingChange (value) {
363389
this.selectedVpcOffering = {}
364390
if (!value) {
@@ -398,7 +424,14 @@ export default {
398424
if (this.loading) return
399425
this.formRef.value.validate().then(() => {
400426
const values = toRaw(this.form)
401-
const params = {}
427+
var params = {}
428+
if (this.owner?.account) {
429+
params.account = this.owner.account
430+
params.domainid = this.owner.domainid
431+
} else if (this.owner?.projectid) {
432+
params.domainid = this.owner.domainid
433+
params.projectid = this.owner.projectid
434+
}
402435
for (const key in values) {
403436
const input = values[key]
404437
if (input === '' || input === null || input === undefined) {

0 commit comments

Comments
 (0)