Skip to content

xenserver: attach regular iso with configdrive#9216

Merged
vishesh92 merged 2 commits intoapache:4.19from
shapeblue:fix-xen-isowithconfigdrive
Jun 27, 2024
Merged

xenserver: attach regular iso with configdrive#9216
vishesh92 merged 2 commits intoapache:4.19from
shapeblue:fix-xen-isowithconfigdrive

Conversation

@shwstppr
Copy link
Copy Markdown
Contributor

@shwstppr shwstppr commented Jun 11, 2024

Description

Fixes #7902

This PR allows attaching a regular ISO to a VM when it already has the config drive ISO attached.
Config-drive ISO is now attached with the SR name-label <VM-NAME>-CONFIGDRIVE-ISO. While regular ISOs continue to attach with SR name-label <VM-NAME>-ISO. VM which already have the configdrive ISO attached before this fix will return an appropriate error and will need to be stopped-start.

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?

  • Deploy a network with configdrive for userdata service
  • Deploy a VM for the network
  • Try attaching an ISO to the VM
(localcloud) 🐱 > list networks id=9aa54302-2812-426e-bddb-654df195360b 
{
  "count": 1,
  "network": [
    {
      "account": "admin",
      "acltype": "Account",
      "broadcastdomaintype": "Vlan",
      "broadcasturi": "vlan://2158",
      "canusefordeploy": true,
      "created": "2024-06-11T07:03:14+0000",
      "details": {},
      "displaynetwork": true,
      "displaytext": "configdrive-l2",
      "dns1": "10.0.32.1",
      "dns2": "8.8.8.8",
      "domain": "ROOT",
      "domainid": "5a4b4766-1e62-11ef-b827-1e00120002d6",
      "hasannotations": false,
      "id": "9aa54302-2812-426e-bddb-654df195360b",
      "ispersistent": false,
      "issystem": false,
      "name": "configdrive-l2",
      "networkofferingavailability": "Optional",
      "networkofferingconservemode": true,
      "networkofferingdisplaytext": "Offering for L2 networks with config drive user data",
      "networkofferingid": "5f51a33c-e0cb-498b-812d-e9677556fdad",
      "networkofferingname": "DefaultL2NetworkOfferingConfigDrive",
      "physicalnetworkid": "19579c81-1bf9-4491-bbe9-769f87f9c903",
      "privatemtu": 1500,
      "publicmtu": 1500,
      "receivedbytes": 0,
      "redundantrouter": false,
      "related": "9aa54302-2812-426e-bddb-654df195360b",
      "restartrequired": false,
      "sentbytes": 0,
      "service": [
        {
          "capability": [],
          "name": "UserData",
          "provider": [
            {
              "name": "ConfigDrive"
            }
          ]
        }
      ],
      "specifyipranges": false,
      "state": "Implemented",
      "strechedl2subnet": false,
      "supportsvmautoscaling": false,
      "tags": [],
      "traffictype": "Guest",
      "type": "L2",
      "vlan": "2158",
      "zoneid": "87ab94de-5701-4aa0-8253-fcefac217440",
      "zonename": "ref-trl-6722-x-M7-abhishek-kumar"
    }
  ]
}
(localcloud) 🐱 > deploy virtualmachine zoneid=87ab94de-5701-4aa0-8253-fcefac217440 serviceofferingid=51ac121c-987b-446b-9e51-a383f30f8156 
💩 Missing required parameters:  templateid
(localcloud) 🐱 > deploy virtualmachine zoneid=87ab94de-5701-4aa0-8253-fcefac217440 serviceofferingid=51ac121c-987b-446b-9e51-a383f30f8156 templateid=a698f5ea-e51a-403c-a7be-22d5f6eaa11b networkids=9aa54302-2812-426e-bddb-654df195360b 
{
  "virtualmachine": {
    "account": "admin",
    "affinitygroup": [],
    "cpunumber": 1,
    "cpuspeed": 500,
    "created": "2024-06-12T12:14:56+0000",
    "details": {
      "cpuOvercommitRatio": "2.0",
      "hypervisortoolsversion": "false",
      "memoryOvercommitRatio": "1.0"
    },
    "displayname": "VM-45ef2ec2-f890-4cb1-8a2f-27aa364c6cf0",
    "displayvm": true,
    "domain": "ROOT",
    "domainid": "5a4b4766-1e62-11ef-b827-1e00120002d6",
    "guestosid": "8170a0ea-d54d-4cb9-b6a6-9d7652960164",
    "haenable": false,
    "hasannotations": false,
    "hostcontrolstate": "Enabled",
    "hostid": "d1b1d524-2445-4b23-aa24-0632d159e518",
    "hostname": "ref-trl-6722-x-M7-abhishek-kumar-xs1",
    "hypervisor": "XenServer",
    "id": "45ef2ec2-f890-4cb1-8a2f-27aa364c6cf0",
    "instancename": "i-2-9-VM",
    "isdynamicallyscalable": false,
    "jobid": "67a99814-cbbf-4b50-a275-ff416a58ba0b",
    "jobstatus": 0,
    "lastupdated": "2024-06-12T12:15:10+0000",
    "memory": 512,
    "name": "VM-45ef2ec2-f890-4cb1-8a2f-27aa364c6cf0",
    "nic": [
      {
        "broadcasturi": "vlan://2158",
        "deviceid": "0",
        "extradhcpoption": [],
        "id": "a85752da-bcc5-4ea2-80bc-0765c6b19ccf",
        "isdefault": true,
        "isolationuri": "vlan://2158",
        "macaddress": "02:01:00:ce:00:02",
        "networkid": "9aa54302-2812-426e-bddb-654df195360b",
        "networkname": "configdrive-l2",
        "secondaryip": [],
        "traffictype": "Guest",
        "type": "L2"
      }
    ],
    "osdisplayname": "Debian GNU/Linux 12 (64-bit)",
    "ostypeid": "8170a0ea-d54d-4cb9-b6a6-9d7652960164",
    "passwordenabled": false,
    "pooltype": "NetworkFilesystem",
    "receivedbytes": 0,
    "rootdeviceid": 0,
    "rootdevicetype": "ROOT",
    "securitygroup": [],
    "sentbytes": 0,
    "serviceofferingid": "51ac121c-987b-446b-9e51-a383f30f8156",
    "serviceofferingname": "Small Instance",
    "state": "Running",
    "tags": [],
    "templatedisplaytext": "debian12-dummy",
    "templateformat": "VHD",
    "templateid": "a698f5ea-e51a-403c-a7be-22d5f6eaa11b",
    "templatename": "debian12-dummy",
    "templatetype": "USER",
    "userid": "78617ce4-1e62-11ef-b827-1e00120002d6",
    "username": "admin",
    "zoneid": "87ab94de-5701-4aa0-8253-fcefac217440",
    "zonename": "ref-trl-6722-x-M7-abhishek-kumar"
  }
}
(localcloud) 🐱 > list isos id=a42b25fc-cb1f-4447-b611-d3ccf015338c 
{
  "count": 1,
  "iso": [
    {
      "account": "admin",
      "bits": 64,
      "bootable": false,
      "checksum": "18a24183958339cb0508a9e27abd81494514469529bf1a4dd0cbc8a3c4d502a94400e6c58b6d54d5043eb2100946f6e85dd7032bc12642e4ab2e8907ed88dbcb",
      "created": "2024-06-11T09:11:40+0000",
      "crossZones": true,
      "directdownload": false,
      "displaytext": "tiny",
      "domain": "ROOT",
      "domainid": "5a4b4766-1e62-11ef-b827-1e00120002d6",
      "downloaddetails": [
        {
          "datastore": "NFS://10.0.32.4/acs/secondary/ref-trl-6722-x-M7-abhishek-kumar/ref-trl-6722-x-M7-abhishek-kumar-sec1",
          "datastoreId": "8d56f359-39a2-46f3-b429-5eb959c69d23",
          "datastoreRole": "Image",
          "downloadPercent": "100",
          "downloadState": "DOWNLOADED"
        }
      ],
      "hasannotations": false,
      "id": "a42b25fc-cb1f-4447-b611-d3ccf015338c",
      "isdynamicallyscalable": false,
      "isextractable": false,
      "isfeatured": true,
      "ispublic": true,
      "isready": true,
      "name": "tiny",
      "ostypeid": "5a6dadec-1e62-11ef-b827-1e00120002d6",
      "ostypename": "None",
      "passwordenabled": false,
      "size": 16777216,
      "status": "Successfully Installed",
      "tags": [],
      "url": "http://10.0.3.122/openvm/cloudstack/iso/TinyCore-8.0.iso",
      "zoneid": "87ab94de-5701-4aa0-8253-fcefac217440",
      "zonename": "ref-trl-6722-x-M7-abhishek-kumar"
    }
  ]
}
(localcloud) 🐱 > attach iso virtualmachineid=45ef2ec2-f890-4cb1-8a2f-27aa364c6cf0 id=a42b25fc-cb1f-4447-b611-d3ccf015338c 
{
  "virtualmachine": {
    "account": "admin",
    "affinitygroup": [],
    "cpunumber": 1,
    "cpuspeed": 500,
    "cpuused": "0%",
    "created": "2024-06-12T12:14:56+0000",
    "details": {
      "cpuOvercommitRatio": "2.0",
      "hypervisortoolsversion": "false",
      "memoryOvercommitRatio": "1.0"
    },
    "diskioread": 0,
    "diskiowrite": 0,
    "diskkbsread": 0,
    "diskkbswrite": 0,
    "displayname": "VM-45ef2ec2-f890-4cb1-8a2f-27aa364c6cf0",
    "displayvm": true,
    "domain": "ROOT",
    "domainid": "5a4b4766-1e62-11ef-b827-1e00120002d6",
    "guestosid": "8170a0ea-d54d-4cb9-b6a6-9d7652960164",
    "haenable": false,
    "hasannotations": false,
    "hostcontrolstate": "Enabled",
    "hostid": "d1b1d524-2445-4b23-aa24-0632d159e518",
    "hostname": "ref-trl-6722-x-M7-abhishek-kumar-xs1",
    "hypervisor": "XenServer",
    "id": "45ef2ec2-f890-4cb1-8a2f-27aa364c6cf0",
    "instancename": "i-2-9-VM",
    "isdynamicallyscalable": false,
    "isodisplaytext": "tiny",
    "isoid": "a42b25fc-cb1f-4447-b611-d3ccf015338c",
    "isoname": "tiny",
    "jobid": "c65c5e10-7666-48df-88ba-fa46ffc946ef",
    "jobstatus": 0,
    "lastupdated": "2024-06-12T12:15:10+0000",
    "memory": 512,
    "memoryintfreekbs": 0,
    "memorykbs": 0,
    "memorytargetkbs": 0,
    "name": "VM-45ef2ec2-f890-4cb1-8a2f-27aa364c6cf0",
    "networkkbsread": 0,
    "networkkbswrite": 0,
    "nic": [
      {
        "broadcasturi": "vlan://2158",
        "deviceid": "0",
        "extradhcpoption": [],
        "id": "a85752da-bcc5-4ea2-80bc-0765c6b19ccf",
        "isdefault": true,
        "isolationuri": "vlan://2158",
        "macaddress": "02:01:00:ce:00:02",
        "networkid": "9aa54302-2812-426e-bddb-654df195360b",
        "networkname": "configdrive-l2",
        "secondaryip": [],
        "traffictype": "Guest",
        "type": "L2"
      }
    ],
    "osdisplayname": "Debian GNU/Linux 12 (64-bit)",
    "ostypeid": "8170a0ea-d54d-4cb9-b6a6-9d7652960164",
    "passwordenabled": false,
    "pooltype": "NetworkFilesystem",
    "receivedbytes": 0,
    "rootdeviceid": 0,
    "rootdevicetype": "ROOT",
    "securitygroup": [],
    "sentbytes": 0,
    "serviceofferingid": "51ac121c-987b-446b-9e51-a383f30f8156",
    "serviceofferingname": "Small Instance",
    "state": "Running",
    "tags": [],
    "templatedisplaytext": "debian12-dummy",
    "templateformat": "VHD",
    "templateid": "a698f5ea-e51a-403c-a7be-22d5f6eaa11b",
    "templatename": "debian12-dummy",
    "templatetype": "USER",
    "userid": "78617ce4-1e62-11ef-b827-1e00120002d6",
    "username": "admin",
    "zoneid": "87ab94de-5701-4aa0-8253-fcefac217440",
    "zonename": "ref-trl-6722-x-M7-abhishek-kumar"
  }
}

