Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ Description: CloudStack server library

Package: cloudstack-agent
Architecture: all
Depends: ${python:Depends}, openjdk-8-jre-headless | java8-runtime-headless | java8-runtime, cloudstack-common (= ${source:Version}), lsb-base (>= 4.0), libcommons-daemon-java, openssh-client, qemu-kvm (>= 1.0), libvirt-bin (>= 0.9.8), uuid-runtime, iproute, ebtables, vlan, jsvc, ipset, python-libvirt, ethtool, iptables, lsb-release, init-system-helpers (>= 1.14~)
Depends: ${python:Depends}, openjdk-8-jre-headless | java8-runtime-headless | java8-runtime, cloudstack-common (= ${source:Version}), lsb-base (>= 4.0), libcommons-daemon-java, openssh-client, qemu-kvm (>= 1.0), libvirt-bin (>= 1.2.2), uuid-runtime, iproute, ebtables, vlan, jsvc, ipset, python-libvirt, ethtool, iptables, lsb-release, init-system-helpers (>= 1.14~)
Recommends: init-system-helpers

@yadvr yadvr Jul 13, 2017

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This might break pkg building or installation on 14.04/16.04. @ustcweizhou do you remember doing similar changes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I checked the libvirt version, that one is present in Ubuntu 14.04

Conflicts: cloud-agent, cloud-agent-libs, cloud-agent-deps, cloud-agent-scripts
Description: CloudStack agent
The CloudStack agent is in charge of managing shared computing resources in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -659,25 +659,25 @@ public KVMPhysicalDisk createPhysicalDisk(String name, KVMStoragePool pool,
s_logger.info("Attempting to create volume " + name + " (" + pool.getType().toString() + ") in pool "
+ pool.getUuid() + " with size " + size);

switch (pool.getType()){
case RBD:
return createPhysicalDiskOnRBD(name, pool, format, provisioningType, size);
case NetworkFilesystem:
case Filesystem:
switch (format){
case QCOW2:
return createPhysicalDiskByQemuImg(name, pool, format, provisioningType, size);
case RAW:
return createPhysicalDiskByQemuImg(name, pool, format, provisioningType, size);
case DIR:
return createPhysicalDiskByLibVirt(name, pool, format, provisioningType, size);
case TAR:
switch (pool.getType()) {
case RBD:
return createPhysicalDiskByLibVirt(name, pool, format, provisioningType, size);
case NetworkFilesystem:
case Filesystem:
switch (format) {
case QCOW2:
return createPhysicalDiskByQemuImg(name, pool, format, provisioningType, size);
case RAW:
return createPhysicalDiskByQemuImg(name, pool, format, provisioningType, size);
case DIR:
return createPhysicalDiskByLibVirt(name, pool, format, provisioningType, size);
case TAR:
return createPhysicalDiskByLibVirt(name, pool, format, provisioningType, size);
default:
throw new CloudRuntimeException("Unexpected disk format is specified.");
}
default:
throw new CloudRuntimeException("Unexpected disk format is specified.");
}
default:
return createPhysicalDiskByLibVirt(name, pool, format, provisioningType, size);
return createPhysicalDiskByLibVirt(name, pool, format, provisioningType, size);
}
}

Expand Down Expand Up @@ -748,50 +748,6 @@ private KVMPhysicalDisk createPhysicalDiskByQemuImg(String name, KVMStoragePool
return disk;
}

private KVMPhysicalDisk createPhysicalDiskOnRBD(String name, KVMStoragePool pool,
PhysicalDiskFormat format, Storage.ProvisioningType provisioningType, long size) {
String volPath = null;

/**
* To have RBD function properly we want RBD images of format 2
* libvirt currently defaults to format 1
*
* This has been fixed in libvirt 1.2.2, but that's not upstream
* in all distributions
*
* For that reason we use the native RBD bindings to create the
* RBD image until libvirt creates RBD format 2 by default
*/

try {
s_logger.info("Creating RBD image " + pool.getSourceDir() + "/" + name + " with size " + size);

Rados r = new Rados(pool.getAuthUserName());
r.confSet("mon_host", pool.getSourceHost() + ":" + pool.getSourcePort());
r.confSet("key", pool.getAuthSecret());
r.confSet("client_mount_timeout", "30");
r.connect();
s_logger.debug("Succesfully connected to Ceph cluster at " + r.confGet("mon_host"));

IoCTX io = r.ioCtxCreate(pool.getSourceDir());
Rbd rbd = new Rbd(io);
rbd.create(name, size, rbdFeatures, rbdOrder);

r.ioCtxDestroy(io);
} catch (RadosException e) {
throw new CloudRuntimeException(e.toString());
} catch (RbdException e) {
throw new CloudRuntimeException(e.toString());
}

volPath = pool.getSourceDir() + "/" + name;
KVMPhysicalDisk disk = new KVMPhysicalDisk(volPath, name, pool);
disk.setFormat(PhysicalDiskFormat.RAW);
disk.setSize(size);
disk.setVirtualSize(size);
return disk;
}

@Override
public boolean connectPhysicalDisk(String name, KVMStoragePool pool, Map<String, String> details) {
// this is for managed storage that needs to prep disks prior to use
Expand Down