コード例 #1
0
ファイル: p_haul_vz.py プロジェクト: aburluka/p.haul
	def start(self):
		logging.info("Starting CT")
		logging.info("Running vzctl start")
		proc = subprocess.Popen(
			[vzctl_bin, "--skipowner", "--skiplock", "start", self._ctid],
			stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
		proc_output = proc.communicate()[0]
		util.log_subprocess_output(proc_output)
		self._fs_mounted = True
コード例 #2
0
ファイル: p_haul_vz.py プロジェクト: arthurlockman/p.haul
	def umount(self):
		if self._fs_mounted:
			logging.info("Umounting CT root")
			logging.info("Running vzctl umount")
			proc = subprocess.Popen(
				[vzctl_bin, "--skipowner", "--skiplock", "umount", self._ctid],
				stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
			proc_output = proc.communicate()[0]
			util.log_subprocess_output(proc_output)
			self._fs_mounted = False
コード例 #3
0
ファイル: p_haul_vz.py プロジェクト: arthurlockman/p.haul
	def mount(self):
		logging.info("Mounting CT root to %s", self._ct_root)
		logging.info("Running vzctl mount")
		proc = subprocess.Popen(
			[vzctl_bin, "--skipowner", "--skiplock", "mount", self._ctid],
			stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
		proc_output = proc.communicate()[0]
		util.log_subprocess_output(proc_output)
		self._fs_mounted = True
		return self._ct_root
コード例 #4
0
ファイル: p_haul_vz.py プロジェクト: Snorch/p.haul
	def umount(self):
		if self._fs_mounted:
			logging.info("Umounting CT root")
			logging.info("Running vzctl umount")
			proc = subprocess.Popen(
				[vzctl_bin, "--skipowner", "--skiplock", "umount", self._ctid],
				stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
			proc_output = proc.communicate()[0]
			util.log_subprocess_output(proc_output)
			self._fs_mounted = False
コード例 #5
0
ファイル: p_haul_vz.py プロジェクト: Snorch/p.haul
	def mount(self):
		logging.info("Mounting CT root to %s", self._ct_root)
		logging.info("Running vzctl mount")
		proc = subprocess.Popen(
			[vzctl_bin, "--skipowner", "--skiplock", "mount", self._ctid],
			stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
		proc_output = proc.communicate()[0]
		util.log_subprocess_output(proc_output)
		self._fs_mounted = True
		return self._ct_root
コード例 #6
0
ファイル: p_haul_vz.py プロジェクト: tupipa/p.haul
 def start(self):
     logging.info("Starting CT")
     logging.info("Running vzctl start")
     proc = subprocess.Popen(
         [vzctl_bin, "--skipowner", "--skiplock", "start", self._ctid],
         stdout=subprocess.PIPE,
         stderr=subprocess.STDOUT)
     proc_output = proc.communicate()[0]
     util.log_subprocess_output(proc_output)
     self._fs_mounted = True
コード例 #7
0
ファイル: p_haul_vz.py プロジェクト: arthurlockman/p.haul
	def stop(self, umount):
		logging.info("Stopping CT")
		logging.info("Running vzctl stop")
		args = [vzctl_bin, "--skipowner", "--skiplock", "stop", self._ctid]
		if not umount:
			args.append("--skip-umount")
		proc = subprocess.Popen(
			args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
		proc_output = proc.communicate()[0]
		util.log_subprocess_output(proc_output)
		self._fs_mounted = not umount
コード例 #8
0
ファイル: p_haul_vz.py プロジェクト: arthurlockman/p.haul
	def start(self):
		logging.info("Starting CT")
		logging.info("Running vzctl start")
		proc = subprocess.Popen(
			[vzctl_bin, "--skipowner", "--skiplock", "start", self._ctid],
			stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
		proc_output = proc.communicate()[0]
		util.log_subprocess_output(proc_output)
		if proc.returncode != 0:
			raise Exception("Start failed ({0})".format(proc.returncode))
		self._fs_mounted = True
コード例 #9
0
ファイル: p_haul_vz.py プロジェクト: Snorch/p.haul
	def stop(self, umount):
		logging.info("Stopping CT")
		logging.info("Running vzctl stop")
		args = [vzctl_bin, "--skipowner", "--skiplock", "stop", self._ctid]
		if not umount:
			args.append("--skip-umount")
		proc = subprocess.Popen(
			args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
		proc_output = proc.communicate()[0]
		util.log_subprocess_output(proc_output)
		self._fs_mounted = not umount
コード例 #10
0
ファイル: p_haul_vz.py プロジェクト: Snorch/p.haul
	def start(self):
		logging.info("Starting CT")
		logging.info("Running vzctl start")
		proc = subprocess.Popen(
			[vzctl_bin, "--skipowner", "--skiplock", "start", self._ctid],
			stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
		proc_output = proc.communicate()[0]
		util.log_subprocess_output(proc_output)
		if proc.returncode != 0:
			raise Exception("Start failed ({0})".format(proc.returncode))
		self._fs_mounted = True
コード例 #11
0
ファイル: p_haul_vz.py プロジェクト: arthurlockman/p.haul
	def final_restore(self, img, connection):
		"""Perform Virtuozzo-specific final restore"""
		try:
			# Setup restore extra arguments
			args_path = os.path.join(img.image_dir(), "restore-extra-args")
			self.__setup_restore_extra_args(args_path, img, connection)
			# Run vzctl restore
			logging.info("Starting vzctl restore")
			proc = subprocess.Popen([vzctl_bin, "--skipowner", "--skiplock", "restore",
				self._ctid, "--skip_arpdetect", "--dumpfile", img.image_dir()],
				stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
			proc_output = proc.communicate()[0]
			util.log_subprocess_output(proc_output)
			if proc.returncode != 0:
				raise Exception("Restore failed ({0})".format(proc.returncode))
		finally:
			# Remove restore extra arguments
			self.__remove_restore_extra_args(args_path)
コード例 #12
0
ファイル: p_haul_vz.py プロジェクト: Snorch/p.haul
	def final_restore(self, img, connection):
		"""Perform Virtuozzo-specific final restore"""
		try:
			# Setup restore extra arguments
			args_path = os.path.join(img.image_dir(), "restore-extra-args")
			self.__setup_restore_extra_args(args_path, img, connection)
			# Run vzctl restore
			logging.info("Starting vzctl restore")

			proc = subprocess.Popen([vzctl_bin, "--skipowner", "--skiplock",
									"restore", self._ctid, "--skip_arpdetect",
									"--dumpfile", img.image_dir()],
									stdout=subprocess.PIPE,
									stderr=subprocess.STDOUT)
			proc_output = proc.communicate()[0]

			util.log_subprocess_output(proc_output)
			if proc.returncode != 0:
				raise Exception("Restore failed ({0})".format(proc.returncode))
		finally:
			# Remove restore extra arguments
			self.__remove_restore_extra_args(args_path)