Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vm-import: kvm import and fix volume size when lesser than 1GiB #8500

Merged
merged 2 commits into from Jan 12, 2024

Conversation

shwstppr
Copy link
Contributor

@shwstppr shwstppr commented Jan 11, 2024

Description

This PR tries to deal with on of the leftovers from #8465 as reported in #8439

when root size is 0 it is set to 1 to allow for creation of a disk.

Also, fixes the issue reported in #8488 (comment)
Refactors importDisk methods to not do repeated byte to GiB and GiB to byte conversions.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

Manually tested:

KVM with advanced zone VM import: #8500 (comment)

  1. VM with 50MiB root disk
  2. VM with 8GiB root disk and a 20 GiB data disk

VMware with advanced zone VM import: #8500 (comment)

  1. VM with 50MiB root disk
  2. VM with 8GiB root disk and a 20 GiB data disk

@shwstppr
Copy link
Contributor Author

@blueorangutan package

Copy link

codecov bot commented Jan 11, 2024

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (a3a4833) 30.31% compared to head (af84391) 30.80%.

Files Patch % Lines
...stack/engine/orchestration/VolumeOrchestrator.java 0.00% 3 Missing ⚠️
.../apache/cloudstack/vm/UnmanagedVMsManagerImpl.java 25.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8500      +/-   ##
============================================
+ Coverage     30.31%   30.80%   +0.48%     
- Complexity    33338    33996     +658     
============================================
  Files          5341     5341              
  Lines        374971   374971              
  Branches      54546    54546              
============================================
+ Hits         113675   115492    +1817     
+ Misses       246276   244211    -2065     
- Partials      15020    15268     +248     
Flag Coverage Δ
simulator-marvin-tests 24.69% <0.00%> (+0.65%) ⬆️
uitests 4.39% <ø> (ø)
unit-tests 16.48% <14.28%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@shwstppr
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@shwstppr shwstppr mentioned this pull request Jan 12, 2024
13 tasks
@blueorangutan
Copy link

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8296

@shwstppr
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@shwstppr shwstppr changed the title [DRAFT - To Test] vm-import: fix volume size when lesser than 1GiB vm-import: fix volume size when lesser than 1GiB Jan 12, 2024
@blueorangutan
Copy link

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8299

@shwstppr
Copy link
Contributor Author

Tested KVM VM import with advanced zone,

Macchinina template:

