if not xsr:
raise ValueError("Could not find sruuid %s on host %s" %(sruuid, host))
- instance = cls(host, xsr.name)
- instance.uuid = xsr.uuid
- instance.srtype = xsr.srType
- instance.host = host
-
- xpbd = next((p for p in xsr.PBDs if p.host == host.xapiObject), None)
- instance.dconf = xpbd.deviceConfig
- instance.content_type = xsr.contentType
+ instance = xenrt.GEC().registry.srGet(sruuid)
+ if instance:
+ xenrt.TEC().logverbose("Found SR in registry")
+ else:
+ instance = cls(host, xsr.name)
+ instance.uuid = xsr.uuid
+ instance.srtype = xsr.srType
+ instance.host = host
+
+ xpbd = next((p for p in xsr.PBDs if p.host == host.xapiObject), None)
+ instance.dconf = xpbd.deviceConfig
+ instance.content_type = xsr.contentType
return instance
def __backupSMConf(self):
self.srtype = srtype
self.dconf = actualDeviceConfiguration
self.content_type = content_type
+ xenrt.GEC().registry.srPut(self.uuid, self)
def check(self):
self.checkCommon(self.srtype)
def centralResourceGet(self, id):
return self.objGet("centralresource", id)
- def centralResourceDelete(self, tag):
+ def centralResourceDelete(self, id):
self.objDelete("centralresource", id)
def centralResourceGetAll(self):
return self.objGetAll("centralresource")
+
+ def srPut(self, id, sr):
+ self.objPut("sr", id, sr)
+
+ def srGet(self, id):
+ return self.objGet("sr", id)
+
+ def srDelete(self, id):
+ self.objDelete("sr", id)
+
+ def srGetAll(self):
+ return self.objGetAll("sr")