jiebi/CodeConvo huggingface dataset:
// If the -exist option is specified, ipset ignores the error otherwise raised when // the same set (setname and create parameters are identical) already exists. func (runner *runner) AddEntry(entry string, set *IPSet, ignoreExistErr bool) error { <del> args := []string{"add", set.Name, entry, "comment", set.Comment} </del> <ins> args := []string{"add", set.Name, entry} </ins> if ignoreExistErr { args = append(args, "-exist") }
// DelEntry is used to delete the specified entry from the set. func (runner *runner) DelEntry(entry string, set string) error { <del> entry = strings.Split(entry, " comment")[0] </del> if _, err := runner.exec.Command(IPSetCmd, "del", set, entry).CombinedOutput(); err != nil { return fmt.Errorf("error deleting entry %s: from set: %s, error: %v", entry, set, err) }
// Logout calls SessionManager.Logout for the given connection. func (connection *VSphereConnection) Logout(ctx context.Context) { <del> m := session.NewManager(connection.Client) </del> <ins> clientLock.Lock() c := connection.Client clientLock.Unlock() if c == nil { return } m := session.NewManager(c) </ins> hasActiveSession, err := m.SessionIsActive(ctx) if err != nil {
dnsImage := GetGenericArchImage(cfg.ImageRepository, "k8s-dns-kube-dns", constants.KubeDNSVersion) if features.Enabled(cfg.FeatureGates, features.CoreDNS) { <del> dnsImage = GetGenericArchImage(cfg.ImageRepository, "coredns", constants.CoreDNSVersion) </del> <ins> dnsImage = fmt.Sprintf("%s/%s:%s", cfg.ImageRepository, constants.CoreDNS, constants.CoreDNSVersion) </ins> } imgs = append(imgs, dnsImage) return imgs
// InstanceShutdownByProviderID returns true if the instance is in safe state to detach volumes func (az *Cloud) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error) { <del> return false, cloudprovider.NotImplemented </del> <ins> nodeName, err := az.vmSet.GetNodeNameByProviderID(providerID) if err != nil { return false, err } provisioningState, err := az.vmSet.GetProvisioningStateByNodeName(string(nodeName)) if err != nil { return false, err } return strings.ToLower(provisioningState) == "stopped" || strings.ToLower(provisioningState) == "deallocated", nil </ins> } // getComputeMetadata gets compute information from instance metadata.
return *machine.ID, nil } <ins> func (as *availabilitySet) GetProvisioningStateByNodeName(name string) (provisioningState string, err error) { vm, err := as.getVirtualMachine(types.NodeName(name)) if err != nil { return provisioningState, err } return *vm.ProvisioningState, nil } </ins> // GetNodeNameByProviderID gets the node name by provider ID. func (as *availabilitySet) GetNodeNameByProviderID(providerID string) (types.NodeName, error) { // NodeName is part of providerID for standard instances.
DetachDiskByName(diskName, diskURI string, nodeName types.NodeName) error // GetDataDisks gets a list of data disks attached to the node. GetDataDisks(nodeName types.NodeName) ([]compute.DataDisk, error) <ins> // GetProvisioningStateByNodeName gets the provisioning state by node name. GetProvisioningStateByNodeName(name string) (string, error) </ins> }
return ssName, instanceID, *(cachedVM.(*compute.VirtualMachineScaleSetVM)), nil } <ins> func (ss *scaleSet) GetProvisioningStateByNodeName(name string) (provisioningState string, err error) { _, _, vm, err := ss.getVmssVM(name) if err != nil { return provisioningState, err } return *vm.ProvisioningState, nil } </ins> // getCachedVirtualMachineByInstanceID gets scaleSetVMInfo from cache. // The node must belong to one of scale sets. func (ss *scaleSet) getVmssVMByInstanceID(resourceGroup, scaleSetName, instanceID string) (vm compute.VirtualMachineScaleSetVM, err error) {
type listenPortOpener struct{} // OpenLocalPort holds the given local port open. <del> func (l *listenPortOpener) OpenLocalPort(lp *utilproxy.LocalPort) (utilproxy.Closeable, error) { return openLocalPort(lp) </del> <ins> func (l *listenPortOpener) OpenLocalPort(lp *utilproxy.LocalPort, isIPv6 bool) (utilproxy.Closeable, error) { return openLocalPort(lp, isIPv6) </ins> } // Proxier implements proxy.Provider
klog.V(4).Infof("Port %s was open before and is still needed", lp.String()) replacementPortsMap[lp] = proxier.portsMap[lp] } else if svcInfo.Protocol() != v1.ProtocolSCTP { <del> socket, err := proxier.portMapper.OpenLocalPort(&lp) </del> <ins> socket, err := proxier.portMapper.OpenLocalPort(&lp, isIPv6) </ins> if err != nil { klog.Errorf("can't open %s, skipping this nodePort: %v", lp.String(), err) continue
buf.WriteByte('n') } <del> func openLocalPort(lp *utilproxy.LocalPort) (utilproxy.Closeable, error) { </del> <ins> func openLocalPort(lp *utilproxy.LocalPort, isIPv6 bool) (utilproxy.Closeable, error) { </ins> // For ports on node IPs, open the actual port and hold it, even though we // use iptables to redirect traffic. // This ensures a) that it's safe to use that port and b) that (a) stays
klog.V(4).Infof("Port %s was open before and is still needed", lp.String()) replacementPortsMap[lp] = proxier.portsMap[lp] } else { <del> socket, err := proxier.portMapper.OpenLocalPort(&lp) </del> <ins> socket, err := proxier.portMapper.OpenLocalPort(&lp, isIPv6) </ins> if err != nil { msg := fmt.Sprintf("can't open %s, skipping this externalIP: %v", lp.String(), err)
// We do not start listening on SCTP ports, according to our agreement in the // SCTP support KEP } else if svcInfo.Protocol() != v1.ProtocolSCTP { <del> socket, err := proxier.portMapper.OpenLocalPort(&lp) </del> <ins> socket, err := proxier.portMapper.OpenLocalPort(&lp, isIPv6) </ins> if err != nil { klog.Errorf("can't open %s, skipping this nodePort: %v", lp.String(), err) continue } if lp.Protocol == "udp" { <del> isIPv6 := utilnet.IsIPv6(svcInfo.ClusterIP()) </del> conntrack.ClearEntriesForPort(proxier.exec, lp.Port, isIPv6, v1.ProtocolUDP) } replacementPortsMap[lp] = socket
type listenPortOpener struct{} // OpenLocalPort holds the given local port open. <del> func (l *listenPortOpener) OpenLocalPort(lp *utilproxy.LocalPort) (utilproxy.Closeable, error) { return openLocalPort(lp) </del> <ins> func (l *listenPortOpener) OpenLocalPort(lp *utilproxy.LocalPort, isIPv6 bool) (utilproxy.Closeable, error) { return openLocalPort(lp, isIPv6) </ins> } <del> func openLocalPort(lp *utilproxy.LocalPort) (utilproxy.Closeable, error) { </del> <ins> func openLocalPort(lp *utilproxy.LocalPort, isIPv6 bool) (utilproxy.Closeable, error) { </ins> // For ports on node IPs, open the actual port and hold it, even though we // use ipvs to redirect traffic. // This ensures a) that it's safe to use that port and b) that (a) stays
var socket utilproxy.Closeable switch lp.Protocol { case "tcp": <del> listener, err := net.Listen("tcp", net.JoinHostPort(lp.IP, strconv.Itoa(lp.Port))) </del> <ins> network := "tcp4" if isIPv6 { network = "tcp6" } listener, err := net.Listen(network, net.JoinHostPort(lp.IP, strconv.Itoa(lp.Port))) </ins> if err != nil { return nil, err } socket = listener case "udp": <del> addr, err := net.ResolveUDPAddr("udp", net.JoinHostPort(lp.IP, strconv.Itoa(lp.Port))) </del> <ins> network := "udp4" if isIPv6 { network = "udp6" } addr, err := net.ResolveUDPAddr(network, net.JoinHostPort(lp.IP, strconv.Itoa(lp.Port))) </ins> if err != nil { return nil, err } <del> conn, err := net.ListenUDP("udp", addr) </del> <ins> conn, err := net.ListenUDP(network, addr) </ins> if err != nil { return nil, err }
// OpenLocalPort fakes out the listen() and bind() used by syncProxyRules // to lock a local port. <del> func (f *fakePortOpener) OpenLocalPort(lp *utilproxy.LocalPort) (utilproxy.Closeable, error) { </del> <ins> func (f *fakePortOpener) OpenLocalPort(lp *utilproxy.LocalPort, isIPv6 bool) (utilproxy.Closeable, error) { </ins> f.openPorts = append(f.openPorts, lp) return nil, nil }
// PortOpener is an interface around port opening/closing. // Abstracted out for testing. type PortOpener interface { <del> OpenLocalPort(lp *LocalPort) (Closeable, error) </del> <ins> OpenLocalPort(lp *LocalPort, isIPv6 bool) (Closeable, error) </ins> } // RevertPorts is closing ports in replacementPortsMap but not in originalPortsMap. In other words, it only
Request Headers: {% for i, key in ipairs(keys) do %} <del> {{key}}={{headers[key]}} </del> <ins> {% local val = headers[key] %} {% if type(val) == "table" then %} {% for i = 1,#val do %} {{key}}={{val[i]}} {% end %} {% else %} {{key}}={{val}} {% end %} </ins> {% end %} Request Body:
if err != nil { return nil, err } <del> if existsPip { return &pip, nil } </del> serviceName := getServiceName(service) <del> if shouldPIPExisted { return nil, fmt.Errorf("PublicIP from annotation azure-pip-name=%s for service %s doesn't exist", pipName, serviceName) } pip.Name = to.StringPtr(pipName) pip.Location = to.StringPtr(az.Location) pip.PublicIPAddressPropertiesFormat = &network.PublicIPAddressPropertiesFormat{ PublicIPAllocationMethod: network.Static, </del> <ins> if existsPip { // return if pip exist and dns label is the same if getDomainNameLabel(&pip) == domainNameLabel { return &pip, nil } klog.V(2).Infof("ensurePublicIPExists for service(%s): pip(%s) - updating", serviceName, *pip.Name) if pip.PublicIPAddressPropertiesFormat == nil { pip.PublicIPAddressPropertiesFormat = &network.PublicIPAddressPropertiesFormat{ PublicIPAllocationMethod: network.Static, } } } else { if shouldPIPExisted { return nil, fmt.Errorf("PublicIP from annotation azure-pip-name=%s for service %s doesn't exist", pipName, serviceName) } pip.Name = to.StringPtr(pipName) pip.Location = to.StringPtr(az.Location) pip.PublicIPAddressPropertiesFormat = &network.PublicIPAddressPropertiesFormat{ PublicIPAllocationMethod: network.Static, } pip.Tags = map[string]*string{ serviceTagKey:  &serviceName, clusterNameKey: &clusterName, } if az.useStandardLoadBalancer() { pip.Sku = &network.PublicIPAddressSku{ Name: network.PublicIPAddressSkuNameStandard, } } klog.V(2).Infof("ensurePublicIPExists for service(%s): pip(%s) - creating", serviceName, *pip.Name) </ins> } <del> if len(domainNameLabel) > 0 { </del> <ins> if len(domainNameLabel) == 0 { pip.PublicIPAddressPropertiesFormat.DNSSettings = nil } else { </ins> pip.PublicIPAddressPropertiesFormat.DNSSettings = &network.PublicIPAddressDNSSettings{ DomainNameLabel: &domainNameLabel, } } <del> pip.Tags = map[string]*string{ serviceTagKey:  &serviceName, clusterNameKey: &clusterName, } if az.useStandardLoadBalancer() { pip.Sku = &network.PublicIPAddressSku{ Name: network.PublicIPAddressSkuNameStandard, } } klog.V(2).Infof("ensurePublicIPExists for service(%s): pip(%s) - creating", serviceName, *pip.Name) </del> klog.V(10).Infof("CreateOrUpdatePIP(%s, %q): start", pipResourceGroup, *pip.Name) err = az.CreateOrUpdatePIP(service, pipResourceGroup, pip) if err != nil { <del> klog.V(2).Infof("ensure(%s) abort backoff: pip(%s) - creating", serviceName, *pip.Name) </del> <ins> klog.V(2).Infof("ensure(%s) abort backoff: pip(%s)", serviceName, *pip.Name) </ins> return nil, err } klog.V(10).Infof("CreateOrUpdatePIP(%s, %q): end", pipResourceGroup, *pip.Name)
return &pip, nil } <ins> func getDomainNameLabel(pip *network.PublicIPAddress) string { if pip == nil || pip.PublicIPAddressPropertiesFormat == nil || pip.PublicIPAddressPropertiesFormat.DNSSettings == nil { return "" } return to.String(pip.PublicIPAddressPropertiesFormat.DNSSettings.DomainNameLabel) } </ins> func getIdleTimeout(s *v1.Service) (*int32, error) { const ( min = 4
expectedID: "/subscriptions/subscription/resourceGroups/rg/providers/" + "Microsoft.Network/publicIPAddresses/pip1", }, <ins> { desc: "ensurePublicIPExists shall update existed PIP's dns label", existingPIPs: []network.PublicIPAddress{{ Name: to.StringPtr("pip1"), PublicIPAddressPropertiesFormat: &network.PublicIPAddressPropertiesFormat{ DNSSettings: &network.PublicIPAddressDNSSettings{ DomainNameLabel: to.StringPtr("previousdns"), }, }, }}, expectedPIP: &network.PublicIPAddress{ Name: to.StringPtr("pip1"), ID: to.StringPtr("/subscriptions/subscription/resourceGroups/rg" + "/providers/Microsoft.Network/publicIPAddresses/pip1"), PublicIPAddressPropertiesFormat: &network.PublicIPAddressPropertiesFormat{ DNSSettings: &network.PublicIPAddressDNSSettings{ DomainNameLabel: to.StringPtr("newdns"), }, }, }, expectedDNS: "newdns", }, </ins> } for i, test := range testCases {
t.Fatalf("TestCase[%d] meets unexpected error: %v", i, err) } } <del> pip, err := az.ensurePublicIPExists(&service, "pip1", "", "", false) </del> <ins> pip, err := az.ensurePublicIPExists(&service, "pip1", test.expectedDNS, "", false) </ins> if test.expectedID != "" { assert.Equal(t, test.expectedID, to.String(pip.ID), "TestCase[%d]: %s", i, test.desc) } else {
maxReadLength      = 10 * 1 << 20 // 10MB ) <del> var containerRegistryUrls = []string{"*.azurecr.io", "*.azurecr.cn", "*.azurecr.de", "*.azurecr.us"} </del> <ins> var ( containerRegistryUrls = []string{"*.azurecr.io", "*.azurecr.cn", "*.azurecr.de", "*.azurecr.us"} acrRE                 = regexp.MustCompile(`.*.azurecr.io|.*.azurecr.cn|.*.azurecr.de|.*.azurecr.us`) ) </ins> // init registers the various means by which credentials may // be resolved on Azure.
} func (a *acrProvider) Provide(image string) credentialprovider.DockerConfig { <ins> klog.V(4).Infof("try to provide secret for image %s", image) </ins> cfg := credentialprovider.DockerConfig{} <del> ctx, cancel := getContextWithCancel() defer cancel() </del> if a.config.UseManagedIdentityExtension { <del> klog.V(4).Infof("listing registries") result, err := a.registryClient.List(ctx) if err != nil { klog.Errorf("Failed to list registries: %v", err) return cfg } for ix := range result { loginServer := getLoginServer(result[ix]) klog.V(2).Infof("loginServer: %s", loginServer) cred, err := getACRDockerEntryFromARMToken(a, loginServer) if err != nil { continue </del> <ins> if loginServer := parseACRLoginServerFromImage(image); loginServer == "" { klog.V(4).Infof("image(%s) is not from ACR, skip MSI authentication", image) } else { if cred, err := getACRDockerEntryFromARMToken(a, loginServer); err == nil { cfg[loginServer] = *cred </ins> } <del> cfg[loginServer] = *cred </del> } } else { // Add our entry for each of the supported container registry URLs
} func getACRDockerEntryFromARMToken(a *acrProvider, loginServer string) (*credentialprovider.DockerConfigEntry, error) { <ins> // Run EnsureFresh to make sure the token is valid and does not expire if err := a.servicePrincipalToken.EnsureFresh(); err != nil { klog.Errorf("Failed to ensure fresh service principal token: %v", err) return nil, err } </ins> armAccessToken := a.servicePrincipalToken.OAuthToken() klog.V(4).Infof("discovering auth redirects for: %s", loginServer)
}, nil } <ins> // parseACRLoginServerFromImage takes image as parameter and returns login server of it. // Parameter `image` is expected in following format: foo.azurecr.io/bar/imageName:version // If the provided image is not an acr image, this function will return an empty string. func parseACRLoginServerFromImage(image string) string { match := acrRE.FindAllString(image, -1) if len(match) == 1 { return match[0] } return "" } </ins> func (a *acrProvider) LazyProvide(image string) *credentialprovider.DockerConfigEntry { return nil }
} } } <ins> func TestParseACRLoginServerFromImage(t *testing.T) { tests := []struct { image    string expected string }{ { image:    "invalidImage", expected: "", }, { image:    "docker.io/library/busybox:latest", expected: "", }, { image:    "foo.azurecr.io/bar/image:version", expected: "foo.azurecr.io", }, { image:    "foo.azurecr.cn/bar/image:version", expected: "foo.azurecr.cn", }, { image:    "foo.azurecr.de/bar/image:version", expected: "foo.azurecr.de", }, { image:    "foo.azurecr.us/bar/image:version", expected: "foo.azurecr.us", }, } for _, test := range tests { if loginServer := parseACRLoginServerFromImage(test.image); loginServer != test.expected { t.Errorf("function parseACRLoginServerFromImage returns "%s" for image %s, expected "%s"", loginServer, test.image, test.expected) } } } </ins>
// GetLoadBalancerName retrieves the name of the LoadBalancer. func (cs *CSCloud) GetLoadBalancerName(ctx context.Context, clusterName string, service *v1.Service) string { <del> return cs.GetLoadBalancerName(ctx, clusterName, service) </del> <ins> return cloudprovider.DefaultLoadBalancerName(service) </ins> } // getLoadBalancer retrieves the IP address and ID and all the existing rules it can find.
"//pkg/api/legacyscheme:go_default_library", "//pkg/apis/core:go_default_library", "//pkg/capabilities:go_default_library", <del> "//pkg/client/chaosclient:go_default_library", </del> "//pkg/cloudprovider:go_default_library", "//pkg/cloudprovider/providers:go_default_library", "//pkg/credentialprovider:go_default_library",
"k8s.io/kubernetes/pkg/api/legacyscheme" api "k8s.io/kubernetes/pkg/apis/core" "k8s.io/kubernetes/pkg/capabilities" <del> "k8s.io/kubernetes/pkg/client/chaosclient" </del> "k8s.io/kubernetes/pkg/cloudprovider" "k8s.io/kubernetes/pkg/credentialprovider" "k8s.io/kubernetes/pkg/features"
clientConfig.QPS = float32(s.KubeAPIQPS) clientConfig.Burst = int(s.KubeAPIBurst) <del> addChaosToClientConfig(s, clientConfig) </del> return clientConfig, nil } <del> // addChaosToClientConfig injects random errors into client connections if configured. func addChaosToClientConfig(s *options.KubeletServer, config *restclient.Config) { if s.ChaosChance != 0.0 { config.WrapTransport = func(rt http.RoundTripper) http.RoundTripper { seed := chaosclient.NewSeed(1) // TODO: introduce a standard chaos package with more tunables - this is just a proof of concept // TODO: introduce random latency and stalls return chaosclient.NewChaosRoundTripper(rt, chaosclient.LogChaos, seed.P(s.ChaosChance, chaosclient.ErrSimulatedConnectionResetByPeer)) } } } </del> // RunKubelet is responsible for setting up and running a kubelet.  It is used in three different applications: //   1 Integration tests //   2 Kubelet binary
"//pkg/auth/authorizer/abac:all-srcs", "//pkg/auth/nodeidentifier:all-srcs", "//pkg/capabilities:all-srcs", <del> "//pkg/client/chaosclient:all-srcs", </del> "//pkg/client/clientset_generated/internalclientset:all-srcs", "//pkg/client/conditions:all-srcs", "//pkg/client/informers/informers_generated/internalversion:all-srcs",
<del> package(default_visibility = ["//visibility:public"]) load( "@io_bazel_rules_go//go:def.bzl", "go_library", "go_test", ) go_library( name = "go_default_library", srcs = ["chaosclient.go"], importpath = "k8s.io/kubernetes/pkg/client/chaosclient", deps = ["//staging/src/k8s.io/apimachinery/pkg/util/net:go_default_library"], ) go_test( name = "go_default_test", srcs = ["chaosclient_test.go"], embed = [":go_default_library"], ) filegroup( name = "package-srcs", srcs = glob(["**"]), tags = ["automanaged"], visibility = ["//visibility:private"], ) filegroup( name = "all-srcs", srcs = [":package-srcs"], tags = ["automanaged"], ) </del>
<del> /* Copyright 2015 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package chaosclient import ( "net/http" "net/http/httptest" "net/url" "testing" ) type TestLogChaos struct { *testing.T } func (t TestLogChaos) OnChaos(req *http.Request, c Chaos) { t.Logf("CHAOS: chaotic behavior for %s %s: %v", req.Method, req.URL.String(), c) } func unwrapURLError(err error) error { if urlErr, ok := err.(*url.Error); ok && urlErr != nil { return urlErr.Err } return err } func TestChaos(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) })) defer server.Close() client := http.Client{ Transport: NewChaosRoundTripper(http.DefaultTransport, TestLogChaos{t}, ErrSimulatedConnectionResetByPeer), } resp, err := client.Get(server.URL) if unwrapURLError(err) != ErrSimulatedConnectionResetByPeer.error { t.Fatalf("expected reset by peer: %v", err) } if resp != nil { t.Fatalf("expected no response object: %#v", resp) } } func TestPartialChaos(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) })) defer server.Close() seed := NewSeed(1) client := http.Client{ Transport: NewChaosRoundTripper( http.DefaultTransport, TestLogChaos{t}, seed.P(0.5, ErrSimulatedConnectionResetByPeer), ), } success, fail := 0, 0 for { _, err := client.Get(server.URL) if err != nil { fail++ } else { success++ } if success > 1 && fail > 1 { break } } } </del>
k8s.io/kubernetes/pkg/apis/rbac/validation,erictune,0, k8s.io/kubernetes/pkg/apis/storage/validation,caesarxuchao,1, k8s.io/kubernetes/pkg/auth/authorizer/abac,liggitt,0, <del> k8s.io/kubernetes/pkg/client/chaosclient,deads2k,1, </del> k8s.io/kubernetes/pkg/client/legacylisters,jsafrane,1, k8s.io/kubernetes/pkg/client/listers/batch/internalversion,mqliang,0, k8s.io/kubernetes/pkg/client/listers/extensions/internalversion,eparis,1,
// must unmounted prior to detach. // If a volume with the name volumeName does not exist in the list of // attached volumes, an error is returned. <del> SetVolumeGloballyMounted(volumeName v1.UniqueVolumeName, globallyMounted bool) error </del> <ins> SetVolumeGloballyMounted(volumeName v1.UniqueVolumeName, globallyMounted bool, devicePath string) error </ins> // DeletePodFromVolume removes the given pod from the given volume in the // cache indicating the volume has been successfully unmounted from the pod.
} func (asw *actualStateOfWorld) MarkDeviceAsMounted( <del> volumeName v1.UniqueVolumeName) error { return asw.SetVolumeGloballyMounted(volumeName, true /* globallyMounted */) </del> <ins> volumeName v1.UniqueVolumeName, devicePath string) error { return asw.SetVolumeGloballyMounted(volumeName, true /* globallyMounted */, devicePath) </ins> } func (asw *actualStateOfWorld) MarkDeviceAsUnmounted( volumeName v1.UniqueVolumeName) error { <del> return asw.SetVolumeGloballyMounted(volumeName, false /* globallyMounted */) </del> <ins> return asw.SetVolumeGloballyMounted(volumeName, false /* globallyMounted */, "" /*devicePath*/) </ins> } // addVolume adds the given volume to the cache indicating the specified
continue } if volume.pluginIsAttachable { <del> err = rc.actualStateOfWorld.MarkDeviceAsMounted(volume.volumeName) </del> <ins> err = rc.actualStateOfWorld.MarkDeviceAsMounted(volume.volumeName, volume.devicePath) </ins> if err != nil { glog.Errorf("Could not mark device is mounted to actual state of world: %v", err) continue
MarkVolumeAsUnmounted(podName volumetypes.UniquePodName, volumeName v1.UniqueVolumeName) error // Marks the specified volume as having been globally mounted. <del> MarkDeviceAsMounted(volumeName v1.UniqueVolumeName) error </del> <ins> MarkDeviceAsMounted(volumeName v1.UniqueVolumeName, devicePath string) error </ins> // Marks the specified volume as having its global mount unmounted. MarkDeviceAsUnmounted(volumeName v1.UniqueVolumeName) error
// Update actual state of world to reflect volume is globally mounted markDeviceMountedErr := actualStateOfWorld.MarkDeviceAsMounted( <del> volumeToMount.VolumeName) </del> <ins> volumeToMount.VolumeName, devicePath) </ins> if markDeviceMountedErr != nil { // On failure, return error. Caller will log and retry. return volumeToMount.GenerateErrorDetailed("MountVolume.MarkDeviceAsMounted failed", markDeviceMountedErr)
// Update actual state of world to reflect volume is globally mounted markDeviceMappedErr := actualStateOfWorld.MarkDeviceAsMounted( <del> volumeToMount.VolumeName) </del> <ins> volumeToMount.VolumeName, devicePath) </ins> if markDeviceMappedErr != nil { // On failure, return error. Caller will log and retry. return volumeToMount.GenerateErrorDetailed("MapVolume.MarkDeviceAsMounted failed", markDeviceMappedErr)