Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions cmd/limactl/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,9 @@ func diskDeleteAction(cmd *cobra.Command, args []string) error {
}
var refInstances []string
for _, inst := range instances {
if len(inst.AdditionalDisks) > 0 {
for _, d := range inst.AdditionalDisks {
if d.Name == diskName {
refInstances = append(refInstances, inst.Name)
}
for _, d := range inst.AdditionalDisks {
if d.Name == diskName {
refInstances = append(refInstances, inst.Name)
}
}
}
Expand Down
14 changes: 6 additions & 8 deletions pkg/osutil/dns_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ func DNSAddresses() ([]string, error) {
return nil, err
}
var addresses []string
if len(nwData) > 0 {
// Return DNS addresses from the first interface that has an IPv4 address.
// The networks are in service order already.
for _, nw := range nwData {
if len(nw.IPv4.Addresses) > 0 {
addresses = nw.DNS.ServerAddresses
break
}
// Return DNS addresses from the first interface that has an IPv4 address.
// The networks are in service order already.
for _, nw := range nwData {
if len(nw.IPv4.Addresses) > 0 {
addresses = nw.DNS.ServerAddresses
break
}
}
return addresses, nil
Expand Down
44 changes: 21 additions & 23 deletions pkg/qemu/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,35 +634,33 @@ func Cmdline(ctx context.Context, cfg Config) (exe string, args []string, err er
baseDisk := filepath.Join(cfg.InstanceDir, filenames.BaseDisk)
diffDisk := filepath.Join(cfg.InstanceDir, filenames.DiffDisk)
extraDisks := []string{}
if len(y.AdditionalDisks) > 0 {
for _, d := range y.AdditionalDisks {
diskName := d.Name
disk, err := store.InspectDisk(diskName)
if err != nil {
logrus.Errorf("could not load disk %q: %q", diskName, err)
return "", nil, err
}
for _, d := range y.AdditionalDisks {
diskName := d.Name
disk, err := store.InspectDisk(diskName)
if err != nil {
logrus.Errorf("could not load disk %q: %q", diskName, err)
return "", nil, err
}

if disk.Instance != "" {
if disk.InstanceDir != cfg.InstanceDir {
logrus.Errorf("could not attach disk %q, in use by instance %q", diskName, disk.Instance)
return "", nil, err
}
err = disk.Unlock()
if err != nil {
logrus.Errorf("could not unlock disk %q to reuse in the same instance %q", diskName, cfg.Name)
return "", nil, err
}
if disk.Instance != "" {
if disk.InstanceDir != cfg.InstanceDir {
logrus.Errorf("could not attach disk %q, in use by instance %q", diskName, disk.Instance)
return "", nil, err
}
logrus.Infof("Mounting disk %q on %q", diskName, disk.MountPoint)
err = disk.Lock(cfg.InstanceDir)
err = disk.Unlock()
if err != nil {
logrus.Errorf("could not lock disk %q: %q", diskName, err)
logrus.Errorf("could not unlock disk %q to reuse in the same instance %q", diskName, cfg.Name)
return "", nil, err
}
dataDisk := filepath.Join(disk.Dir, filenames.DataDisk)
extraDisks = append(extraDisks, dataDisk)
}
logrus.Infof("Mounting disk %q on %q", diskName, disk.MountPoint)
err = disk.Lock(cfg.InstanceDir)
if err != nil {
logrus.Errorf("could not lock disk %q: %q", diskName, err)
return "", nil, err
}
dataDisk := filepath.Join(disk.Dir, filenames.DataDisk)
extraDisks = append(extraDisks, dataDisk)
}

isBaseDiskCDROM, err := iso9660util.IsISO9660(baseDisk)
Expand Down
Loading