(localcloud) 🐱 > list unmanagedinstances clusterid=ce0c004e-4b53-4f01-b6a4-6ee5328f42a4 
{
  "count": 1,
  "unmanagedinstance": [
    {
      "clusterid": "ce0c004e-4b53-4f01-b6a4-6ee5328f42a4",
      "clustername": "p1-c1",
      "cpucorepersocket": -1,
      "cpunumber": 1,
      "cpuspeed": 250,
      "disk": [
        {
          "capacity": 52428800,
          "controller": "ide",
          "datastorehost": "10.1.32.4",
          "datastorename": "/acs/primary/pr8425-t6910-kvm-rocky8/pr8425-t6910-kvm-rocky8-kvm-pri2",
          "datastorepath": "/acs/primary/pr8425-t6910-kvm-rocky8/pr8425-t6910-kvm-rocky8-kvm-pri2",
          "datastoretype": "file",
          "id": "0",
          "imagepath": "/mnt/72ddc5a4-8316-3f87-8c50-fcce882334b3/23153737-cbec-42a0-ae7e-ba6158ddd4b5",
          "label": "hda",
          "position": 0
        }
      ],
      "hostid": "630c3418-62cd-463a-bbb3-18f4c86e7164",
      "hostname": "pr8425-t6910-kvm-rocky8-kvm1",
      "memory": 512,
      "name": "i-2-3-VM",
      "nic": [
        {
          "adaptertype": "e1000",
          "id": "0",
          "macaddress": "02:01:00:cc:00:01",
          "networkname": "vnet6",
          "vlanid": -1
        }
      ],
      "powerstate": "PowerOn"
    }
  ]
}
(localcloud) 🐱 > import unmanagedinstance name=i-2-3-VM clusterid=ce0c004e-4b53-4f01-b6a4-6ee5328f42a4 displayname=test1 zoneid=20e518a8-f066-4f4b-837a-db5bf7284093 importsource=unmanaged hypervisor=kvm host= username= password= diskpath= temppath= serviceofferingid=f13d82f9-1725-498d-892c-153ec31a5c5a templateid=f577aca5-600c-4f0e-9cc6-d2963d84dfa7 nicnetworklist[0].nic=0 nicnetworklist[0].network=eb61e9e8-5f01-489d-ad32-3072d6ccc33a
{
  "virtualmachine": {
    "account": "admin",
    "affinitygroup": [],
    "cpunumber": 1,
    "cpuspeed": 500,
    "created": "2024-01-12T10:35:39+0000",
    "details": {
      "deployvm": "true",
      "kvm.vnc.password": "zGpeTD0MXvLWYVgnyLobIF",
      "nicAdapter": "e1000",
      "rootDiskController": "ide",
      "rootdisksize": "1"
    },
    "displayname": "test1",
    "displayvm": true,
    "domain": "ROOT",
    "domainid": "2d6ea5ef-aa36-11ee-8314-1e008b000ca5",
    "guestosid": "2d7e1188-aa36-11ee-8314-1e008b000ca5",
    "haenable": false,
    "hasannotations": false,
    "hostcontrolstate": "Enabled",
    "hostid": "630c3418-62cd-463a-bbb3-18f4c86e7164",
    "hostname": "pr8425-t6910-kvm-rocky8-kvm1",
    "hypervisor": "KVM",
    "id": "16f72e81-6cdd-4610-9ef8-f6758c4b413e",
    "instancename": "i-2-3-VM",
    "isdynamicallyscalable": false,
    "memory": 512,
    "name": "test1",
    "nic": [
      {
        "broadcasturi": "vlan://1472",
        "deviceid": "0",
        "extradhcpoption": [],
        "id": "eaee530c-97c4-46db-9b07-e13be320ede3",
        "isdefault": true,
        "isolationuri": "vlan://1472",
        "macaddress": "02:01:00:cc:00:01",
        "networkid": "eb61e9e8-5f01-489d-ad32-3072d6ccc33a",
        "networkname": "l2",
        "secondaryip": [],
        "traffictype": "Guest",
        "type": "L2"
      }
    ],
    "osdisplayname": "Other Linux (64-bit)",
    "ostypeid": "2d7e1188-aa36-11ee-8314-1e008b000ca5",
    "passwordenabled": false,
    "pooltype": "NetworkFilesystem",
    "receivedbytes": 0,
    "rootdeviceid": 0,
    "rootdevicetype": "ROOT",
    "securitygroup": [],
    "sentbytes": 0,
    "serviceofferingid": "f13d82f9-1725-498d-892c-153ec31a5c5a",
    "serviceofferingname": "Small Instance",
    "state": "Running",
    "tags": [],
    "templatedisplaytext": "macc-kvm",
    "templateid": "f577aca5-600c-4f0e-9cc6-d2963d84dfa7",
    "templatename": "macc-kvm",
    "templatetype": "USER",
    "userid": "4dfdc621-aa36-11ee-8314-1e008b000ca5",
    "username": "admin",
    "zoneid": "20e518a8-f066-4f4b-837a-db5bf7284093",
    "zonename": "pr8425-t6910-kvm-rocky8"
  }
}
(localcloud) 🐱 > list volumes virtualmachineid=16f72e81-6cdd-4610-9ef8-f6758c4b413e  filter=id,name,type,size,
{
  "count": 1,
  "volume": [
    {
      "id": "7c3efe6e-5b52-4e03-aba0-28cb419fa6b0",
      "name": "ROOT-7",
      "size": 52428800,
      "type": "ROOT"
    }
  ]
}

Default template VM with two disks,

