MCPcopy Create free account
hub / github.com/apache/cloudstack / create

Method create

scripts/vm/hypervisor/xenserver/xcposs/NFSSR.py:160–192  ·  view source on GitHub ↗
(self, sr_uuid, size)

Source from the content-addressed store, hash-verified

158
159
160 def create(self, sr_uuid, size):
161 util._testHost(self.dconf['server'], NFSPORT, 'NFSTarget')
162 self.validate_remotepath(True)
163 if self._checkmount():
164 raise xs_errors.XenError('NFSAttached')
165
166 # Set the target path temporarily to the base dir
167 # so that we can create the target SR directory
168 self.remotepath = self.dconf['serverpath']
169 try:
170 self.mount_remotepath(sr_uuid)
171 except Exception, exn:
172 try:
173 os.rmdir(self.path)
174 except:
175 pass
176 raise exn
177
178 #newpath = os.path.join(self.path, sr_uuid)
179 #if util.ioretry(lambda: util.pathexists(newpath)):
180 # if len(util.ioretry(lambda: util.listdir(newpath))) != 0:
181 # self.detach(sr_uuid)
182 # raise xs_errors.XenError('SRExists')
183 #else:
184 # try:
185 # util.ioretry(lambda: util.makedirs(newpath))
186 # except util.CommandException, inst:
187 # if inst.code != errno.EEXIST:
188 # self.detach(sr_uuid)
189 # raise xs_errors.XenError('NFSCreate',
190 # opterr='remote directory creation error is %d'
191 # % inst.code)
192 self.detach(sr_uuid)
193
194 def delete(self, sr_uuid):
195 # try to remove/delete non VDI contents first

Callers

nothing calls this directly

Calls 4

validate_remotepathMethod · 0.95
_checkmountMethod · 0.95
mount_remotepathMethod · 0.95
detachMethod · 0.95

Tested by

no test coverage detected