- Fix bug not fetching disk path in pool configuration when disk is unavailable (plugged off)
This commit is contained in:
		
							parent
							
								
									89e00d6218
								
							
						
					
					
						commit
						fa91900915
					
				
							
								
								
									
										4
									
								
								zpool.go
								
								
								
								
							
							
						
						
									
										4
									
								
								zpool.go
								
								
								
								
							| 
						 | 
					@ -210,13 +210,13 @@ func poolGetConfig(name string, nv C.nvlist_ptr) (vdevs VDevTree, err error) {
 | 
				
			||||||
	// Fetch the children
 | 
						// Fetch the children
 | 
				
			||||||
	if C.nvlist_lookup_nvlist_array(nv, C.sZPOOL_CONFIG_CHILDREN,
 | 
						if C.nvlist_lookup_nvlist_array(nv, C.sZPOOL_CONFIG_CHILDREN,
 | 
				
			||||||
		unsafe.Pointer(&child), &children) != 0 {
 | 
							unsafe.Pointer(&child), &children) != 0 {
 | 
				
			||||||
		return
 | 
							children = 0
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if children > 0 {
 | 
						if children > 0 {
 | 
				
			||||||
		vdevs.Devices = make([]VDevTree, 0, children)
 | 
							vdevs.Devices = make([]VDevTree, 0, children)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if C.nvlist_lookup_uint64(nv, C.sZPOOL_CONFIG_NOT_PRESENT,
 | 
						if C.nvlist_lookup_uint64(nv, C.sZPOOL_CONFIG_NOT_PRESENT,
 | 
				
			||||||
		¬present) == 0 {
 | 
							¬present) == 0 || notpresent != 0 {
 | 
				
			||||||
		var path C.char_ptr
 | 
							var path C.char_ptr
 | 
				
			||||||
		if 0 != C.nvlist_lookup_string(nv, C.sZPOOL_CONFIG_PATH, unsafe.Pointer(&path)) {
 | 
							if 0 != C.nvlist_lookup_string(nv, C.sZPOOL_CONFIG_PATH, unsafe.Pointer(&path)) {
 | 
				
			||||||
			err = fmt.Errorf("Failed to fetch %s", C.ZPOOL_CONFIG_PATH)
 | 
								err = fmt.Errorf("Failed to fetch %s", C.ZPOOL_CONFIG_PATH)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue