コード例 #1
0
ファイル: openvz.py プロジェクト: m3z/ToMaTo
			"execute": isUser and self.state == State.STARTED,
		})
		capabilities.update(other={
			"console": isUser and self.getVncPort() and self.state == State.STARTED
		})
		return capabilities

	def _runAction(self, action, attrs, direct):
		if action == "execute":
			fault.check("cmd" in attrs, "Command not given")
			try:
				return self.execute(attrs["cmd"])
			except exceptions.CommandError, exc:
				raise fault.new(str(exc), fault.USER_ERROR)
		else:
			return Device._runAction(self, action, attrs, direct)

	def _startVnc(self):
		if not self.getVncPort():
			self._assignVncPort()		
		if self._vncRunning():
			return
		vzctl.startVnc(self.host, self.getVmid(), self.getVncPort(), self.vncPassword())

	def _profileChanged(self):
		vzctl.setProfile(self.host, self.getVmid(), **self.getProfile().attrs)

	def _configureRoutes(self):
		#Note: usage of self as host is intentional
		ifaceutil.deleteDefaultRoute(self)
		if self.hasAttribute("gateway4"):
コード例 #2
0
ファイル: openvz.py プロジェクト: joanmarkt/ToMaTo
	def _runAction(self, action, attrs, direct):
		if action == "execute":
			return self.execute(attrs["cmd"])
		else:
			return Device._runAction(self, action, attrs, direct)
コード例 #3
0
ファイル: kvm.py プロジェクト: david-hock/ToMaTo
	def _runAction(self, action, attrs, direct):
		if action == "send_keys":
			return self.sendKeys(attrs["keycodes"])
		else:
			return Device._runAction(self, action, attrs, direct)