Remove Logical Domains and Services

We 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

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
ldom3 active -n---- 5001 8 8G 0.1% 7h 26m

Stop the Domain

-bash-3.2# ldm stop-domain ldom3
-bash-3.2# ldm unbind-domain ldom3
-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
ldom3 inactive ------ 8 8G

Now we can remove the in-active GD from the hypervisor

-bash-3.2# ldm remove-domain ldom3
-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#

How to remove the specific resources from the guest domain

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

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.

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 
<<<<<<<<>>>>
/opt/SUNWldm/bin/schemas/ovf-strings.xsd
/opt/SUNWldm/bin/schemas/ovf-section.xsd
/opt/SUNWldm/bin/schemas/ovf-envelope.xsd
/opt/SUNWldm/bin/schemas/ovf-core.xsd
/opt/SUNWldm/bin/schemas/ldmd-property.xsd
/opt/SUNWldm/bin/schemas/ldmd-binding.xsd
/opt/SUNWldm/bin/schemas/event-v3.xsd
/opt/SUNWldm/bin/schemas/combined-v3.xsd
/opt/SUNWldm/bin/schemas/cli-list-constraint-v3.xsd
/opt/SUNWldm/bin/schemas/cim-vssd.xsd
/opt/SUNWldm/bin/schemas/cim-rasd.xsd
/opt/SUNWldm/bin/schemas/cim-common.xsd
/opt/SUNWldm/bin/schemas
/opt/SUNWldm/bin/ldmd_start
/opt/SUNWldm/bin/ldmd
/opt/SUNWldm/bin/ldmconfig
/opt/SUNWldm/bin/ldm
/opt/SUNWldm/bin
/opt/SUNWldm
/opt 
## Updating system information.
Removal of was successful.
bash-3.2# pkgrm SUNWldomu
The following package is currently installed:
 SUNWldomu Solaris Logical Domains (Usr)
 (sparc.sun4v) 11.10.0,REV=2006.08.08.12.13
Do you want to remove this package? [y,n,?,q] y
## Removing installed package instance 
## Verifying package dependencies in global zone
## Processing package information.
## Removing pathnames in class 
/usr/lib/sparcv9/libpri.so.1
/usr/lib/sparcv9/libds.so.1
/usr/lib/sparcv9 
/usr/lib/libpri.so.1
/usr/lib/libds.so.1
/usr/lib/ldoms/vntsd
/usr/lib/ldoms/ldmad
/usr/lib/ldoms/drd
/usr/lib/ldoms
/usr/lib 
/usr 
## Updating system information.
Removal of was successful.
bash-3.2# pkgrm SUNWldomr

The following package is currently installed:
 SUNWldomr Solaris Logical Domains (Root)
 (sparc.sun4v) 11.10.0,REV=2006.10.04.00.26

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.
## Executing preremove script.
## Removing pathnames in class 
Waiting up to 60 seconds for svc:/ldoms/vntsd:default to stop...
Waiting up to 60 seconds for svc:/ldoms/agents:default to stop...
Waiting up to 60 seconds for svc:/platform/sun4v/drd:default to stop...
## Removing pathnames in class 
/var/svc/manifest/platform/sun4v 
/var/svc/manifest/platform 
/var/svc/manifest 
/var/svc 
/var 
/platform/sun4v/kernel/misc/sparcv9/platsvc
/platform/sun4v/kernel/misc/sparcv9/ldc
/platform/sun4v/kernel/misc/sparcv9/fault_iso
/platform/sun4v/kernel/misc/sparcv9/ds
/platform/sun4v/kernel/misc/sparcv9/dr_mem
/platform/sun4v/kernel/misc/sparcv9/dr_io
/platform/sun4v/kernel/misc/sparcv9/dr_cpu
/platform/sun4v/kernel/misc/sparcv9 
/platform/sun4v/kernel/misc 
/platform/sun4v/kernel/drv/sparcv9/vsw
/platform/sun4v/kernel/drv/sparcv9/vnet
/platform/sun4v/kernel/drv/sparcv9/vlds
/platform/sun4v/kernel/drv/sparcv9/vldc
/platform/sun4v/kernel/drv/sparcv9/vds
/platform/sun4v/kernel/drv/sparcv9/vdc
/platform/sun4v/kernel/drv/sparcv9/vcc
/platform/sun4v/kernel/drv/sparcv9/ds_snmp
/platform/sun4v/kernel/drv/sparcv9/ds_pri
/platform/sun4v/kernel/drv/sparcv9/drctl
/platform/sun4v/kernel/drv/sparcv9/cnex
/platform/sun4v/kernel/drv/sparcv9 
/platform/sun4v/kernel/drv/ds_snmp.conf
/platform/sun4v/kernel/drv/ds_pri.conf
/platform/sun4v/kernel/drv/drctl.conf
/platform/sun4v/kernel/drv 
/platform/sun4v/kernel 
/platform/sun4v 
/platform 
/lib/svc/method/svc-vntsd
/lib/svc/method/svc-drd
/lib/svc/method/ldoms-agents
/lib/svc/method 
/lib/svc 
/lib 
## Updating system information.
Removal of was successful.
bash-3.2# pkginfo | grep -i ldom
application SUNWldmp2v LDoms P2V tool
bash-3.2# pkgrm SUNWldmp2v
The following package is currently installed:
 SUNWldmp2v LDoms P2V tool
 (sparc) 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 
## Removing pathnames in class 
/usr/share/man/man1m/ldmp2v.1m
/usr/share/man/man1m 
/usr/share/man 
/usr/share 
/usr/sbin/ldmp2v
/usr/sbin 
/usr 
/opt/SUNWldmp2v/man/man1m/ldmp2v.1m
/opt/SUNWldmp2v/man/man1m
/opt/SUNWldmp2v/man
/opt/SUNWldmp2v/lib/ldmp2v_convert
/opt/SUNWldmp2v/lib
/opt/SUNWldmp2v/etc/ldmp2v.conf.sample
/opt/SUNWldmp2v/etc
/opt/SUNWldmp2v/bin/ldmp2v_prepare
/opt/SUNWldmp2v/bin
/opt/SUNWldmp2v
/opt 
## Updating system information.
Removal of was successful.
bash-3.2# pkginfo | grep -i ldom*
bash-3.2# pkginfo | grep -i ldm*
bash-3.2#
You have successfully uninstall the oracle VM for SPARC software. You can safely recycle the control domain to remove the complete ldom stuffs.

Add/remove vdisk to/from Guest LDOMS online