Destroying the infrastructure is a easy task in all the environments.In oracle VM for SPARC also ,you can easily remove the guest domains in few seconds. The same way you can also remove the virtual disk resources and virtual network resources. In some cases you may not able to remove the resources if its in use or already bound to any guest domains. In this article ,we will see how to remove the guest domains and how to remove the virtual services like vds and vswitch.
Oracle VM for SPARC Tutorial:
[checklist]
- Installation and Configuring the Primary domain
- Creating Guest Domains
- Configuring I/O Domain
- Dynamically adding/removing Resources
- Live Migration for Guest Domains
- Adding ISO image to Multiple Guests
- Configuration Backup & Restore
- Removing the LDOM and Services (You Are Here)
[/checklist]
1. Login to the control domain and list the available domains.
-bash-3.2# ldm ls-domain NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME primary active -n-cv- SP 14 4128M 0.2% 8h 7m ldom2 active -t---- 5000 2 6G 50% 4m ldom2clone active -n---- 5001 8 8G 0.1% 7h 26m
2.Halt the domain by logging in to the guest domain operating system. (init 5) . You can also perform the force shutdown from the control domain using the below command.
-bash-3.2# ldm stop-domain ldom2clone LDom ldom2clone stopped
3.Un-bind the domain from the hypervisor.
-bash-3.2# ldm unbind-domain ldom2clone -bash-3.2# ldm ls-domain NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME primary active -n-cv- SP 14 4128M 6.8% 8h 8m ldom2 active -t---- 5000 2 6G 50% 5m ldom2clone inactive ------ 8 8G -bash-3.2#
4.Now you can remove the inactive guest domain from the hypervisor.
-bash-3.2# ldm remove-domain ldom2clone -bash-3.2# ldm ls-domain NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME primary active -n-cv- SP 14 4128M 0.2% 8h 10m ldom2 active -t---- 5000 2 6G 50% 7m -bash-3.2#
You can see ldom2clone has been removed from the hypervisor completely.
If you want to remove the specific resources from the guest domain,follow the below steps.
1. List the bounded resources for one of the guest domain. (ldom2)
-bash-3.2# ldm list-bindings ldom2 NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME ldom2 active -t---- 5000 2 6G 50% 8m UUID f2aa98a4-ddae-6d93-948f-9e2e9e81ff40 MAC 00:14:4f:fb:b6:94 HOSTID 0x84fbb694 CONTROL failure-policy=ignore DEPENDENCY master= CORE CID CPUSET 1 (8, 9) VCPU VID PID CID UTIL STRAND 0 8 1 100% 100% 1 9 1 0.0% 100% MEMORY RA PA SIZE 0x10000000 0x10000000 4G 0x480000000 0x390000000 2G VARIABLES auto-boot?=false boot-device=disk:a disk net keyboard-layout=US-English NETWORK NAME SERVICE ID DEVICE MAC MODE PVID VID MTU LINKPROP vnet0 primary-vds0@primary 0 network@0 00:14:4f:f9:53:57 1 1500 PEER MAC MODE PVID VID MTU LINKPROP primary-vds0@primary 00:14:4f:fb:e2:f3 1 1500 DISK NAME VOLUME TOUT ID DEVICE SERVER MPGROUP vdisk1_dom2 vol1@primary-vds0 1 disk@1 primary iso_ldom2 iso0@primary-vds0 2 disk@2 primary uavdisk uavol1@primary-vds0 0 disk@0 primary VCONS NAME SERVICE PORT ldom2 primary-vcc0@primary 5000
2.Try to remove the one of the virtual disk resource from the guest domain.
-bash-3.2# ldm remove-vdisk uavdisk ldom2 Please perform the operation while the LDom is bound or inactive -bash-3.2# ldm remove-vdisk -f uavdisk ldom2 Please perform the operation while the LDom is bound or inactive
You are not able to remove the virtual disk since its in use on ldom2.
3.You can stop the guest domain and then remove it .
-bash-3.2# ldm stop-domain ldom2 LDom ldom2 stopped -bash-3.2# ldm remove-vdisk uavdisk ldom2 -bash-3.2# -bash-3.2# ldm list-bindings ldom2 NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME ldom2 bound ------ 5000 2 6G UUID f2aa98a4-ddae-6d93-948f-9e2e9e81ff40 MAC 00:14:4f:fb:b6:94 HOSTID 0x84fbb694 CONTROL failure-policy=ignore DEPENDENCY master= CORE CID CPUSET 1 (8, 9) VCPU VID PID CID UTIL STRAND 0 8 1 100% 1 9 1 100% MEMORY RA PA SIZE 0x10000000 0x10000000 4G 0x480000000 0x390000000 2G VARIABLES auto-boot?=false boot-device=disk:a disk net keyboard-layout=US-English NETWORK NAME SERVICE ID DEVICE MAC MODE PVID VID MTU LINKPROP vnet0 primary-vds0@primary 0 network@0 00:14:4f:f9:53:57 1 1500 PEER MAC MODE PVID VID MTU LINKPROP primary-vds0@primary 00:14:4f:fb:e2:f3 1 1500 DISK NAME VOLUME TOUT ID DEVICE SERVER MPGROUP vdisk1_dom2 vol1@primary-vds0 1 disk@1 primary iso_ldom2 iso0@primary-vds0 2 disk@2 primary VCONS NAME SERVICE PORT ldom2 primary-vcc0@primary 5000 -bash-3.2#
4. Removing the devices from the vds service
-bash-3.2# ldm list-services VCC NAME LDOM PORT-RANGE primary-vcc0 primary 5000-5100 VSW NAME LDOM MAC NET-DEV ID DEVICE LINKPROP DEFAULT-VLAN-ID PVID VID MTU MODE primary-vds0 primary 00:14:4f:fb:e2:f3 nxge0 0 switch@0 1 1 1500 primary-vsw0 primary 00:14:4f:fa:bf:27 nxge1 1 switch@1 1 1 1500 VDS NAME LDOM VOLUME OPTIONS MPGROUP DEVICE primary-vds0 primary vol1 /dev/zvol/dsk/pool1/vol1 iso0 /export/home/sol-10-u10-ga2-sparc-dvd.iso clonevol1 /dev/zvol/dsk/pool1/clonevol1 vol0 /dev/dsk/c3t600144F0B8E706DA00005300F4270004d0s2 vol2 /dev/dsk/c3t600144F0C1135B490000530383D70006d0 uavol1 /dev/zvol/dsk/pool1/uavol1 -bash-3.2# ldm remove-vdsdev uavol1@primary-vds0 -bash-3.2# ldm list-services VCC NAME LDOM PORT-RANGE primary-vcc0 primary 5000-5100 VSW NAME LDOM MAC NET-DEV ID DEVICE LINKPROP DEFAULT-VLAN-ID PVID VID MTU MODE primary-vds0 primary 00:14:4f:fb:e2:f3 nxge0 0 switch@0 1 1 1500 primary-vsw0 primary 00:14:4f:fa:bf:27 nxge1 1 switch@1 1 1 1500 VDS NAME LDOM VOLUME OPTIONS MPGROUP DEVICE primary-vds0 primary vol1 /dev/zvol/dsk/pool1/vol1 iso0 /export/home/sol-10-u10-ga2-sparc-dvd.iso clonevol1 /dev/zvol/dsk/pool1/clonevol1 vol0 /dev/dsk/c3t600144F0B8E706DA00005300F4270004d0s2 vol2 /dev/dsk/c3t600144F0C1135B490000530383D70006d0 -bash-3.2#
We have seen how to remove the assigned virtual disk from the guest and removing the disk from the virtual disk server.
Now we will see how to remove the complete service from the service domain aka primary domain.
1.Try to remove the virtual switch service from service domain
-bash-3.2# ldm remove-vsw primary-vds0 Service is active and being used by bound client(s) Failed to remove virtual switch
2.The above command failed because,that virtual service is used for some of the guest domains. First remove the those assigned virtual resources from guest domain the n try to remove it.
-bash-3.2# ldm remove-vsw primary-vsw0 -bash-3.2# ldm list-services VCC NAME LDOM PORT-RANGE primary-vcc0 primary 5000-5100 VSW NAME LDOM MAC NET-DEV ID DEVICE LINKPROP DEFAULT-VLAN-ID PVID VID MTU MODE primary-vds0 primary 00:14:4f:fb:e2:f3 nxge0 0 switch@0 1 1 1500 VDS NAME LDOM VOLUME OPTIONS MPGROUP DEVICE primary-vds0 primary vol1 /dev/zvol/dsk/pool1/vol1 iso0 /export/home/sol-10-u10-ga2-sparc-dvd.iso clonevol1 /dev/zvol/dsk/pool1/clonevol1 vol0 /dev/dsk/c3t600144F0B8E706DA00005300F4270004d0s2 vol2 /dev/dsk/c3t600144F0C1135B490000530383D70006d0
Using the same setup commands (showed in this article), you can remove the other guest domains and virtual services.
Once you have cleared the all services and domains, you can uninstall the oracle VM for SPARC software using below method.
bash-3.2# pkgrm SUNWldm The following package is currently installed: SUNWldm LDoms Manager software (sparc.sun4v) 2.0,REV=2010.09.02.10.08 Do you want to remove this package? [y,n,?,q] y ## Removing installed package instance This package contains scripts which will be executed with super-user permission during the process of removing this package. Do you want to continue with the removal of this package [y,n,?,q] y ## Verifying package dependencies in global zone ## Processing package information. ## Removing pathnames in class Waiting up to 60 seconds for svc:/ldoms/ldmd:default to stop... ## Removing pathnames in class /var/svc/manifest/platform/sun4v /var/svc/manifest/platform /var/svc/manifest /var/svc <<<<<<<<
You have successfully uninstall the oracle VM for SPARC software. You can safely recycle the control domain to remove the complete ldom stuffs.
Thank you for visiting UnixArena.
himanshu rajput says
How to perform os hardening in solaris 11.4