(localcloud) 🐱 > list unmanagedinstances clusterid=ce0c004e-4b53-4f01-b6a4-6ee5328f42a4 
{
  "count": 1,
  "unmanagedinstance": [
    {
      "clusterid": "ce0c004e-4b53-4f01-b6a4-6ee5328f42a4",
      "clustername": "p1-c1",
      "cpucorepersocket": -1,
      "cpunumber": 1,
      "cpuspeed": 250,
      "disk": [
        {
          "capacity": 8589934592,
          "controller": "virtio",
          "datastorehost": "10.1.32.4",
          "datastorename": "/acs/primary/pr8425-t6910-kvm-rocky8/pr8425-t6910-kvm-rocky8-kvm-pri2",
          "datastorepath": "/acs/primary/pr8425-t6910-kvm-rocky8/pr8425-t6910-kvm-rocky8-kvm-pri2",
          "datastoretype": "file",
          "id": "0",
          "imagepath": "/mnt/72ddc5a4-8316-3f87-8c50-fcce882334b3/aff5a4a2-20af-4a0a-9123-b862a9f62e4f",
          "label": "vda",
          "position": 0
        },
        {
          "capacity": 21474836480,
          "controller": "virtio",
          "datastorehost": "10.1.32.4",
          "datastorename": "/acs/primary/pr8425-t6910-kvm-rocky8/pr8425-t6910-kvm-rocky8-kvm-pri2",
          "datastorepath": "/acs/primary/pr8425-t6910-kvm-rocky8/pr8425-t6910-kvm-rocky8-kvm-pri2",
          "datastoretype": "file",
          "id": "1",
          "imagepath": "/mnt/72ddc5a4-8316-3f87-8c50-fcce882334b3/5cc83bcc-3547-44af-831c-c27bf7a470ff",
          "label": "vdb",
          "position": 1
        }
      ],
      "hostid": "630c3418-62cd-463a-bbb3-18f4c86e7164",
      "hostname": "pr8425-t6910-kvm-rocky8-kvm1",
      "memory": 512,
      "name": "i-2-5-VM",
      "nic": [
        {
          "adaptertype": "virtio",
          "id": "0",
          "macaddress": "02:01:00:cc:00:02",
          "networkname": "vnet7",
          "vlanid": -1
        }
      ],
      "powerstate": "PowerOn"
    }
  ]
}
(localcloud) 🐱 > import unmanagedinstance name=i-2-5-VM clusterid=ce0c004e-4b53-4f01-b6a4-6ee5328f42a4 displayname=test2 zoneid=20e518a8-f066-4f4b-837a-db5bf7284093 importsource=unmanaged hypervisor=kvm host= username= password= diskpath= temppath= serviceofferingid=f13d82f9-1725-498d-892c-153ec31a5c5a templateid=2d72d040-aa36-11ee-8314-1e008b000ca5 datadiskofferinglist[0].disk=1 datadiskofferinglist[0].diskOffering=7bfb5e7b-2be1-4dcf-b3be-a08469db32f9 nicnetworklist[0].nic=0 nicnetworklist[0].network=eb61e9e8-5f01-489d-ad32-3072d6ccc33a
{
  "virtualmachine": {
    "account": "admin",
    "affinitygroup": [],
    "cpunumber": 1,
    "cpuspeed": 500,
    "created": "2024-01-12T10:38:01+0000",
    "details": {
      "dataDiskController": "virtio",
      "deployvm": "true",
      "kvm.vnc.password": "YoYDYQX1oXNpWImTVpiUQy",
      "nicAdapter": "virtio",
      "rootDiskController": "virtio"
    },
    "diskofferingid": "7bfb5e7b-2be1-4dcf-b3be-a08469db32f9",
    "diskofferingname": "Custom",
    "displayname": "test2",
    "displayvm": true,
    "domain": "ROOT",
    "domainid": "2d6ea5ef-aa36-11ee-8314-1e008b000ca5",
    "guestosid": "2d7f57b9-aa36-11ee-8314-1e008b000ca5",
    "haenable": false,
    "hasannotations": false,
    "hostcontrolstate": "Enabled",
    "hostid": "630c3418-62cd-463a-bbb3-18f4c86e7164",
    "hostname": "pr8425-t6910-kvm-rocky8-kvm1",
    "hypervisor": "KVM",
    "id": "8efe0bee-3b68-455a-991e-7cccef0bdb7d",
    "instancename": "i-2-5-VM",
    "isdynamicallyscalable": false,
    "memory": 512,
    "name": "test2",
    "nic": [
      {
        "broadcasturi": "vlan://1472",
        "deviceid": "0",
        "extradhcpoption": [],
        "id": "cf41ca45-4dbd-4c9b-aecc-7d16d649a073",
        "isdefault": true,
        "isolationuri": "vlan://1472",
        "macaddress": "02:01:00:cc:00:02",
        "networkid": "eb61e9e8-5f01-489d-ad32-3072d6ccc33a",
        "networkname": "l2",
        "secondaryip": [],
        "traffictype": "Guest",
        "type": "L2"
      }
    ],
    "osdisplayname": "CentOS 5.5 (64-bit)",
    "ostypeid": "2d7f57b9-aa36-11ee-8314-1e008b000ca5",
    "passwordenabled": false,
    "pooltype": "NetworkFilesystem",
    "receivedbytes": 0,
    "rootdeviceid": 0,
    "rootdevicetype": "ROOT",
    "securitygroup": [],
    "sentbytes": 0,
    "serviceofferingid": "f13d82f9-1725-498d-892c-153ec31a5c5a",
    "serviceofferingname": "Small Instance",
    "state": "Running",
    "tags": [],
    "templatedisplaytext": "CentOS 5.5(64-bit) no GUI (KVM)",
    "templateid": "2d72d040-aa36-11ee-8314-1e008b000ca5",
    "templatename": "CentOS 5.5(64-bit) no GUI (KVM)",
    "templatetype": "BUILTIN",
    "userid": "4dfdc621-aa36-11ee-8314-1e008b000ca5",
    "username": "admin",
    "zoneid": "20e518a8-f066-4f4b-837a-db5bf7284093",
    "zonename": "pr8425-t6910-kvm-rocky8"
  }
}
(localcloud) 🐱 > list volumes virtualmachineid=8efe0bee-3b68-455a-991e-7cccef0bdb7d filter=id,name,type,size,
{
  "count": 2,
  "volume": [
    {
      "id": "9c46d1d5-daf1-4530-aa4d-fef3ac6a42ac",
      "name": "ROOT-9",
      "size": 8589934592,
      "type": "ROOT"
    },
    {
      "id": "04809d8a-f7b9-4745-b91b-c734424fc901",
      "name": "DATA-9-1",
      "size": 21474836480,
      "type": "DATADISK"
    }
  ]
}