Checked CD list for VM on the hypervisor

[12:19 ref-trl-6722-x-M7-abhishek-kumar-xs1 ~]# xe vm-cd-list vm=i-2-9-VM 
CD 0 VBD:
uuid ( RO)             : 3954c440-fe40-4c88-305f-a98d337f842a
    vm-name-label ( RO): i-2-9-VM
            empty ( RO): false
       userdevice ( RW): 3


CD 0 VDI:
uuid ( RO)             : e0c92d6c-33ca-47a5-b87a-727aaab08693
       name-label ( RW): 204-2-fb774b79-018c-372a-92e5-ca89881d6989.iso
    sr-name-label ( RO): i-2-9-VM-ISO
     virtual-size ( RO): 16777216


CD 1 VBD:
uuid ( RO)             : d3602682-c29c-151e-16ef-5d466433a249
    vm-name-label ( RO): i-2-9-VM
            empty ( RO): false
       userdevice ( RW): 4


CD 1 VDI:
uuid ( RO)             : 610f40b1-155a-4a4c-be71-9b48326447b1
       name-label ( RW): i-2-9-VM.iso
    sr-name-label ( RO): i-2-9-VM-CONFIGDRIVE-ISO
     virtual-size ( RO): 405504

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

Fixes apache#7902

This PR allows attaching a regular ISO to a VM when it already has the
config drive ISO attached.
Config-drive ISO is now attached with the SR name-label
<VM-NAME>-CONFIGDRIVE-ISO. While regular ISOs continue to attach with SR
name-label <VM-NAME>-ISO. VM which already have the configdrive ISO
attached before this fix will return an appropriate error and will need
to be stopped-start.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Jun 11, 2024

