Monday, January 28, 2013

Friday, January 25, 2013

Xen - Moving Virtual Disk Images (VDIs) between SRs

Copying all of a VM's VDIs to a different SR

The XenCenter Copy VM function will create copies of all VDIs for a selected VM on the same or a different SR. The source VM and VDIs are not affected by default. To move the VM to the selected SR rather than creating a copy, select the "Remove original VM" option in the Copy Virtual Machine dialog box.
  1. Shutdown the VM.
  2. Within XenCenter select the VM and then select the VM ... Copy VM menu option.
  3. Select the desired target SR.

Copying individual VDIs to a different SR

A combination of the xe CLI and XenCenter can be used to copy individual VDIs between SRs.
  1. Shutdown the VM.
  2. Use the xe CLI to identify the VDI UUIDs for the VDIs to be moved. If the VM has a DVD drive it's vdi-uuid will be listed as <not in database> and can be ignored.
    xe vbd-list vm-uuid=<VALID_VM_UUID>

    Note

    The vbd-list command will display both the VBD and VDI UUIDs. Be sure to record the VDI UUIDs rather than the VBD UUIDs.
  3. Within XenCenter select the VM's storage tab. For each VDI to be moved, select the VDI and click on the Detach button. This step can also be done using the vbd-destroy CLI command.
  4. Use the vdi-copy command to copy each of the VM's VDIs to be moved to the desired SR.
    xe vdi-copy uuid=<VALID_VDI_UUID> sr-uuid=<VALID_SR_UUID>
  5. Within XenCenter select the VM's storage tab. Use the Attach button and select the VDIs from the new SR. This step can also be done use the vbd-create CLI command.
  6. To delete the original VDIs, within XenCenter select the storage tab of the original SR. The original VDIs will be listed with an empty value for the VM field and can be deleted with the Delete button.
Example:

# xe sr-create host-uuid=8e50bb6e-6848-4314-aa8b-177ec9895d8c content-type=user type=lvm device-config:device=/dev/dm-1 name-label=xen01_vm_stor
# xe vm-list
# xe vbd-list vm-uuid=
#xe vdi-copy uuid=vdi-uuid  sr-uuid=uuid_of_the_storage_where_will_be_copied

Thursday, January 24, 2013

Postfix masquerading

vim /etc/postfix/main.cf

Append:
smtp_generic_maps = hash:/etc/postfix/generic

vim /etc/postfix/generic

Append:

apache@localhost.localdomain no-reply@something.com
root@localhost.localdomain no-reply@something.com


postmap /etc/postfix/generic

service postfix restart

Wednesday, January 9, 2013

Multipathing on Xen


remove the existing multipath.conf file and add this
# modprobe dm-multipath
# modprobe dm-round-robin

# service multipathd start
# xe sr-probe type=lvmohba host-uuid=183c6963-44ad-45b0-967e-e92c2b4603cc
# multipath -v2
# multipath -ll

# xe sr-create host-uuid=183c6963-44ad-45b0-967e-e92c2b4603cc content-type=user type=lvm device-config:device=/dev/dm-1 name-label=db01_stor

multipath config



# This is a basic configuration file with some examples, for device mapper
# multipath.
# For a complete list of the default configuration values, see
# /usr/share/doc/device-mapper-multipath-0.4.7/multipath.conf.defaults
# For a list of configuration options with descriptions, see
# /usr/share/doc/device-mapper-multipath-0.4.7/multipath.conf.annotated


# Blacklist all devices by default. Remove this to enable multipathing
# on the default devices.
#blacklist {
#        devnode "*"
#}

#blacklist {
 #      devnode "sdc"
#}



## By default, devices with vendor = "IBM" and product = "S/390.*" are
## blacklisted. To enable mulitpathing on these devies, uncomment the
## following lines.
#blacklist_exceptions {
#       device {
#               vendor  "IBM"
#               product "S/390.*"
#       }
#}

## Use user friendly names, instead of using WWIDs as names.
defaults {
        user_friendly_names yes
}
##
## Here is an example of how to configure some standard options.
##
#
#defaults {
#       multipath_tool  "/sbin/multipath -v0"
#       udev_dir        /dev
#       polling_interval 10
#       default_selector        "round-robin 0"
#       default_path_grouping_policy    failover
#       default_getuid_callout  "/sbin/scsi_id -g -u -s /block/%n"
#       default_prio_callout    "/bin/true"
#       default_features        "0"
#       rr_min_io              100
#       failback                immediate
#}
defaults {
       udev_dir                /dev
       polling_interval        10
       selector                "round-robin 0"
       path_grouping_policy    multibus
       getuid_callout          "/sbin/scsi_id -g -u -s /block/%n"
       prio_callout            /bin/true
       path_checker            readsector0
       rr_min_io               100
       max_fds                 8192
       rr_weight               priorities
       failback                immediate
       no_path_retry           fail
}