/******************
 Sandbox interface
*******************/
164210
func procGetSandbox(c libnetwork.NetworkController, vars map[string]string, body []byte) (interface{}, *responseStatus) {
	if epT, ok := vars[urlEpID]; ok {
		sv, errRsp := findService(c, epT, byID)
		if !errRsp.isOK() {
			return nil, endpointToService(errRsp)
		}
		return buildSandboxResource(sv.Info().Sandbox()), &successResponse
	}

	sbT, by := detectSandboxTarget(vars)
	sb, errRsp := findSandbox(c, sbT, by)
	if !errRsp.isOK() {
		return nil, errRsp
	}
	return buildSandboxResource(sb), &successResponse
}
197155
func (service *VboxPortType) IMousePointerShapeChangedEventgetWidth(request *IMousePointerShapeChangedEventgetWidth) (*IMousePointerShapeChangedEventgetWidthResponse, error) {
	response := new(IMousePointerShapeChangedEventgetWidthResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
1321988
func (service *VboxPortType) IGuestSessiondirectoryCreateTemp(request *IGuestSessiondirectoryCreateTemp) (*IGuestSessiondirectoryCreateTempResponse, error) {
	response := new(IGuestSessiondirectoryCreateTempResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
642355
func GetSandboxForExternalKey(basePath string, key string) (Sandbox, error) {
	if err := createNamespaceFile(key); err != nil {
		return nil, err
	}

	if err := mountNetworkNamespace(basePath, key); err != nil {
		return nil, err
	}
	n := &networkNamespace{path: key, nextIfIndex: make(map[string]int)}

	sboxNs, err := netns.GetFromPath(n.path)
	if err != nil {
		return nil, fmt.Errorf("failed get network namespace %q: %v", n.path, err)
	}
	defer sboxNs.Close()

	n.nlHandle, err = netlink.NewHandleAt(sboxNs, syscall.NETLINK_ROUTE)
	if err != nil {
		return nil, fmt.Errorf("failed to create a netlink handle: %v", err)
	}

	err = n.nlHandle.SetSocketTimeout(ns.NetlinkSocketsTimeout)
	if err != nil {
		logrus.Warnf("Failed to set the timeout on the sandbox netlink handle sockets: %v", err)
	}

	// As starting point, disable IPv6 on all interfaces
	err = setIPv6(n.path, "all", false)
	if err != nil {
		logrus.Warnf("Failed to disable IPv6 on all interfaces on network namespace %q: %v", n.path, err)
	}

	if err = n.loopbackUp(); err != nil {
		n.nlHandle.Delete()
		return nil, err
	}

	return n, nil
}
244948
func (service *VboxPortType) IBIOSSettingsgetBootMenuMode(request *IBIOSSettingsgetBootMenuMode) (*IBIOSSettingsgetBootMenuModeResponse, error) {
	response := new(IBIOSSettingsgetBootMenuModeResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
597184
func (service *VboxPortType) IGuestSessionwaitFor(request *IGuestSessionwaitFor) (*IGuestSessionwaitForResponse, error) {
	response := new(IGuestSessionwaitForResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
666139
func (service *VboxPortType) IPCIAddresssetDevFunction(request *IPCIAddresssetDevFunction) (*IPCIAddresssetDevFunctionResponse, error) {
	response := new(IPCIAddresssetDevFunctionResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
227776
func (service *VboxPortType) IProcessgetEnvironment(request *IProcessgetEnvironment) (*IProcessgetEnvironmentResponse, error) {
	response := new(IProcessgetEnvironmentResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
1296670
func NewSandbox(key string, osCreate, isRestore bool) (Sandbox, error) {
	return nil, nil
}
948255
func (p *XPod) addResourcesToSandbox() error {
	p.resourceLock.Lock()
	defer p.resourceLock.Unlock()

	if !p.IsAlive() {
		p.Log(ERROR, "pod is not alive, can not add resources to sandbox")
		return errors.ErrPodNotAlive.WithArgs(p.Id())
	}

	p.Log(INFO, "adding resource to sandbox")
	future := utils.NewFutureSet()

	future.Add("addInterface", func() error {
		for _, inf := range p.interfaces {
			if err := inf.add(); err != nil {
				return err
			}
		}
		err := p.sandbox.AddRoute()
		if err != nil {
			p.Log(ERROR, "fail to add Route: %v", err)
		}
		return err
	})

	for iv, vol := range p.volumes {
		future.Add(iv, vol.add)
	}

	for ic, c := range p.containers {
		future.Add(ic, c.addToSandbox)
	}

	if p.services.size() != 0 {
		future.Add("serivce", p.services.apply)
	}

	if err := future.Wait(ProvisionTimeout); err != nil {
		p.Log(ERROR, "error during add resources to sandbox: %v", err)
		return err
	}
	return nil
}
546090
func (c *ContainerServer) LookupSandbox(idOrName string) (*sandbox.Sandbox, error) {
	if idOrName == "" {
		return nil, fmt.Errorf("container ID or name should not be empty")
	}

	podID, err := c.podNameIndex.Get(idOrName)
	if err != nil {
		if err == registrar.ErrNameNotReserved {
			podID = idOrName
		} else {
			return nil, err
		}
	}

	return c.getSandboxFromRequest(podID)
}
193169
func (service *VboxPortType) IDirectorygetFilter(request *IDirectorygetFilter) (*IDirectorygetFilterResponse, error) {
	response := new(IDirectorygetFilterResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
391653
func (service *VboxPortType) IDisplayviewportChanged(request *IDisplayviewportChanged) (*IDisplayviewportChangedResponse, error) {
	response := new(IDisplayviewportChangedResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
958863
func (service *VboxPortType) IDisplaygetFramebuffer(request *IDisplaygetFramebuffer) (*IDisplaygetFramebufferResponse, error) {
	response := new(IDisplaygetFramebufferResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
677560
func (service *VboxPortType) IDisplayresizeCompleted(request *IDisplayresizeCompleted) (*IDisplayresizeCompletedResponse, error) {
	response := new(IDisplayresizeCompletedResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
413171
func (v *Volume) insert() error {
	v.Log(DEBUG, "insert volume to sandbox")
	r := v.p.sandbox.AddVolume(v.descript)
	if !r.IsSuccess() {
		err := fmt.Errorf("failed to insert: %s", r.Message())
		v.Log(ERROR, err)
		return err
	}

	v.Log(INFO, "volume inserted")
	return nil
}
218785
func (c *controller) SandboxDestroy(id string) error {
	var sb *sandbox
	c.Lock()
	for _, s := range c.sandboxes {
		if s.containerID == id {
			sb = s
			break
		}
	}
	c.Unlock()

	// It is not an error if sandbox is not available
	if sb == nil {
		return nil
	}

	return sb.Delete()
}