Rename a guest domain (Solaris LDOM)

Disclaimer: I test following procedure to rename the guest domain. It worked for me, but it’s may not be the right procedure. Do not try on your prod environment

Rename the Guest domain:
==========================
Bring down the guest domain OS to OK prompt

bash-3.2# ldm list old-ldg1
NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME
old-ldg1 active     -t—-  5000    16    8G       6.2%  23h 17m

#ldm stop-domain old-ldg1
LDom old-ldg1 stopped

bash-3.2# ldm list old-ldg1
NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME
old-ldg1 bound      ——  5000    16    8G

Then run unbind command, it will change to inactive state

bash-3.2# ldm unbind old-ldg1
bash-3.2# ldm list old-ldg1
NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME
old-ldg1 inactive   ——          16    8G

Save the guest domain configuration to a xml

bash-3.2# ldm list-constraints -x old-ldg1 > /var/tmp/old-ldg1.xml

Create copy of the xmls

cp -p /var/tmp/old-ldg1.xml /var/tmp/new-ldg1.xml

bash-3.2# grep -i old-ldg1 /var/tmp/old-ldg1.xml
<Content xsi:type=”ovf:VirtualSystem_Type” ovf:id=”old-ldg1″>
<gprop:GenericProperty key=”vol_name”>old-ldg1_sys</gprop:GenericProperty>
<gprop:GenericProperty key=”vol_name”>old-ldg1_sys</gprop:GenericProperty>
<gprop:GenericProperty key=”block_dev”>/dev/zvol/dsk/root/vdsk_old-ldg1_sys</gprop:GenericProperty>
bash-3.2# cp /var/tmp/old-ldg1.xml /var/tmp/new-ldg1.xml
bash-3.2#perl -pi -e ‘s/old-ldg1/new-ldg1/g’ /var/tmp/new-ldg1.xml
bash-3.2# grep -i new-ldg1 /var/tmp/new-ldg1.xml
<Content xsi:type=”ovf:VirtualSystem_Type” ovf:id=”new-ldg1″>
<gprop:GenericProperty key=”vol_name”>new-ldg1_sys</gprop:GenericProperty>
<gprop:GenericProperty key=”vol_name”>new-ldg1_sys</gprop:GenericProperty>
<gprop:GenericProperty key=”block_dev”>/dev/zvol/dsk/root/vdsk_new-ldg1_sys</gprop:GenericProperty>

For ldm 3.x version please remove existing domain configuration to clear uuid. Thanks to Neeraj and Raphael for their comments

bash-3.2# ldm remove-domain old-ldg1

bash-3.2# ldm add-domain -i /var/tmp/new-ldg1.xml
bash-3.2# ldm list
NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME
primary          active     -n-cv-  UART    8     1G       1.1%  1d 3h 24m
new-ldg1 inactive   ——          16    8G
bash-3.2# ldm bind new-ldg1
bash-3.2# ldm start new-ldg1
LDom new-ldg1 started
bash-3.2# ldm list
NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME
primary          active     -n-cv-  UART    8     1G       4.8%  1d 3h 25m
new-ldg1 active     -t—-  5000    16    8G       3.5%  2s

Verify connecting to new guest domain console:

bash-3.2# telnet localhost 5000
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.

Connecting to console “new-ldg1” in group “new-ldg1” ….
Press ~? for control options ..

{0} ok
telnet> quit
Connection to localhost closed.
bash-3.2#

Advertisements

Author: rajukv

Hadoop(BigData) Architect and Hadoop Security Architect can design and build hadoop system to meet various data science projects.

