mirror of
				https://github.com/kata-containers/kata-containers.git
				synced 2025-10-31 09:26:52 +00:00 
			
		
		
		
	clh: refactor image / initrd configuration set
This is a small code refactor removing a deadcode based the checks already done in the generic hypervisor abstraction. Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
		| @@ -289,11 +289,6 @@ func (clh *cloudHypervisor) CreateVM(ctx context.Context, id string, network Net | |||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	initrdPath, err := clh.config.InitrdAssetPath() |  | ||||||
| 	if err != nil { |  | ||||||
| 		return err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if imagePath != "" { | 	if imagePath != "" { | ||||||
| 		pmem := chclient.NewPmemConfig(imagePath) | 		pmem := chclient.NewPmemConfig(imagePath) | ||||||
| 		*pmem.DiscardWrites = true | 		*pmem.DiscardWrites = true | ||||||
| @@ -303,12 +298,15 @@ func (clh *cloudHypervisor) CreateVM(ctx context.Context, id string, network Net | |||||||
| 		} else { | 		} else { | ||||||
| 			clh.vmconfig.Pmem = &[]chclient.PmemConfig{*pmem} | 			clh.vmconfig.Pmem = &[]chclient.PmemConfig{*pmem} | ||||||
| 		} | 		} | ||||||
| 	} else if initrdPath != "" { | 	} else { | ||||||
|  | 		initrdPath, err := clh.config.InitrdAssetPath() | ||||||
|  | 		if err != nil { | ||||||
|  | 			return err | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		initrd := chclient.NewInitramfsConfig(initrdPath) | 		initrd := chclient.NewInitramfsConfig(initrdPath) | ||||||
|  |  | ||||||
| 		clh.vmconfig.SetInitramfs(*initrd) | 		clh.vmconfig.SetInitramfs(*initrd) | ||||||
| 	} else { |  | ||||||
| 		return errors.New("no image or initrd specified") |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// Use serial port as the guest console only in debug mode, | 	// Use serial port as the guest console only in debug mode, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user