From 36fb44655de2ba35d3278f1a82fb799b684a49bc Mon Sep 17 00:00:00 2001 From: Liran Rotenberg Date: Mon, 27 May 2024 11:39:40 +0300 Subject: [PATCH 1/9] Revert "don't get static ips for non-windows" This reverts commit a6744706c5b0eac4746c27b78495a7caff84c4b0. Signed-off-by: Liran Rotenberg --- pkg/controller/plan/adapter/vsphere/builder.go | 10 +--------- pkg/controller/plan/adapter/vsphere/builder_test.go | 10 ++++------ pkg/controller/plan/adapter/vsphere/validator.go | 4 ---- pkg/controller/plan/adapter/vsphere/validator_test.go | 7 +------ 4 files changed, 6 insertions(+), 25 deletions(-) diff --git a/pkg/controller/plan/adapter/vsphere/builder.go b/pkg/controller/plan/adapter/vsphere/builder.go index e71d5cc94..548591dcf 100644 --- a/pkg/controller/plan/adapter/vsphere/builder.go +++ b/pkg/controller/plan/adapter/vsphere/builder.go @@ -66,7 +66,6 @@ const ( DefaultWindows = "win10" DefaultLinux = "rhel8.1" Unknown = "unknown" - WindowsPrefix = "win" ) // Annotations @@ -225,9 +224,6 @@ func (r *Builder) PodEnvironment(vmRef ref.Ref, sourceSecret *core.Secret) (env } func (r *Builder) mapMacStaticIps(vm *model.VM) string { - if !isWindows(vm) { - return "" - } configurations := []string{} for _, guestNetwork := range vm.GuestNetworks { if guestNetwork.Origin == string(types.NetIpConfigInfoIpAddressOriginManual) { @@ -237,10 +233,6 @@ func (r *Builder) mapMacStaticIps(vm *model.VM) string { return strings.Join(configurations, "_") } -func isWindows(vm *model.VM) bool { - return strings.Contains(vm.GuestID, WindowsPrefix) || strings.Contains(vm.GuestName, WindowsPrefix) -} - func (r *Builder) getSourceDetails(vm *model.VM, sourceSecret *core.Secret) (libvirtURL liburl.URL, fingerprint string, err error) { host, err := r.host(vm.Host) if err != nil { @@ -729,7 +721,7 @@ func (r *Builder) TemplateLabels(vmRef ref.Ref) (labels map[string]string, err e os = osMap[vm.GuestID] } else if strings.Contains(vm.GuestName, "linux") || strings.Contains(vm.GuestName, "rhel") { os = DefaultLinux - } else if strings.Contains(vm.GuestName, WindowsPrefix) { + } else if strings.Contains(vm.GuestName, "win") { os = DefaultWindows } else { os = Unknown diff --git a/pkg/controller/plan/adapter/vsphere/builder_test.go b/pkg/controller/plan/adapter/vsphere/builder_test.go index 571861b0a..690ce10fd 100644 --- a/pkg/controller/plan/adapter/vsphere/builder_test.go +++ b/pkg/controller/plan/adapter/vsphere/builder_test.go @@ -23,9 +23,9 @@ var _ = Describe("vSphere builder", func() { DescribeTable("should", func(vm *model.VM, outputMap string) { Expect(builder.mapMacStaticIps(vm)).Should(Equal(outputMap)) }, - Entry("no static ips", &model.VM{GuestID: "windows9Guest"}, ""), - Entry("single static ip", &model.VM{GuestID: "windows9Guest", GuestNetworks: []vsphere.GuestNetwork{{MAC: "00:50:56:83:25:47", IP: "172.29.3.193", Origin: ManualOrigin}}}, "00:50:56:83:25:47:ip:172.29.3.193"), - Entry("multiple static ips", &model.VM{GuestID: "windows9Guest", GuestNetworks: []vsphere.GuestNetwork{ + Entry("no static ips", &model.VM{}, ""), + Entry("single static ip", &model.VM{GuestNetworks: []vsphere.GuestNetwork{{MAC: "00:50:56:83:25:47", IP: "172.29.3.193", Origin: ManualOrigin}}}, "00:50:56:83:25:47:ip:172.29.3.193"), + Entry("multiple static ips", &model.VM{GuestNetworks: []vsphere.GuestNetwork{ { MAC: "00:50:56:83:25:47", IP: "172.29.3.193", @@ -38,9 +38,7 @@ var _ = Describe("vSphere builder", func() { }, }, }, "00:50:56:83:25:47:ip:172.29.3.193_00:50:56:83:25:47:ip:fe80::5da:b7a5:e0a2:a097"), - Entry("non-static ip", &model.VM{GuestID: "windows9Guest", GuestNetworks: []vsphere.GuestNetwork{{MAC: "00:50:56:83:25:47", IP: "172.29.3.193", Origin: string(types.NetIpConfigInfoIpAddressOriginDhcp)}}}, ""), - Entry("non windows vm", &model.VM{GuestID: "other", GuestNetworks: []vsphere.GuestNetwork{{MAC: "00:50:56:83:25:47", IP: "172.29.3.193", Origin: ManualOrigin}}}, ""), - Entry("no OS vm", &model.VM{GuestNetworks: []vsphere.GuestNetwork{{MAC: "00:50:56:83:25:47", IP: "172.29.3.193", Origin: ManualOrigin}}}, ""), + Entry("non-static ip", &model.VM{GuestNetworks: []vsphere.GuestNetwork{{MAC: "00:50:56:83:25:47", IP: "172.29.3.193", Origin: string(types.NetIpConfigInfoIpAddressOriginDhcp)}}}, ""), ) }) diff --git a/pkg/controller/plan/adapter/vsphere/validator.go b/pkg/controller/plan/adapter/vsphere/validator.go index f42911338..fefd40202 100644 --- a/pkg/controller/plan/adapter/vsphere/validator.go +++ b/pkg/controller/plan/adapter/vsphere/validator.go @@ -139,10 +139,6 @@ func (r *Validator) StaticIPs(vmRef ref.Ref) (ok bool, err error) { err = liberr.Wrap(err, "vm", vmRef) return } - if !isWindows(&vm.VM) { - return true, nil - } - for _, nic := range vm.NICs { found := false for _, guestNetwork := range vm.GuestNetworks { diff --git a/pkg/controller/plan/adapter/vsphere/validator_test.go b/pkg/controller/plan/adapter/vsphere/validator_test.go index f8d6989d1..6f082cd43 100644 --- a/pkg/controller/plan/adapter/vsphere/validator_test.go +++ b/pkg/controller/plan/adapter/vsphere/validator_test.go @@ -27,15 +27,11 @@ func (m *mockInventory) Find(resource interface{}, ref ref.Ref) error { }, GuestNetworks: []vsphere.GuestNetwork{ {MAC: "mac1"}, - }, - GuestID: "windows7Guest"}, + }}, } if ref.Name == "full_guest_network" { res.VM.GuestNetworks = append(res.VM.GuestNetworks, vsphere.GuestNetwork{MAC: "mac2"}) } - if ref.Name == "not_windows_guest" { - res.VM.GuestID = "rhel8_64Guest" - } } return nil } @@ -101,7 +97,6 @@ var _ = Describe("vsphere validation tests", func() { Entry("when the vm doesn't have static ips, and the plan set without static ip", "test", false, false), Entry("when the vm have static ips, and the plan set with static ip", "full_guest_network", true, false), Entry("when the vm have static ips, and the plan set without static ip", "test", false, false), - Entry("when the vm doesn't have static ips, and the plan set without static ip, vm is non-windows", "not_windows_guest", true, false), ) }) }) From 614de95d3b1c37fd421806d3b90fa814cbc5b2b6 Mon Sep 17 00:00:00 2001 From: Liran Rotenberg Date: Mon, 27 May 2024 11:39:59 +0300 Subject: [PATCH 2/9] Revert "make linter happy" This reverts commit 7302047b12af675847c84cb4a1cd28647671cfe0. Signed-off-by: Liran Rotenberg --- pkg/controller/plan/adapter/vsphere/builder_test.go | 1 - pkg/controller/plan/adapter/vsphere/validator_test.go | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/controller/plan/adapter/vsphere/builder_test.go b/pkg/controller/plan/adapter/vsphere/builder_test.go index 690ce10fd..5666b32b6 100644 --- a/pkg/controller/plan/adapter/vsphere/builder_test.go +++ b/pkg/controller/plan/adapter/vsphere/builder_test.go @@ -42,7 +42,6 @@ var _ = Describe("vSphere builder", func() { ) }) -//nolint:errcheck func createBuilder(objs ...runtime.Object) *Builder { scheme := runtime.NewScheme() _ = v1.AddToScheme(scheme) diff --git a/pkg/controller/plan/adapter/vsphere/validator_test.go b/pkg/controller/plan/adapter/vsphere/validator_test.go index 6f082cd43..3155a4305 100644 --- a/pkg/controller/plan/adapter/vsphere/validator_test.go +++ b/pkg/controller/plan/adapter/vsphere/validator_test.go @@ -1,4 +1,4 @@ -//nolint:nilnil +//nolint:errcheck package vsphere import ( From 0e463165a9068a228b3e50be7d40cc90cb5cfd7c Mon Sep 17 00:00:00 2001 From: Liran Rotenberg Date: Mon, 27 May 2024 11:40:09 +0300 Subject: [PATCH 3/9] Revert "Add unit tests for static ips builder" This reverts commit a9772deded2340f1ae1072fc0e565c04c9b54f26. Signed-off-by: Liran Rotenberg --- .../plan/adapter/vsphere/BUILD.bazel | 7 -- .../plan/adapter/vsphere/builder_test.go | 65 ------------------- .../adapter/vsphere/vsphere_suite_test.go | 2 +- 3 files changed, 1 insertion(+), 73 deletions(-) delete mode 100644 pkg/controller/plan/adapter/vsphere/builder_test.go diff --git a/pkg/controller/plan/adapter/vsphere/BUILD.bazel b/pkg/controller/plan/adapter/vsphere/BUILD.bazel index 74a5ba7e7..f4575a105 100644 --- a/pkg/controller/plan/adapter/vsphere/BUILD.bazel +++ b/pkg/controller/plan/adapter/vsphere/BUILD.bazel @@ -47,7 +47,6 @@ go_library( go_test( name = "vsphere_test", srcs = [ - "builder_test.go", "validator_test.go", "vsphere_suite_test.go", ], @@ -56,17 +55,11 @@ go_test( "//pkg/apis/forklift/v1beta1", "//pkg/apis/forklift/v1beta1/plan", "//pkg/apis/forklift/v1beta1/ref", - "//pkg/controller/plan/context", "//pkg/controller/provider/model/vsphere", "//pkg/controller/provider/web", "//pkg/controller/provider/web/vsphere", - "//pkg/lib/logging", "//vendor/github.com/onsi/ginkgo/v2:ginkgo", "//vendor/github.com/onsi/gomega", - "//vendor/github.com/vmware/govmomi/vim25/types", - "//vendor/k8s.io/api/apps/v1:apps", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:meta", - "//vendor/k8s.io/apimachinery/pkg/runtime", - "//vendor/sigs.k8s.io/controller-runtime/pkg/client/fake", ], ) diff --git a/pkg/controller/plan/adapter/vsphere/builder_test.go b/pkg/controller/plan/adapter/vsphere/builder_test.go deleted file mode 100644 index 5666b32b6..000000000 --- a/pkg/controller/plan/adapter/vsphere/builder_test.go +++ /dev/null @@ -1,65 +0,0 @@ -package vsphere - -import ( - v1beta1 "github.com/konveyor/forklift-controller/pkg/apis/forklift/v1beta1" - plancontext "github.com/konveyor/forklift-controller/pkg/controller/plan/context" - "github.com/konveyor/forklift-controller/pkg/controller/provider/model/vsphere" - model "github.com/konveyor/forklift-controller/pkg/controller/provider/web/vsphere" - "github.com/konveyor/forklift-controller/pkg/lib/logging" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "github.com/vmware/govmomi/vim25/types" - v1 "k8s.io/api/apps/v1" - "k8s.io/apimachinery/pkg/runtime" - "sigs.k8s.io/controller-runtime/pkg/client/fake" -) - -var builderLog = logging.WithName("vsphere-builder-test") - -const ManualOrigin = string(types.NetIpConfigInfoIpAddressOriginManual) - -var _ = Describe("vSphere builder", func() { - builder := createBuilder() - DescribeTable("should", func(vm *model.VM, outputMap string) { - Expect(builder.mapMacStaticIps(vm)).Should(Equal(outputMap)) - }, - Entry("no static ips", &model.VM{}, ""), - Entry("single static ip", &model.VM{GuestNetworks: []vsphere.GuestNetwork{{MAC: "00:50:56:83:25:47", IP: "172.29.3.193", Origin: ManualOrigin}}}, "00:50:56:83:25:47:ip:172.29.3.193"), - Entry("multiple static ips", &model.VM{GuestNetworks: []vsphere.GuestNetwork{ - { - MAC: "00:50:56:83:25:47", - IP: "172.29.3.193", - Origin: ManualOrigin, - }, - { - MAC: "00:50:56:83:25:47", - IP: "fe80::5da:b7a5:e0a2:a097", - Origin: ManualOrigin, - }, - }, - }, "00:50:56:83:25:47:ip:172.29.3.193_00:50:56:83:25:47:ip:fe80::5da:b7a5:e0a2:a097"), - Entry("non-static ip", &model.VM{GuestNetworks: []vsphere.GuestNetwork{{MAC: "00:50:56:83:25:47", IP: "172.29.3.193", Origin: string(types.NetIpConfigInfoIpAddressOriginDhcp)}}}, ""), - ) -}) - -func createBuilder(objs ...runtime.Object) *Builder { - scheme := runtime.NewScheme() - _ = v1.AddToScheme(scheme) - v1beta1.SchemeBuilder.AddToScheme(scheme) - client := fake.NewClientBuilder(). - WithScheme(scheme). - WithRuntimeObjects(objs...). - Build() - return &Builder{ - Context: &plancontext.Context{ - Destination: plancontext.Destination{ - Client: client, - }, - Plan: createPlan(), - Log: builderLog, - - // To make sure r.Scheme is not nil - Client: client, - }, - } -} diff --git a/pkg/controller/plan/adapter/vsphere/vsphere_suite_test.go b/pkg/controller/plan/adapter/vsphere/vsphere_suite_test.go index da4192991..631fde7b8 100644 --- a/pkg/controller/plan/adapter/vsphere/vsphere_suite_test.go +++ b/pkg/controller/plan/adapter/vsphere/vsphere_suite_test.go @@ -1,4 +1,4 @@ -package vsphere +package vsphere_test import ( "testing" From 3ddff07890ef15105ebcaacea2a520b954736c5a Mon Sep 17 00:00:00 2001 From: Liran Rotenberg Date: Mon, 27 May 2024 11:40:27 +0300 Subject: [PATCH 4/9] Revert "Add unit cases for virt-v2v command" This reverts commit ee69f9d60bde16d8e13adb6c2cdf1489d7799a49. Signed-off-by: Liran Rotenberg --- virt-v2v/cold/cold_test.go | 29 ------------- virt-v2v/cold/entrypoint.go | 85 +++++++++++++++++-------------------- 2 files changed, 39 insertions(+), 75 deletions(-) diff --git a/virt-v2v/cold/cold_test.go b/virt-v2v/cold/cold_test.go index b6ccc45c0..5d936fd00 100644 --- a/virt-v2v/cold/cold_test.go +++ b/virt-v2v/cold/cold_test.go @@ -1,7 +1,6 @@ package main import ( - "strings" "testing" ) @@ -28,31 +27,3 @@ func TestGenName(t *testing.T) { } } } - -func TestStaticIPs(t *testing.T) { - t.Setenv("V2V_source", vSphere) - t.Setenv("V2V_libvirtURL", "http://fake.com") - t.Setenv("V2V_secretKey", "fake") - t.Setenv("V2V_vmName", "test") - - cases := []struct { - inputConfig string - outputArgs []string - }{ - {"", []string{""}}, - {"00:50:56:83:25:47:ip:172.29.3.193", []string{"--mac 00:50:56:83:25:47:ip:172.29.3.193"}}, - {"00:50:56:83:25:47:ip:172.29.3.193_00:50:56:83:25:47:ip:fe80::5da:b7a5:e0a2:a097", []string{"--mac 00:50:56:83:25:47:ip:172.29.3.193", "--mac 00:50:56:83:25:47:ip:fe80::5da:b7a5:e0a2:a097"}}, - } - - for _, c := range cases { - if c.inputConfig != "" { - t.Setenv("V2V_staticIPs", c.inputConfig) - } - command := strings.Join(buildCommand(), " ") - for _, outputArg := range c.outputArgs { - if !strings.Contains(command, outputArg) { - t.Errorf("The command is: %s. Excpected to contain '%s'", command, outputArg) - } - } - } -} diff --git a/virt-v2v/cold/entrypoint.go b/virt-v2v/cold/entrypoint.go index 2a053b3f7..0b831b73f 100644 --- a/virt-v2v/cold/entrypoint.go +++ b/virt-v2v/cold/entrypoint.go @@ -32,51 +32,6 @@ var UEFI_RE = regexp.MustCompile(`(?i)UEFI\s+bootloader?`) var firmware = "bios" func main() { - source := os.Getenv("V2V_source") - if source == vSphere { - if _, err := os.Stat("/etc/secret/cacert"); err == nil { - // use the specified certificate - err = os.Symlink("/etc/secret/cacert", "/opt/ca-bundle.crt") - if err != nil { - fmt.Println("Error creating ca cert link ", err) - os.Exit(1) - } - } else { - // otherwise, keep system pool certificates - err := os.Symlink("/etc/pki/tls/certs/ca-bundle.crt.bak", "/opt/ca-bundle.crt") - if err != nil { - fmt.Println("Error creating ca cert link ", err) - os.Exit(1) - } - } - } - - if err := executeVirtV2v(source, buildCommand()); err != nil { - fmt.Println("Error executing virt-v2v command ", err) - os.Exit(1) - } - - if source == OVA { - var err error - xmlFilePath, err = getXMLFile(DIR, "xml") - if err != nil { - fmt.Println("Error gettin XML file:", err) - os.Exit(1) - } - - http.HandleFunc("/vm", vmHandler) - http.HandleFunc("/shutdown", shutdownHandler) - server = &http.Server{Addr: ":8080"} - - fmt.Println("Starting server on :8080") - if err := server.ListenAndServe(); err != http.ErrServerClosed { - fmt.Printf("Error starting server: %v\n", err) - os.Exit(1) - } - } -} - -func buildCommand() []string { virtV2vArgs := []string{"virt-v2v", "-v", "-x"} source := os.Getenv("V2V_source") @@ -121,6 +76,21 @@ func buildCommand() []string { } if source == vSphere { + if _, err := os.Stat("/etc/secret/cacert"); err == nil { + // use the specified certificate + err = os.Symlink("/etc/secret/cacert", "/opt/ca-bundle.crt") + if err != nil { + fmt.Println("Error creating ca cert link ", err) + os.Exit(1) + } + } else { + // otherwise, keep system pool certificates + err := os.Symlink("/etc/pki/tls/certs/ca-bundle.crt.bak", "/opt/ca-bundle.crt") + if err != nil { + fmt.Println("Error creating ca cert link ", err) + os.Exit(1) + } + } virtV2vArgs = append(virtV2vArgs, "-ip", "/etc/secret/secretKey") if envStaticIPs := os.Getenv("V2V_staticIPs"); envStaticIPs != "" { @@ -138,7 +108,30 @@ func buildCommand() []string { } virtV2vArgs = append(virtV2vArgs, "--", os.Getenv("V2V_vmName")) } - return virtV2vArgs + + if err := executeVirtV2v(source, virtV2vArgs); err != nil { + fmt.Println("Error executing virt-v2v command ", err) + os.Exit(1) + } + + if source == OVA { + var err error + xmlFilePath, err = getXMLFile(DIR, "xml") + if err != nil { + fmt.Println("Error gettin XML file:", err) + os.Exit(1) + } + + http.HandleFunc("/vm", vmHandler) + http.HandleFunc("/shutdown", shutdownHandler) + server = &http.Server{Addr: ":8080"} + + fmt.Println("Starting server on :8080") + if err := server.ListenAndServe(); err != http.ErrServerClosed { + fmt.Printf("Error starting server: %v\n", err) + os.Exit(1) + } + } } func checkEnvVariablesSet(envVars ...string) bool { From ccf11015adeef63a1612cc65cfe752a34a1cd63a Mon Sep 17 00:00:00 2001 From: Liran Rotenberg Date: Mon, 27 May 2024 11:40:41 +0300 Subject: [PATCH 5/9] Revert "Add unit tests to the validator" This reverts commit 9940b58324860b75fd3401008e9b5564a9b61921. Signed-off-by: Liran Rotenberg --- .../plan/adapter/vsphere/BUILD.bazel | 22 +--- .../plan/adapter/vsphere/validator_test.go | 115 ------------------ .../adapter/vsphere/vsphere_suite_test.go | 13 -- 3 files changed, 1 insertion(+), 149 deletions(-) delete mode 100644 pkg/controller/plan/adapter/vsphere/validator_test.go delete mode 100644 pkg/controller/plan/adapter/vsphere/vsphere_suite_test.go diff --git a/pkg/controller/plan/adapter/vsphere/BUILD.bazel b/pkg/controller/plan/adapter/vsphere/BUILD.bazel index f4575a105..d97841c5e 100644 --- a/pkg/controller/plan/adapter/vsphere/BUILD.bazel +++ b/pkg/controller/plan/adapter/vsphere/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") +load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "vsphere", @@ -43,23 +43,3 @@ go_library( "//vendor/sigs.k8s.io/controller-runtime/pkg/client", ], ) - -go_test( - name = "vsphere_test", - srcs = [ - "validator_test.go", - "vsphere_suite_test.go", - ], - embed = [":vsphere"], - deps = [ - "//pkg/apis/forklift/v1beta1", - "//pkg/apis/forklift/v1beta1/plan", - "//pkg/apis/forklift/v1beta1/ref", - "//pkg/controller/provider/model/vsphere", - "//pkg/controller/provider/web", - "//pkg/controller/provider/web/vsphere", - "//vendor/github.com/onsi/ginkgo/v2:ginkgo", - "//vendor/github.com/onsi/gomega", - "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:meta", - ], -) diff --git a/pkg/controller/plan/adapter/vsphere/validator_test.go b/pkg/controller/plan/adapter/vsphere/validator_test.go deleted file mode 100644 index 3155a4305..000000000 --- a/pkg/controller/plan/adapter/vsphere/validator_test.go +++ /dev/null @@ -1,115 +0,0 @@ -//nolint:errcheck -package vsphere - -import ( - v1beta1 "github.com/konveyor/forklift-controller/pkg/apis/forklift/v1beta1" - "github.com/konveyor/forklift-controller/pkg/apis/forklift/v1beta1/plan" - "github.com/konveyor/forklift-controller/pkg/apis/forklift/v1beta1/ref" - "github.com/konveyor/forklift-controller/pkg/controller/provider/model/vsphere" - "github.com/konveyor/forklift-controller/pkg/controller/provider/web" - model "github.com/konveyor/forklift-controller/pkg/controller/provider/web/vsphere" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// Mock inventory struct and methods for testing -type mockInventory struct{} - -func (m *mockInventory) Find(resource interface{}, ref ref.Ref) error { - switch res := resource.(type) { - case *model.Workload: - *res = model.Workload{ - VM: model.VM{ - NICs: []vsphere.NIC{ - {MAC: "mac1"}, - {MAC: "mac2"}, - }, - GuestNetworks: []vsphere.GuestNetwork{ - {MAC: "mac1"}, - }}, - } - if ref.Name == "full_guest_network" { - res.VM.GuestNetworks = append(res.VM.GuestNetworks, vsphere.GuestNetwork{MAC: "mac2"}) - } - } - return nil -} - -func (m *mockInventory) Finder() web.Finder { - return nil -} - -func (m *mockInventory) Get(resource interface{}, id string) error { - return nil -} - -func (m *mockInventory) Host(ref *ref.Ref) (interface{}, error) { - return nil, nil -} - -func (m *mockInventory) List(list interface{}, param ...web.Param) error { - return nil -} - -func (m *mockInventory) Network(ref *ref.Ref) (interface{}, error) { - return nil, nil -} - -func (m *mockInventory) Storage(ref *ref.Ref) (interface{}, error) { - return nil, nil -} - -func (m *mockInventory) VM(ref *ref.Ref) (interface{}, error) { - return nil, nil -} - -func (m *mockInventory) Watch(resource interface{}, h web.EventHandler) (*web.Watch, error) { - return nil, nil -} - -func (m *mockInventory) Workload(ref *ref.Ref) (interface{}, error) { - return nil, nil -} - -var _ = Describe("vsphere validation tests", func() { - Describe("validateStaticIPs", func() { - DescribeTable("should validate Static IPs correctly", - func(vmName string, staticIPs, shouldError bool) { - plan := createPlan() - plan.Spec.PreserveStaticIPs = staticIPs - validator := &Validator{ - plan: plan, - inventory: &mockInventory{}, - } - ok, err := validator.StaticIPs(ref.Ref{Name: vmName}) - if shouldError { - Expect(err).NotTo(HaveOccurred()) - Expect(ok).To(BeFalse()) - } else { - Expect(err).NotTo(HaveOccurred()) - Expect(ok).To(BeTrue()) - } - }, - - // Directly declare entries here - Entry("when the vm doesn't have static ips, and the plan set with static ip", "test", true, true), - Entry("when the vm doesn't have static ips, and the plan set without static ip", "test", false, false), - Entry("when the vm have static ips, and the plan set with static ip", "full_guest_network", true, false), - Entry("when the vm have static ips, and the plan set without static ip", "test", false, false), - ) - }) -}) - -func createPlan() *v1beta1.Plan { - return &v1beta1.Plan{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test", - Namespace: "test", - }, - Spec: v1beta1.PlanSpec{ - TargetNamespace: "test", - VMs: []plan.VM{{Ref: ref.Ref{Name: "test"}}}, - }, - } -} diff --git a/pkg/controller/plan/adapter/vsphere/vsphere_suite_test.go b/pkg/controller/plan/adapter/vsphere/vsphere_suite_test.go deleted file mode 100644 index 631fde7b8..000000000 --- a/pkg/controller/plan/adapter/vsphere/vsphere_suite_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package vsphere_test - -import ( - "testing" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" -) - -func TestVsphere(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "vSphere Suite") -} From d2157946d37e275f63815ecbc724ce3caa4fcf9e Mon Sep 17 00:00:00 2001 From: Liran Rotenberg Date: Mon, 27 May 2024 11:40:55 +0300 Subject: [PATCH 6/9] Revert "Validate the data we have for static IPs" This reverts commit 4919bc088d275dc85cfc4f5cb9b0cc680ad08565. Signed-off-by: Liran Rotenberg --- pkg/controller/plan/adapter/base/doc.go | 2 -- pkg/controller/plan/adapter/ocp/validator.go | 5 ---- .../plan/adapter/openstack/validator.go | 6 ----- pkg/controller/plan/adapter/ova/validator.go | 5 ---- .../plan/adapter/ovirt/validator.go | 6 ----- .../plan/adapter/vsphere/validator.go | 27 ------------------- pkg/controller/plan/controller.go | 6 ++--- pkg/controller/plan/validation.go | 20 -------------- pkg/lib/condition/condition.go | 9 ------- 9 files changed, 3 insertions(+), 83 deletions(-) diff --git a/pkg/controller/plan/adapter/base/doc.go b/pkg/controller/plan/adapter/base/doc.go index 395466171..bbeb4c0a2 100644 --- a/pkg/controller/plan/adapter/base/doc.go +++ b/pkg/controller/plan/adapter/base/doc.go @@ -135,8 +135,6 @@ type Validator interface { WarmMigration() bool // Validate that no more than one of a VM's networks is mapped to the pod network. PodNetwork(vmRef ref.Ref) (bool, error) - // Validate that we have information about static IPs for every virtual NIC - StaticIPs(vmRef ref.Ref) (bool, error) } // DestinationClient API. diff --git a/pkg/controller/plan/adapter/ocp/validator.go b/pkg/controller/plan/adapter/ocp/validator.go index 0e75cc2d1..970d4cb19 100644 --- a/pkg/controller/plan/adapter/ocp/validator.go +++ b/pkg/controller/plan/adapter/ocp/validator.go @@ -186,8 +186,3 @@ func (r *Validator) NetworksMapped(vmRef ref.Ref) (ok bool, err error) { func (r *Validator) DirectStorage(vmRef ref.Ref) (bool, error) { return true, nil } - -// NO-OP -func (r *Validator) StaticIPs(vmRef ref.Ref) (bool, error) { - return true, nil -} diff --git a/pkg/controller/plan/adapter/openstack/validator.go b/pkg/controller/plan/adapter/openstack/validator.go index 8c374eb16..7a0743f35 100644 --- a/pkg/controller/plan/adapter/openstack/validator.go +++ b/pkg/controller/plan/adapter/openstack/validator.go @@ -109,9 +109,3 @@ func (r *Validator) PodNetwork(vmRef ref.Ref) (ok bool, err error) { func (r *Validator) DirectStorage(vmRef ref.Ref) (bool, error) { return true, nil } - -// NO-OP -func (r *Validator) StaticIPs(vmRef ref.Ref) (bool, error) { - // the guest operating system is not modified during the migration so static IPs should be preserved - return true, nil -} diff --git a/pkg/controller/plan/adapter/ova/validator.go b/pkg/controller/plan/adapter/ova/validator.go index 9b0dd2204..ca361b6a5 100644 --- a/pkg/controller/plan/adapter/ova/validator.go +++ b/pkg/controller/plan/adapter/ova/validator.go @@ -100,8 +100,3 @@ func (r *Validator) MaintenanceMode(vmRef ref.Ref) (ok bool, err error) { func (r *Validator) DirectStorage(vmRef ref.Ref) (bool, error) { return true, nil } - -// NO-OP -func (r *Validator) StaticIPs(vmRef ref.Ref) (bool, error) { - return true, nil -} diff --git a/pkg/controller/plan/adapter/ovirt/validator.go b/pkg/controller/plan/adapter/ovirt/validator.go index 7a0a2517a..7f434290a 100644 --- a/pkg/controller/plan/adapter/ovirt/validator.go +++ b/pkg/controller/plan/adapter/ovirt/validator.go @@ -165,9 +165,3 @@ func (r *Validator) MaintenanceMode(_ ref.Ref) (ok bool, err error) { ok = true return } - -// NO-OP -func (r *Validator) StaticIPs(vmRef ref.Ref) (bool, error) { - // the guest operating system is not modified during the migration so static IPs should be preserved - return true, nil -} diff --git a/pkg/controller/plan/adapter/vsphere/validator.go b/pkg/controller/plan/adapter/vsphere/validator.go index fefd40202..bbc4b5b81 100644 --- a/pkg/controller/plan/adapter/vsphere/validator.go +++ b/pkg/controller/plan/adapter/vsphere/validator.go @@ -127,30 +127,3 @@ func (r *Validator) MaintenanceMode(vmRef ref.Ref) (ok bool, err error) { func (r *Validator) DirectStorage(vmRef ref.Ref) (bool, error) { return true, nil } - -// Validate that we have information about static IPs for every virtual NIC -func (r *Validator) StaticIPs(vmRef ref.Ref) (ok bool, err error) { - if !r.plan.Spec.PreserveStaticIPs { - return true, nil - } - vm := &model.Workload{} - err = r.inventory.Find(vm, vmRef) - if err != nil { - err = liberr.Wrap(err, "vm", vmRef) - return - } - for _, nic := range vm.NICs { - found := false - for _, guestNetwork := range vm.GuestNetworks { - if nic.MAC == guestNetwork.MAC { - found = true - break - } - } - if !found { - return - } - } - ok = true - return -} diff --git a/pkg/controller/plan/controller.go b/pkg/controller/plan/controller.go index c23fb087d..743c22250 100644 --- a/pkg/controller/plan/controller.go +++ b/pkg/controller/plan/controller.go @@ -322,9 +322,9 @@ func (r *Reconciler) archive(plan *api.Plan) { // 5. If a new migration is being started, update the context and snapshot. // 6. Run the migration. func (r *Reconciler) execute(plan *api.Plan) (reQ time.Duration, err error) { - conditionRequiresReQ := plan.Status.HasReQCondition() - if plan.Status.HasBlockerCondition() || plan.Status.HasCondition(Archived) || conditionRequiresReQ { - if conditionRequiresReQ { + validatingVDDK := plan.Status.HasCondition(ValidatingVDDK) + if plan.Status.HasBlockerCondition() || plan.Status.HasCondition(Archived) || validatingVDDK { + if validatingVDDK { reQ = base.SlowReQ } return diff --git a/pkg/controller/plan/validation.go b/pkg/controller/plan/validation.go index e39f25bd0..1e1534468 100644 --- a/pkg/controller/plan/validation.go +++ b/pkg/controller/plan/validation.go @@ -49,7 +49,6 @@ const ( VMStorageNotMapped = "VMStorageNotMapped" VMStorageNotSupported = "VMStorageNotSupported" VMMultiplePodNetworkMappings = "VMMultiplePodNetworkMappings" - VMMissingGuestIPs = "VMMissingGuestIPs" HostNotReady = "HostNotReady" DuplicateVM = "DuplicateVM" NameNotValid = "TargetNameNotValid" @@ -92,7 +91,6 @@ const ( Modified = "Modified" UserRequested = "UserRequested" InMaintenanceMode = "InMaintenanceMode" - MissingGuestInfo = "MissingGuestInformation" ) // Statuses @@ -433,14 +431,6 @@ func (r *Reconciler) validateVM(plan *api.Plan) error { Message: "VM has more than one interface mapped to the pod network.", Items: []string{}, } - missingStaticIPs := libcnd.Condition{ - Type: VMMissingGuestIPs, - Status: True, - Reason: MissingGuestInfo, - Category: Critical, - Message: "Guest information on vNICs is missing, cannot preserve static IPs. Make sure VMware tools are installed and the VM is running.", - Items: []string{}, - } setOf := map[string]bool{} // @@ -533,13 +523,6 @@ func (r *Reconciler) validateVM(plan *api.Plan) error { if !ok { maintenanceMode.Items = append(maintenanceMode.Items, ref.String()) } - ok, err = validator.StaticIPs(*ref) - if err != nil { - return err - } - if !ok { - missingStaticIPs.Items = append(missingStaticIPs.Items, ref.String()) - } // Destination. provider = plan.Referenced.Provider.Destination if provider == nil { @@ -597,9 +580,6 @@ func (r *Reconciler) validateVM(plan *api.Plan) error { if len(multiplePodNetworkMappings.Items) > 0 { plan.Status.SetCondition(multiplePodNetworkMappings) } - if len(missingStaticIPs.Items) > 0 { - plan.Status.SetCondition(missingStaticIPs) - } return nil } diff --git a/pkg/lib/condition/condition.go b/pkg/lib/condition/condition.go index e65f302aa..0d5f4b59f 100644 --- a/pkg/lib/condition/condition.go +++ b/pkg/lib/condition/condition.go @@ -31,10 +31,6 @@ const ( Required = "Required" // An advisory condition. Advisory = "Advisory" - // VDDK pending condition - ValidatingVDDK = "ValidatingVDDK" - // Missing IPs on vm pending condition - VMMissingGuestIPs = "VMMissingGuestIPs" ) // Condition @@ -317,11 +313,6 @@ func (r *Conditions) HasBlockerCondition() bool { return r.HasConditionCategory(Critical, Error) } -// The collection contains blocker conditions that keep the plan reconciling. -func (r *Conditions) HasReQCondition() bool { - return r.HasCondition(ValidatingVDDK) || r.HasCondition(VMMissingGuestIPs) -} - // The collection contains the `Ready` condition. func (r *Conditions) IsReady() bool { condition := r.FindCondition(Ready) From 412fa7c6b1082ec14a6013faeb22438a8c0d47cf Mon Sep 17 00:00:00 2001 From: Liran Rotenberg Date: Mon, 27 May 2024 11:41:05 +0300 Subject: [PATCH 7/9] Revert "Set static IPs map only when plan requires" This reverts commit ff07011ef98157a54520b1a1a0e0dff65736618b. Signed-off-by: Liran Rotenberg --- pkg/controller/plan/adapter/vsphere/builder.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/controller/plan/adapter/vsphere/builder.go b/pkg/controller/plan/adapter/vsphere/builder.go index 548591dcf..004ef90c9 100644 --- a/pkg/controller/plan/adapter/vsphere/builder.go +++ b/pkg/controller/plan/adapter/vsphere/builder.go @@ -183,10 +183,7 @@ func (r *Builder) PodEnvironment(vmRef ref.Ref, sourceSecret *core.Secret) (env return } - macsToIps := "" - if r.Plan.Spec.PreserveStaticIPs { - macsToIps = r.mapMacStaticIps(vm) - } + macsToIps := r.mapMacStaticIps(vm) libvirtURL, fingerprint, err := r.getSourceDetails(vm, sourceSecret) if err != nil { From dd42050d2d70d58af9005e1033fc7faf82420e6b Mon Sep 17 00:00:00 2001 From: Liran Rotenberg Date: Mon, 27 May 2024 11:41:15 +0300 Subject: [PATCH 8/9] Revert "Add preserve static ips to the plan" This reverts commit d005951acbdd2937892f91059353e1a5391c57a1. Signed-off-by: Liran Rotenberg --- operator/config/crd/bases/forklift.konveyor.io_plans.yaml | 3 --- pkg/apis/forklift/v1beta1/plan.go | 2 -- 2 files changed, 5 deletions(-) diff --git a/operator/config/crd/bases/forklift.konveyor.io_plans.yaml b/operator/config/crd/bases/forklift.konveyor.io_plans.yaml index 8902046b4..d23356159 100644 --- a/operator/config/crd/bases/forklift.konveyor.io_plans.yaml +++ b/operator/config/crd/bases/forklift.konveyor.io_plans.yaml @@ -141,9 +141,6 @@ spec: description: Preserve the CPU model and flags the VM runs with in its oVirt cluster. type: boolean - preserveStaticIPs: - description: Preserve static IPs of VMs in vSphere (Windows only) - type: boolean provider: description: Providers. properties: diff --git a/pkg/apis/forklift/v1beta1/plan.go b/pkg/apis/forklift/v1beta1/plan.go index 8df5d0211..18747537c 100644 --- a/pkg/apis/forklift/v1beta1/plan.go +++ b/pkg/apis/forklift/v1beta1/plan.go @@ -46,8 +46,6 @@ type PlanSpec struct { Archived bool `json:"archived,omitempty"` // Preserve the CPU model and flags the VM runs with in its oVirt cluster. PreserveClusterCPUModel bool `json:"preserveClusterCpuModel,omitempty"` - // Preserve static IPs of VMs in vSphere (Windows only) - PreserveStaticIPs bool `json:"preserveStaticIPs,omitempty"` } // Find a planned VM. From 07a5e1e6f16c37a31c0bece1c5a023d4f7ca289b Mon Sep 17 00:00:00 2001 From: Liran Rotenberg Date: Mon, 27 May 2024 11:41:24 +0300 Subject: [PATCH 9/9] Revert "Map vSphere static IPs" This reverts commit a586cc0a17c04b550b20bb16d62a05622426572d. Signed-off-by: Liran Rotenberg --- .../plan/adapter/vsphere/builder.go | 18 ----- .../provider/container/vsphere/collector.go | 2 - .../provider/container/vsphere/model.go | 20 ------ .../provider/model/vsphere/model.go | 70 ++++++++----------- pkg/controller/provider/web/vsphere/vm.go | 48 ++++++------- virt-v2v/cold/entrypoint.go | 6 -- 6 files changed, 54 insertions(+), 110 deletions(-) diff --git a/pkg/controller/plan/adapter/vsphere/builder.go b/pkg/controller/plan/adapter/vsphere/builder.go index 004ef90c9..5612f1bde 100644 --- a/pkg/controller/plan/adapter/vsphere/builder.go +++ b/pkg/controller/plan/adapter/vsphere/builder.go @@ -183,8 +183,6 @@ func (r *Builder) PodEnvironment(vmRef ref.Ref, sourceSecret *core.Secret) (env return } - macsToIps := r.mapMacStaticIps(vm) - libvirtURL, fingerprint, err := r.getSourceDetails(vm, sourceSecret) if err != nil { return @@ -211,25 +209,9 @@ func (r *Builder) PodEnvironment(vmRef ref.Ref, sourceSecret *core.Secret) (env Value: fingerprint, }, ) - if macsToIps != "" { - env = append(env, core.EnvVar{ - Name: "V2V_staticIPs", - Value: macsToIps, - }) - } return } -func (r *Builder) mapMacStaticIps(vm *model.VM) string { - configurations := []string{} - for _, guestNetwork := range vm.GuestNetworks { - if guestNetwork.Origin == string(types.NetIpConfigInfoIpAddressOriginManual) { - configurations = append(configurations, fmt.Sprintf("%s:ip:%s", guestNetwork.MAC, guestNetwork.IP)) - } - } - return strings.Join(configurations, "_") -} - func (r *Builder) getSourceDetails(vm *model.VM, sourceSecret *core.Secret) (libvirtURL liburl.URL, fingerprint string, err error) { host, err := r.host(vm.Host) if err != nil { diff --git a/pkg/controller/provider/container/vsphere/collector.go b/pkg/controller/provider/container/vsphere/collector.go index ece5dbf5e..899e559ea 100644 --- a/pkg/controller/provider/container/vsphere/collector.go +++ b/pkg/controller/provider/container/vsphere/collector.go @@ -119,7 +119,6 @@ const ( fConnectionState = "runtime.connectionState" fSnapshot = "snapshot" fIsTemplate = "config.template" - fGuestNet = "guest.net" ) // Selections @@ -721,7 +720,6 @@ func (r *Collector) vmPathSet() []string { fNumCoresPerSocket, fMemorySize, fDevices, - fGuestNet, fExtraConfig, fGuestName, fGuestID, diff --git a/pkg/controller/provider/container/vsphere/model.go b/pkg/controller/provider/container/vsphere/model.go index e388db637..4f57db2fe 100644 --- a/pkg/controller/provider/container/vsphere/model.go +++ b/pkg/controller/provider/container/vsphere/model.go @@ -613,26 +613,6 @@ func (v *VmAdapter) Apply(u types.ObjectUpdate) { } } } - case fGuestNet: - if nics, cast := p.Val.(types.ArrayOfGuestNicInfo); cast { - guestNetworksList := []model.GuestNetwork{} - for _, info := range nics.GuestNicInfo { - if info.IpConfig == nil { - continue - } - for _, ip := range info.IpConfig.IpAddress { - guestNetworksList = append(guestNetworksList, model.GuestNetwork{ - MAC: info.MacAddress, - IP: ip.IpAddress, - Origin: ip.Origin, - }) - } - } - // when the vm goes down, we get an update with empty values - the following check keeps the previously reported data. - if len(guestNetworksList) > 0 { - v.model.GuestNetworks = guestNetworksList - } - } case fDevices: if devArray, cast := p.Val.(types.ArrayOfVirtualDevice); cast { devList := []model.Device{} diff --git a/pkg/controller/provider/model/vsphere/model.go b/pkg/controller/provider/model/vsphere/model.go index 0fb0cdbe6..3eacb2bb4 100644 --- a/pkg/controller/provider/model/vsphere/model.go +++ b/pkg/controller/provider/model/vsphere/model.go @@ -231,38 +231,37 @@ type Datastore struct { type VM struct { Base - Folder string `sql:"d0,index(folder)"` - Host string `sql:"d0,index(host)"` - RevisionValidated int64 `sql:"d0,index(revisionValidated)"` - PolicyVersion int `sql:"d0,index(policyVersion)"` - UUID string `sql:""` - Firmware string `sql:""` - PowerState string `sql:""` - ConnectionState string `sql:""` - CpuAffinity []int32 `sql:""` - CpuHotAddEnabled bool `sql:""` - CpuHotRemoveEnabled bool `sql:""` - MemoryHotAddEnabled bool `sql:""` - FaultToleranceEnabled bool `sql:""` - CpuCount int32 `sql:""` - CoresPerSocket int32 `sql:""` - MemoryMB int32 `sql:""` - GuestName string `sql:""` - GuestID string `sql:""` - BalloonedMemory int32 `sql:""` - IpAddress string `sql:""` - NumaNodeAffinity []string `sql:""` - StorageUsed int64 `sql:""` - Snapshot Ref `sql:""` - IsTemplate bool `sql:""` - ChangeTrackingEnabled bool `sql:""` - TpmEnabled bool `sql:""` - Devices []Device `sql:""` - NICs []NIC `sql:""` - Disks []Disk `sql:""` - Networks []Ref `sql:""` - Concerns []Concern `sql:""` - GuestNetworks []GuestNetwork `sql:""` + Folder string `sql:"d0,index(folder)"` + Host string `sql:"d0,index(host)"` + RevisionValidated int64 `sql:"d0,index(revisionValidated)"` + PolicyVersion int `sql:"d0,index(policyVersion)"` + UUID string `sql:""` + Firmware string `sql:""` + PowerState string `sql:""` + ConnectionState string `sql:""` + CpuAffinity []int32 `sql:""` + CpuHotAddEnabled bool `sql:""` + CpuHotRemoveEnabled bool `sql:""` + MemoryHotAddEnabled bool `sql:""` + FaultToleranceEnabled bool `sql:""` + CpuCount int32 `sql:""` + CoresPerSocket int32 `sql:""` + MemoryMB int32 `sql:""` + GuestName string `sql:""` + GuestID string `sql:""` + BalloonedMemory int32 `sql:""` + IpAddress string `sql:""` + NumaNodeAffinity []string `sql:""` + StorageUsed int64 `sql:""` + Snapshot Ref `sql:""` + IsTemplate bool `sql:""` + ChangeTrackingEnabled bool `sql:""` + TpmEnabled bool `sql:""` + Devices []Device `sql:""` + NICs []NIC `sql:""` + Disks []Disk `sql:""` + Networks []Ref `sql:""` + Concerns []Concern `sql:""` } // Determine if current revision has been validated. @@ -291,10 +290,3 @@ type NIC struct { Network Ref `json:"network"` MAC string `json:"mac"` } - -// Guest network. -type GuestNetwork struct { - MAC string `json:"mac"` - IP string `json:"ip"` - Origin string `json:"origin"` -} diff --git a/pkg/controller/provider/web/vsphere/vm.go b/pkg/controller/provider/web/vsphere/vm.go index 99fd30223..9236d4c03 100644 --- a/pkg/controller/provider/web/vsphere/vm.go +++ b/pkg/controller/provider/web/vsphere/vm.go @@ -210,30 +210,29 @@ func (r *VM1) Content(detail int) interface{} { // VM full detail. type VM struct { VM1 - PolicyVersion int `json:"policyVersion"` - UUID string `json:"uuid"` - Firmware string `json:"firmware"` - ConnectionState string `json:"connectionState"` - Snapshot model.Ref `json:"snapshot"` - ChangeTrackingEnabled bool `json:"changeTrackingEnabled"` - CpuAffinity []int32 `json:"cpuAffinity"` - CpuHotAddEnabled bool `json:"cpuHotAddEnabled"` - CpuHotRemoveEnabled bool `json:"cpuHotRemoveEnabled"` - MemoryHotAddEnabled bool `json:"memoryHotAddEnabled"` - FaultToleranceEnabled bool `json:"faultToleranceEnabled"` - CpuCount int32 `json:"cpuCount"` - CoresPerSocket int32 `json:"coresPerSocket"` - MemoryMB int32 `json:"memoryMB"` - GuestName string `json:"guestName"` - GuestID string `json:"guestId"` - BalloonedMemory int32 `json:"balloonedMemory"` - IpAddress string `json:"ipAddress"` - StorageUsed int64 `json:"storageUsed"` - TpmEnabled bool `json:"tpmEnabled"` - NumaNodeAffinity []string `json:"numaNodeAffinity"` - Devices []model.Device `json:"devices"` - NICs []model.NIC `json:"nics"` - GuestNetworks []model.GuestNetwork `json:"guestNetworks"` + PolicyVersion int `json:"policyVersion"` + UUID string `json:"uuid"` + Firmware string `json:"firmware"` + ConnectionState string `json:"connectionState"` + Snapshot model.Ref `json:"snapshot"` + ChangeTrackingEnabled bool `json:"changeTrackingEnabled"` + CpuAffinity []int32 `json:"cpuAffinity"` + CpuHotAddEnabled bool `json:"cpuHotAddEnabled"` + CpuHotRemoveEnabled bool `json:"cpuHotRemoveEnabled"` + MemoryHotAddEnabled bool `json:"memoryHotAddEnabled"` + FaultToleranceEnabled bool `json:"faultToleranceEnabled"` + CpuCount int32 `json:"cpuCount"` + CoresPerSocket int32 `json:"coresPerSocket"` + MemoryMB int32 `json:"memoryMB"` + GuestName string `json:"guestName"` + GuestID string `json:"guestId"` + BalloonedMemory int32 `json:"balloonedMemory"` + IpAddress string `json:"ipAddress"` + StorageUsed int64 `json:"storageUsed"` + TpmEnabled bool `json:"tpmEnabled"` + NumaNodeAffinity []string `json:"numaNodeAffinity"` + Devices []model.Device `json:"devices"` + NICs []model.NIC `json:"nics"` } // Build the resource using the model. @@ -262,7 +261,6 @@ func (r *VM) With(m *model.VM) { r.Devices = m.Devices r.NumaNodeAffinity = m.NumaNodeAffinity r.NICs = m.NICs - r.GuestNetworks = m.GuestNetworks } // Build self link (URI). diff --git a/virt-v2v/cold/entrypoint.go b/virt-v2v/cold/entrypoint.go index 0b831b73f..bf43961d7 100644 --- a/virt-v2v/cold/entrypoint.go +++ b/virt-v2v/cold/entrypoint.go @@ -93,12 +93,6 @@ func main() { } virtV2vArgs = append(virtV2vArgs, "-ip", "/etc/secret/secretKey") - if envStaticIPs := os.Getenv("V2V_staticIPs"); envStaticIPs != "" { - for _, macToIp := range strings.Split(envStaticIPs, "_") { - virtV2vArgs = append(virtV2vArgs, "--mac", macToIp) - } - } - if info, err := os.Stat(VDDK); err == nil && info.IsDir() { virtV2vArgs = append(virtV2vArgs, "-it", "vddk",