13 thoughts on “Rename a guest domain (Solaris LDOM)”

    1. This is require to remove ldom and add again, than it will give UUID error message
      Ldm remove-domain new-ldg1
      ldm add-domain -i /var/tmp/new-ldg1.xml ( need to rename old-ldg1 to new-ldg1 in this file)

    2. any idea how it will for

      root@asgc-ebsapptr1 # ldm -V

      Logical Domains Manager (v 3.1.0.0.24)
      Hypervisor control protocol v 1.9
      Using Hypervisor MD v 1.4

    3. along with replacing domain name using perl, replace uuid also as it will be unique for each domain
      perl -pi -e ‘s/old-ldg1/new-ldg1/g’ /var/tmp/new-ldg1.xml
      perl -pi -e ‘s/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxyy/g’ /var/tmp/new-ldg1.xml

      uuid=uuid

      Specifies the universally unique identifier (UUID) for the domain. uuid is a hexadecimal string, such as 12345678-1234-abcd-1234-123456789abc, which consists of five hexadecimal numbers separated by dashes. Each number must have the specified number of hexadecimal digits: 8, 4, 4, 4, and 12, as follows:

      xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

  1. I’m also getting the following error on LDOM version 3.0:

    # ldm add-domain -i /opt/tmp/ldm_list_contraints_jupiter.xml
    uuid ‘3901aee6-038b-62fd-cab1-f3cf197f9a1e’ is already in use

    nysolsbx1 # pkg info ldomsmanager | grep Version
    Version: 3.0.0.2

    Could you please let me know the solution

    Thanks
    -Jayanthi

  2. Thanks a lot man, this worked pretty well.
    I also got the UUID already in used error.

    I have to first removed the old ldom:
    ldm remove-domain old-ldg1

    Then I could add a new once.
    ldm add-domain -i /var/tmp/new-ldg1.xml

  3. Hi Raju,

    while restoring xml file getting some error, followed below steps:

    root@aebsapptr1 # ldm list
    NAME STATE FLAGS CONS VCPU MEMORY UTIL NORM UPTIME
    primary active -n-cv- UART 8 4G 0.3% 0.3% 14h 52m
    ebsdb active -n—- 5000 12 12G 0.0% 0.0% 14h 47m
    ebsapp01 inactive —— 32 12G

    root@ebsapptr1 # cp -p /var/tmp/ebsapp01.xml /var/tmp/ldm-ebsapp.xml

    root@ebsapptr1 # vi /var/tmp/ebsapp01.xml

    root@aebsapptr1 # ldm destroy ebsapp01

    droot@ebsapptr1 # ldm add-domain -i /var/tmp/ldm-ebsapp.xml
    Invalid shutdown-group: 0

    root@ebsapptr1 # ldm add-domain -i /var/tmp/ldm-ebsapp.xml
    Invalid shutdown-group: 0

    root@ebsapptr1 # ldm list
    NAME STATE FLAGS CONS VCPU MEMORY UTIL NORM UPTIME
    primary active -n-cv- UART 8 4G 0.1% 0.1% 14h 54m
    ebsdb active -n—- 5000 12 12G 0.0% 0.0% 14h 48m

    root@ebsapptr1 # ldm bind ldm-ebsapp
    LDom “ldm-ebsapp” was not found

    root@ebsapptr1 # ldm start ebsapp
    LDom “ebsapp” was not found

    root@ebsapptr1 # ldm add-domain -i /var/tmp/ldm-ebsapp.xml
    Invalid shutdown-group: 0

    root@ebsapptr1 # ldm add-domain /var/tmp/ldm-ebsapp.xml
    Name must start with an alpha-numberic character

    Illegal domain name /var/tmp/ldm-ebsapp.xml

    root@bsapptr1 # cd /var/tmp

    root@ebsapptr1 # ls -lrt|grep -i ebs

    -rw-r–r– 1 root root 7444 Oct 27 15:18 ldm-ebsapp.xml
    -rw-r–r– 1 root root 7446 Oct 27 15:21 ebsapp01.xml
    add-domain -i var/tmp/ldm-

    please suggest.

    regards,Izni

    1. Looks like you didn’t follow the sequence I have mentioned. Mostly you forgot to unbind before generating xml file.

      Step#1:STOP guest domain
      ldm stop-domain old-ldg1
      Step#2 Unbind
      ldm unbind old-ldg1

      Step#3 Generate xml
      ldm list-constraints -x old-ldg1 > /var/tmp/old-ldg1.xml

      Step#4: Create a copy of xml
      cp -p /var/tmp/old-ldg1.xml /var/tmp/new-ldg1.xml

      Step#5: Edit new xml file replacing all instances of guest domain name using perl or sed

      perl -pi -e ‘s/old-ldg1/new-ldg1/g’ /var/tmp/new-ldg1.xml

      Step#6 Import the xml file
      ldm add-domain -i /var/tmp/new-ldg1.xml

      Step#7 Bind the new domain
      ldm bind new-ldg1

      Step#8 Start new guest domain
      ldm start new-ldg1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s