from xenrt.enum import XenServerLicenseSKU
from xenrt.lib.xenserver.licensing import LicenseManager, XenServerLicenseFactory
import datetime
+from xenrt.lib.xenserver.guest import guest
class DotNetAgentAdapter(object):
def cleanupLicense(self, hostOrPool):
self.licenseManager.releaseLicense(hostOrPool)
- def upgradeTools(self):
- pass
-
def exportVM(self, vm):
vm.setState("DOWN")
vmName = vm.getName()
def run(self,arglist):
server = self.adapter.setUpServer(self.getGuest("server"),"16000")
- #self.adapter.applyLicense(self.getDefaultPool())
+ self.adapter.applyLicense(self.getDefaultPool())
autoupdate = self.agent.getLicensedFeature("AutoUpdate")
autoupdate.setUserVMUser()
autoupdate.enable()
pinged = server.isPinged(startTime)
if pinged:
raise xenrt.XRTFailure("autoupdate tries to update when unlicensed")
+
+class VSSQuiescedSnapshotting(DotNetAgentTestCases):
+
+ def run(self, arglist):
+ #self.adapter.applyLicense(self.getDefaultPool())
+ vss = self.agent.getLicensedFeature("VSS")
+ if not vss.isSnapshotPossible():
+ raise xenrt.XRTFailure("snapshot failed in licensed pool")
+ self.adapter.releaseLicense(self.getDefaultPool())
+ if vss.isSnapshotPossible():
+ raise xenrt.XRTFailure("snapshot succeeded in unlicensed pool")
\ No newline at end of file
-from abc import ABCMeta, abstractmethod
+from abc import ABCMeta, abstractmethod
import xenrt
import re
import datetime
pass
def getLicensedFeature(self,feature):
- ''' current features are "VSS", "AutoUpdate" '''
- return self.licensedFeatures[feature]
+ '''VSS or AutoUpdate'''
+ x = self.licensedFeatures[feature]
+ assert isinstance(x, VSS)
+ return x
+
class LicensedFeature(object):
__metaclass__ = ABCMeta
self.os = os
def isSnapshotPossible(self):
- pass
+ self.guest.enableVSS()
+ try:
+ snapuuid = self.guest.snapshot(quiesced=True)
+ xenrt.TEC().logverbose("-----VSS Snapshot succeeded-----")
+ self.guest.removeSnapshot(snapuuid)
+ self.guest.disableVSS()
+ return True
+ except:
+ xenrt.TEC().logverbose("-----VSS Snapshot failed-----")
+ self.guest.disableVSS()
+ return False
def isLicensed(self):
host = self.guest.host