def container_update_claim(self, context, new_container, old_container, limits=None): """Indicate resources are needed for an upcoming container update. This should be called before the compute node is about to perform an container update operation that will consume additional resources. :param context: security context :param new_container: container to be updated to. :type new_container: zun.objects.container.Container object :param old_container: container to be updated from. :type old_container: zun.objects.container.Container object :param limits: Dict of oversubscription limits for memory, disk, and CPUs. :returns: A Claim ticket representing the reserved resources. It can be used to revert the resource usage if an error occurs during the container update. """ if (new_container.cpu == old_container.cpu and new_container.memory == old_container.memory): return claims.NopClaim() # We should have the compute node created here, just get it. self.compute_node = self._get_compute_node(context) claim = claims.UpdateClaim(context, new_container, old_container, self, self.compute_node, limits=limits) self._update_usage_from_container_update(context, new_container, old_container) # persist changes to the compute node: self._update(self.compute_node) return claim
def container_claim(self, context, container, hostname, limits=None): """Indicate resources are needed for an upcoming container build. This should be called before the compute node is about to perform an container build operation that will consume additional resources. :param context: security context :param container: container to reserve resources for. :type container: zun.objects.container.Container object :param hostname: The zun hostname selected by the scheduler :param limits: Dict of oversubscription limits for memory, disk, and CPUs. :returns: A Claim ticket representing the reserved resources. It can be used to revert the resource usage if an error occurs during the container build. """ # No memory and cpu specified, no need to claim resource now. if not (container.memory or container.cpu): self._set_container_host(container) return claims.NopClaim() # We should have the compute node created here, just get it. self.compute_node = self._get_compute_node(context) if self.disabled(hostname): self._set_container_host(container) return claims.NopClaim() claim = claims.Claim(context, container, self, self.compute_node, limits=limits) self._set_container_host(container) self._update_usage_from_container(container) # persist changes to the compute node: self._update(self.compute_node) return claim
def container_claim(self, context, container, host, limits): return claims.NopClaim()
def container_claim(self, context, container, pci_requests, limits): return claims.NopClaim()