Codecov Report

Attention: Patch coverage is 0% with 17 lines in your changes missing coverage. Please review.

Project coverage is 14.96%. Comparing base (c779b1c) to head (5db9811).
Report is 47 commits behind head on 4.19.

Files Patch % Lines
...ervisor/xenserver/resource/CitrixResourceBase.java 0.00% 14 Missing ⚠️
...urce/wrapper/xenbase/CitrixStopCommandWrapper.java 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.19    #9216      +/-   ##
============================================
- Coverage     14.96%   14.96%   -0.01%     
- Complexity    10994    10998       +4     
============================================
  Files          5373     5373              
  Lines        469248   469326      +78     
  Branches      58967    57730    -1237     
============================================
- Hits          70220    70218       -2     
- Misses       391253   391336      +83     
+ Partials       7775     7772       -3     
Flag Coverage Δ
uitests 4.30% <ø> (-0.01%) ⬇️
unittests 15.67% <0.00%> (-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.

@weizhouapache weizhouapache linked an issue Jun 11, 2024 that may be closed by this pull request
Copy link
Copy Markdown
Member

@yadvr yadvr left a comment

Choose a reason for hiding this comment

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

LGTM - didn't test it

@apache apache deleted a comment from blueorangutan Jun 12, 2024
@apache apache deleted a comment from blueorangutan Jun 12, 2024
@shwstppr shwstppr closed this Jun 12, 2024
@shwstppr shwstppr reopened this Jun 12, 2024
@shwstppr
Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@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.

@blueorangutan
Copy link
Copy Markdown

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

@shwstppr shwstppr marked this pull request as ready for review June 12, 2024 12:22
@shwstppr shwstppr requested a review from weizhouapache June 12, 2024 12:22
@shwstppr
Copy link
Copy Markdown
Contributor Author

@blueorangutan test rocky8 xcpng82

@blueorangutan
Copy link
Copy Markdown

@shwstppr a [SL] Trillian-Jenkins test job (rocky8 mgmt + xcpng82) has been kicked to run smoke tests

@blueorangutan
Copy link
Copy Markdown

[SF] Trillian test result (tid-10425)
Environment: xcpng82 (x2), Advanced Networking with Mgmt server r8
Total time taken: 72539 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9216-t10425-xcpng82.zip
Smoke tests completed. 124 look OK, 7 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_01_condensed_drs_algorithm Failure 210.61 test_cluster_drs.py
test_02_balanced_drs_algorithm Failure 197.06 test_cluster_drs.py
test_01_non_strict_host_anti_affinity Error 200.14 test_nonstrict_affinity_group.py
test_02_non_strict_host_affinity Error 119.77 test_nonstrict_affinity_group.py
test_create_pvlan_network Error 0.10 test_pvlan.py
test_deploy_vm_with_registered_userdata Error 830.28 test_register_userdata.py
test_deploy_vm_with_registered_userdata_with_override_policy_allow Error 813.49 test_register_userdata.py
test_deploy_vm_with_registered_userdata_with_override_policy_append Error 875.40 test_register_userdata.py
test_deploy_vm_with_registered_userdata_with_params Error 859.45 test_register_userdata.py
test_01_restore_vm Error 0.04 test_restore_vm.py
test_02_restore_vm_allocated_root Error 0.05 test_restore_vm.py
test_02_trigger_shutdown Failure 341.68 test_safe_shutdown.py
test_01_deploy_vm_on_specific_host Error 0.12 test_vm_deployment_planner.py
test_02_deploy_vm_on_specific_cluster Error 0.10 test_vm_deployment_planner.py
test_03_deploy_vm_on_specific_pod Error 0.13 test_vm_deployment_planner.py
test_04_deploy_vm_on_host_override_pod_and_cluster Error 0.16 test_vm_deployment_planner.py
test_05_deploy_vm_on_cluster_override_pod Error 0.12 test_vm_deployment_planner.py

Copy link
Copy Markdown
Contributor

@sureshanaparti sureshanaparti left a comment

Choose a reason for hiding this comment

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

clgtm

@sureshanaparti
Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@sureshanaparti 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.

@blueorangutan
Copy link
Copy Markdown

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

Copy link
Copy Markdown
Member

@weizhouapache weizhouapache 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

@sureshanaparti
Copy link
Copy Markdown
Contributor

@blueorangutan test rocky8 xcpng82

@blueorangutan
Copy link
Copy Markdown

@sureshanaparti a [SL] Trillian-Jenkins test job (rocky8 mgmt + xcpng82) has been kicked to run smoke tests

@blueorangutan
Copy link
Copy Markdown

[SF] Trillian test result (tid-10628)
Environment: xcpng82 (x2), Advanced Networking with Mgmt server r8
Total time taken: 68101 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9216-t10628-xcpng82.zip
Smoke tests completed. 129 look OK, 2 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_01_condensed_drs_algorithm Failure 166.51 test_cluster_drs.py
test_02_balanced_drs_algorithm Failure 179.68 test_cluster_drs.py
test_01_non_strict_host_anti_affinity Error 206.63 test_nonstrict_affinity_group.py
test_02_non_strict_host_affinity Error 117.98 test_nonstrict_affinity_group.py

@sureshanaparti
Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@sureshanaparti 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.

Copy link
Copy Markdown
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

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

lgtm

tested ok, after ISO is attached

# xe vm-cd-list vm=i-2-3-VM
CD 0 VBD:
uuid ( RO)             : 3603b8ee-3cf0-f0a6-7777-8518eeaa66c3
    vm-name-label ( RO): i-2-3-VM
            empty ( RO): false
       userdevice ( RW): 3


CD 0 VDI:
uuid ( RO)             : 598a3c63-d73a-4a3a-983c-e816042d749f
       name-label ( RW): 202-2-06d5aca2-0ed7-3890-ace9-0dd7e42f4d82.iso
    sr-name-label ( RO): i-2-3-VM-ISO
     virtual-size ( RO): 9369600


CD 1 VBD:
uuid ( RO)             : da9d4657-dac7-44fb-34cf-3e3fd19f97dd
    vm-name-label ( RO): i-2-3-VM
            empty ( RO): false
       userdevice ( RW): 4


CD 1 VDI:
uuid ( RO)             : 1ae84149-3214-4530-8e4d-218c675790ff
       name-label ( RW): i-2-3-VM.iso
    sr-name-label ( RO): i-2-3-VM-CONFIGDRIVE-ISO
     virtual-size ( RO): 405504

@blueorangutan
Copy link
Copy Markdown

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

Copy link
Copy Markdown
Member

@vishesh92 vishesh92 left a comment

Choose a reason for hiding this comment

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

clgtm.

Tested. Works as expected.

@vishesh92 vishesh92 merged commit 53faf0f into apache:4.19 Jun 27, 2024
@vishesh92 vishesh92 deleted the fix-xen-isowithconfigdrive branch June 27, 2024 10:40
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Jul 2, 2024
* xenserver: attach regular iso with configdrive

Fixes apache#7902

This PR allows attaching a regular ISO to a VM when it already has the
config drive ISO attached.
Config-drive ISO is now attached with the SR name-label
<VM-NAME>-CONFIGDRIVE-ISO. While regular ISOs continue to attach with SR
name-label <VM-NAME>-ISO. VM which already have the configdrive ISO
attached before this fix will return an appropriate error and will need
to be stopped-start.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Abhishek's Bugfix List
Status: Done

Development

Successfully merging this pull request may close these issues.

Failed to attach iso to VM with ConfigDrive on xen/xcpng

8 participants