2
for i in group_pool group host_pool host image_pool image template_pool template user_pool user vm_pool vm vnet_pool vnet
3
# -------------------------------------------------------------------------- #
4
# Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) #
6
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
7
# not use this file except in compliance with the License. You may obtain #
8
# a copy of the License at #
10
# http://www.apache.org/licenses/LICENSE-2.0 #
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
#--------------------------------------------------------------------------- #
19
mkdir -p samples/cluster samples/cluster_pool
20
mkdir -p samples/datastore samples/datastore_pool
21
mkdir -p samples/group samples/group_pool
22
mkdir -p samples/host samples/host_pool
23
mkdir -p samples/image samples/image_pool
24
mkdir -p samples/vmtemplate samples/vmtemplate_pool
25
mkdir -p samples/user samples/user_pool
26
mkdir -p samples/vm samples/vm_pool
27
mkdir -p samples/vnet samples/vnet_pool
31
onecluster create newcluster
32
onegroup create newgroup
36
onehost create host01 --im im_test --vm vmm_test --net dummy
37
onehost create host02 --im im_test --vm vmm_test --net dummy
39
onecluster addhost newcluster host02
41
onehost show 0 -x > samples/host/0.xml
42
onehost show 1 -x > samples/host/1.xml
44
onehost list -x > samples/host_pool/0.xml
48
onevnet list -x > samples/vnet_pool/1.xml
50
onevnet create test/vnet.0
52
onevnet list -x > samples/vnet_pool/2.xml
54
onevnet create test/vnet.1
55
onevnet create test/vnet.2
57
onecluster addvnet newcluster 0
58
onecluster addvnet newcluster 2
60
onevnet show 0 -x > samples/vnet/0.xml
61
onevnet show 1 -x > samples/vnet/1.xml
62
onevnet show 2 -x > samples/vnet/2.xml
64
onevnet list -x > samples/vnet_pool/3.xml
68
onetemplate list -x > samples/vmtemplate_pool/1.xml
70
onetemplate create test/template.0
71
onetemplate create test/template.1
73
onetemplate show 0 -x > samples/vmtemplate/0.xml
74
onetemplate show 1 -x > samples/vmtemplate/1.xml
76
onetemplate list -x > samples/vmtemplate_pool/2.xml
80
onetemplate instantiate 0
82
onevm show 0 -x > samples/vm/0.xml
84
onevm list -x > samples/vm_pool/0.xml
87
onecluster create emptycluster
89
onecluster show 100 -x > samples/cluster/0.xml
90
onecluster show 101 -x > samples/cluster/1.xml
92
onecluster list -x > samples/cluster_pool/0.xml
96
oneimage list -x > samples/image_pool/1.xml
98
oneimage create test/image.0 -d default
99
oneimage create test/image.1 -d default
101
oneimage show 0 -x > samples/image/0.xml
102
oneimage show 1 -x > samples/image/1.xml
104
oneimage list -x > samples/image_pool/3.xml
108
onedatastore create test/datastore.0
109
onedatastore create test/datastore.1
111
onecluster adddatastore newcluster 100
112
onecluster adddatastore newcluster 101
114
onedatastore show 100 -x > samples/datastore/0.xml
115
onedatastore show 101 -x > samples/datastore/1.xml
117
onedatastore list -x > samples/datastore_pool/0.xml
121
oneuser create newuser abc
122
oneuser chgrp newuser newgroup
124
oneuser show newuser -x > samples/user/0.xml
126
oneuser list -x > samples/user_pool/0.xml
130
onegroup create emptygroup
132
onegroup show 0 -x > samples/group/0.xml
133
onegroup show 1 -x > samples/group/1.xml
134
onegroup show 100 -x > samples/group/2.xml
135
onegroup show 101 -x > samples/group/3.xml
137
onegroup list -x > samples/group_pool/0.xml
141
for i in cluster datastore group host image vmtemplate user vm vnet
143
POOL_NAME="$i""_pool"
145
sed -i "s%<${i^^}>%<${i^^} xmlns='http://opennebula.org/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://opennebula.org/XMLSchema ../../$i.xsd'>%" samples/$i/*.xml
146
sed -i "s%<${i^^}_POOL/>%<${i^^}_POOL xmlns='http://opennebula.org/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://opennebula.org/XMLSchema ../../$POOL_NAME.xsd'/>%" samples/$POOL_NAME/*.xml
147
sed -i "s%<${i^^}_POOL>%<${i^^}_POOL xmlns='http://opennebula.org/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://opennebula.org/XMLSchema ../../$POOL_NAME.xsd'>%" samples/$POOL_NAME/*.xml
4
149
xmllint --noout --schema $i.xsd samples/$i/*
b'\\ No newline at end of file'
150
xmllint --noout --schema $POOL_NAME.xsd samples/$POOL_NAME/*