@shwstppr
Copy link
Contributor Author

Also tested cases similar to #8500 (comment) for VMware with advanced zone,

(localcloud) 🐱 > list unmanagedinstances clusterid=b9c9e825-e9e6-46df-9ae2-eee2be7bf606 name=i-2-4-VM
{
  "count": 1,
  "unmanagedinstance": [
    {
      "clusterid": "b9c9e825-e9e6-46df-9ae2-eee2be7bf606",
      "clustername": "p1-c1",
      "cpucorepersocket": 1,
      "cpunumber": 1,
      "cpuspeed": 0,
      "disk": [
        {
          "capacity": 52428800,
          "controller": "lsilogic",
          "controllerunit": 0,
          "datastorehost": "10.0.32.4",
          "datastorename": "90abe5740f1a3704871b49035569191c",
          "datastorepath": "/acs/primary/ref-trl-6178-k-Mr8-abhishek-kumar/ref-trl-6178-k-Mr8-abhishek-kumar-esxi-pri2",
          "datastoretype": "NFS",
          "id": "9-2000",
          "imagepath": "[90abe5740f1a3704871b49035569191c] i-2-4-VM/ROOT-4.vmdk",
          "label": "Hard disk 1",
          "position": 0
        }
      ],
      "hostid": "f69e931f-2e6d-4444-9303-e88414f1024c",
      "hostname": "10.0.35.191",
      "memory": 512,
      "name": "i-2-4-VM",
      "nic": [
        {
          "adaptertype": "E1000",
          "id": "Network adapter 1",
          "macaddress": "02:01:00:cc:00:02",
          "networkname": "cloud.guest.2442.200.1-vSwitch1",
          "vlanid": 2442
        }
      ],
      "osdisplayname": "Other Linux (64-bit)",
      "osid": "otherLinux64Guest",
      "powerstate": "PowerOn"
    }
  ]
}
(localcloud) 🐱 > import unmanagedinstance name=i-2-4-VM clusterid=b9c9e825-e9e6-46df-9ae2-eee2be7bf606 displayname=test1 zoneid=1da7df4e-f93c-42e9-af4f-61617c8802e9 importsource=unmanaged hypervisor=vmware host= username= password= diskpath= temppath= serviceofferingid=446ac64f-9c96-4230-bfaf-fd29867a0892 templateid=ab043179-fd9f-4fc8-907c-09e34b22f8b1 nicnetworklist[0].nic=Network+adapter+1 nicnetworklist[0].network=528ca782-7e2d-461d-addd-543d4dafab33
{
  "virtualmachine": {
    "account": "admin",
    "affinitygroup": [],
    "cpunumber": 1,
    "cpuspeed": 500,
    "created": "2024-01-12T10:57:18+0000",
    "details": {
      "dataDiskController": "osdefault",
      "deployvm": "true",
      "nicAdapter": "E1000",
      "rootDiskController": "lsilogic"
    },
    "displayname": "test1",
    "displayvm": true,
    "domain": "ROOT",
    "domainid": "3ac7ec8b-b135-11ee-b2d7-1e007200043b",
    "guestosid": "3aee704b-b135-11ee-b2d7-1e007200043b",
    "haenable": false,
    "hasannotations": false,
    "hostcontrolstate": "Enabled",
    "hostid": "f69e931f-2e6d-4444-9303-e88414f1024c",
    "hostname": "10.0.35.191",
    "hypervisor": "VMware",
    "id": "3c38905d-70a4-48e1-bf16-487d749fc848",
    "instancename": "i-2-4-VM",
    "isdynamicallyscalable": false,
    "memory": 512,
    "name": "i-2-4-VM",
    "nic": [
      {
        "broadcasturi": "vlan://2442",
        "deviceid": "0",
        "extradhcpoption": [],
        "id": "c73aaf78-6c56-4ce2-8707-38b085dde9fb",
        "isdefault": true,
        "isolationuri": "vlan://2442",
        "macaddress": "02:01:00:cc:00:02",
        "networkid": "528ca782-7e2d-461d-addd-543d4dafab33",
        "networkname": "l2",
        "secondaryip": [],
        "traffictype": "Guest",
        "type": "L2"
      }
    ],
    "osdisplayname": "Other Linux (64-bit)",
    "ostypeid": "3aee704b-b135-11ee-b2d7-1e007200043b",
    "passwordenabled": false,
    "pooltype": "NetworkFilesystem",
    "receivedbytes": 0,
    "rootdeviceid": 0,
    "rootdevicetype": "ROOT",
    "securitygroup": [],
    "sentbytes": 0,
    "serviceofferingid": "446ac64f-9c96-4230-bfaf-fd29867a0892",
    "serviceofferingname": "Small Instance",
    "state": "Running",
    "tags": [],
    "templatedisplaytext": "macc-vmware",
    "templateid": "ab043179-fd9f-4fc8-907c-09e34b22f8b1",
    "templatename": "macc-vmware",
    "templatetype": "USER",
    "userid": "6cb20ab4-b135-11ee-b2d7-1e007200043b",
    "username": "admin",
    "zoneid": "1da7df4e-f93c-42e9-af4f-61617c8802e9",
    "zonename": "ref-trl-6178-k-Mr8-abhishek-kumar"
  }
}
(localcloud) 🐱 > list volumes virtualmachineid=3c38905d-70a4-48e1-bf16-487d749fc848 filter=id,name,type,size
{
  "count": 1,
  "volume": [
    {
      "id": "fac34436-ffcf-47c4-812a-11a7ff490bb1",
      "name": "ROOT-7",
      "size": 52428800,
      "type": "ROOT"
    }
  ]
}
(localcloud) 🐱 > list unmanagedinstances clusterid=b9c9e825-e9e6-46df-9ae2-eee2be7bf606 name=i-2-3-VM
{
  "count": 1,
  "unmanagedinstance": [
    {
      "clusterid": "b9c9e825-e9e6-46df-9ae2-eee2be7bf606",
      "clustername": "p1-c1",
      "cpucorepersocket": 1,
      "cpunumber": 1,
      "cpuspeed": 0,
      "disk": [
        {
          "capacity": 2147483648,
          "controller": "ide",
          "controllerunit": 0,
          "datastorehost": "10.0.32.4",
          "datastorename": "f442004cde5834e7bbca68b1c36d5987",
          "datastorepath": "/acs/primary/ref-trl-6178-k-Mr8-abhishek-kumar/ref-trl-6178-k-Mr8-abhishek-kumar-esxi-pri1",
          "datastoretype": "NFS",
          "id": "11-3001",
          "imagepath": "[f442004cde5834e7bbca68b1c36d5987] i-2-3-VM/ROOT-3.vmdk",
          "label": "Hard disk 1",
          "position": 1
        },
        {
          "capacity": 21474836480,
          "controller": "lsilogic",
          "controllerunit": 0,
          "datastorehost": "10.0.32.4",
          "datastorename": "90abe5740f1a3704871b49035569191c",
          "datastorepath": "/acs/primary/ref-trl-6178-k-Mr8-abhishek-kumar/ref-trl-6178-k-Mr8-abhishek-kumar-esxi-pri2",
          "datastoretype": "NFS",
          "id": "11-2000",
          "imagepath": "[90abe5740f1a3704871b49035569191c] i-2-3-VM/b6cf9b56187a48419d9efdf1ba6fb5e6.vmdk",
          "label": "Hard disk 2",
          "position": 0
        }
      ],
      "hostid": "f69e931f-2e6d-4444-9303-e88414f1024c",
      "hostname": "10.0.35.191",
      "memory": 512,
      "name": "i-2-3-VM",
      "nic": [
        {
          "adaptertype": "E1000",
          "id": "Network adapter 1",
          "macaddress": "02:01:00:cc:00:01",
          "networkname": "cloud.guest.2442.200.1-vSwitch1",
          "vlanid": 2442
        }
      ],
      "osdisplayname": "CentOS 4/5 (64-bit)",
      "osid": "centos64Guest",
      "powerstate": "PowerOn"
    }
  ]
}
(localcloud) 🐱 > import unmanagedinstance name=i-2-3-VM clusterid=b9c9e825-e9e6-46df-9ae2-eee2be7bf606 displayname=test2 zoneid=1da7df4e-f93c-42e9-af4f-61617c8802e9 importsource=unmanaged hypervisor=vmware host= username= password= diskpath= temppath= serviceofferingid=446ac64f-9c96-4230-bfaf-fd29867a0892 templateid=3ad1533d-b135-11ee-b2d7-1e007200043b datadiskofferinglist[0].disk=11-2000 datadiskofferinglist[0].diskOffering=e0982c6d-7c7d-40fc-9a2a-8df0b29cc41b nicnetworklist[0].nic=Network+adapter+1 nicnetworklist[0].network=528ca782-7e2d-461d-addd-543d4dafab33
{
  "virtualmachine": {
    "account": "admin",
    "affinitygroup": [],
    "cpunumber": 1,
    "cpuspeed": 500,
    "created": "2024-01-12T11:00:20+0000",
    "details": {
      "dataDiskController": "lsilogic",
      "deployvm": "true",
      "nicAdapter": "E1000",
      "rootDiskController": "ide"
    },
    "diskofferingid": "e0982c6d-7c7d-40fc-9a2a-8df0b29cc41b",
    "diskofferingname": "Custom",
    "displayname": "test2",
    "displayvm": true,
    "domain": "ROOT",
    "domainid": "3ac7ec8b-b135-11ee-b2d7-1e007200043b",
    "guestosid": "3ad806ae-b135-11ee-b2d7-1e007200043b",
    "haenable": false,
    "hasannotations": false,
    "hostcontrolstate": "Enabled",
    "hostid": "f69e931f-2e6d-4444-9303-e88414f1024c",
    "hostname": "10.0.35.191",
    "hypervisor": "VMware",
    "id": "e1ef8ef2-c0a7-4200-a21a-8c4b35d7c5be",
    "instancename": "i-2-3-VM",
    "isdynamicallyscalable": false,
    "memory": 512,
    "name": "i-2-3-VM",
    "nic": [
      {
        "broadcasturi": "vlan://2442",
        "deviceid": "0",
        "extradhcpoption": [],
        "id": "151087b8-9f3d-4908-9e2f-a88d753e5b0d",
        "isdefault": true,
        "isolationuri": "vlan://2442",
        "macaddress": "02:01:00:cc:00:01",
        "networkid": "528ca782-7e2d-461d-addd-543d4dafab33",
        "networkname": "l2",
        "secondaryip": [],
        "traffictype": "Guest",
        "type": "L2"
      }
    ],
    "osdisplayname": "CentOS 5.3 (64-bit)",
    "ostypeid": "3ad806ae-b135-11ee-b2d7-1e007200043b",
    "passwordenabled": false,
    "pooltype": "NetworkFilesystem",
    "receivedbytes": 0,
    "rootdeviceid": 0,
    "rootdevicetype": "ROOT",
    "securitygroup": [],
    "sentbytes": 0,
    "serviceofferingid": "446ac64f-9c96-4230-bfaf-fd29867a0892",
    "serviceofferingname": "Small Instance",
    "state": "Running",
    "tags": [],
    "templatedisplaytext": "CentOS 5.3(64-bit) no GUI (vSphere)",
    "templateid": "3ad1533d-b135-11ee-b2d7-1e007200043b",
    "templatename": "CentOS 5.3(64-bit) no GUI (vSphere)",
    "templatetype": "BUILTIN",
    "userid": "6cb20ab4-b135-11ee-b2d7-1e007200043b",
    "username": "admin",
    "zoneid": "1da7df4e-f93c-42e9-af4f-61617c8802e9",
    "zonename": "ref-trl-6178-k-Mr8-abhishek-kumar"
  }
}
(localcloud) 🐱 > list volumes virtualmachineid=e1ef8ef2-c0a7-4200-a21a-8c4b35d7c5be filter=id,name,type,size
{
  "count": 2,
  "volume": [
    {
      "id": "eb05063d-661c-4824-8a24-a87c17778553",
      "name": "ROOT-9",
      "size": 2147483648,
      "type": "ROOT"
    },
    {
      "id": "b5aa42c9-3935-4a17-b450-318bd89e5a8d",
      "name": "DATA-9-11-2000",
      "size": 21474836480,
      "type": "DATADISK"
    }
  ]
}

@shwstppr shwstppr changed the title vm-import: fix volume size when lesser than 1GiB vm-import: kvm import and fix volume size when lesser than 1GiB Jan 12, 2024
Copy link
Contributor

@nvazquez nvazquez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM

@shwstppr shwstppr added this to the 4.19.0.0 milestone Jan 12, 2024
Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm and tested:

  • im-/export
    • kvm basic zone
    • kvm advanced zone
    • vmware advanced zone
      • all with a small template and the standard template
  • migrate with standard template and extra disk

@DaanHoogland DaanHoogland marked this pull request as ready for review January 12, 2024 12:31
@DaanHoogland DaanHoogland merged commit 3936f7c into apache:main Jan 12, 2024
25 of 26 checks passed
@DaanHoogland DaanHoogland deleted the fix-vmimport-lesserthangb branch January 12, 2024 12:32
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Jan 26, 2024
…he#8500)

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Co-authored-by: Daan Hoogland <daan@onecht.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants